Commit 39e8111
Martin KaFai Lau
Merge branch 'add TCP_BPF_SOCK_OPS_CB_FLAGS to bpf_*sockopt()'
Alan Maguire says:
====================
As previously discussed here [1], long-lived sockets can miss
a chance to set additional callbacks if a sock ops program
was not attached early in their lifetime. Adding support
to bpf_setsockopt() to set callback flags (and bpf_getsockopt()
to retrieve them) provides other opportunities to enable callbacks,
either directly via a cgroup/setsockopt intercepted setsockopt()
or via a socket iterator.
Patch 1 adds bpf_[get|set]sockopt() support; patch 2 adds testing
for it via a sockops programs, along with verification via a
cgroup/getsockopt program.
Changes since v1 [2]:
- Removed unneeded READ_ONCE() (Martin, patch 1)
- Reworked sockopt test to leave existing tests undisturbed while adding
test_nonstandard_opt() test to cover the TCP_BPF_SOCK_OPS_CB_FLAGS
case; test verifies that value set via bpf_setsockopt() is what we
expect via a call to getsockopt() which is caught by a
cgroup/getsockopt program to provide the flags value (Martin, patch 2)
- Removed unneeded iterator test (Martin)
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/bpf/[email protected]/
====================
Signed-off-by: Martin KaFai Lau <[email protected]>File tree
5 files changed
+90
-5
lines changed- include/uapi/linux
- net/core
- tools
- include/uapi/linux
- testing/selftests/bpf
- prog_tests
- progs
5 files changed
+90
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2851 | 2851 | | |
2852 | 2852 | | |
2853 | 2853 | | |
2854 | | - | |
| 2854 | + | |
2855 | 2855 | | |
2856 | 2856 | | |
2857 | 2857 | | |
| |||
7080 | 7080 | | |
7081 | 7081 | | |
7082 | 7082 | | |
| 7083 | + | |
7083 | 7084 | | |
7084 | 7085 | | |
7085 | 7086 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5278 | 5278 | | |
5279 | 5279 | | |
5280 | 5280 | | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
5281 | 5286 | | |
5282 | 5287 | | |
5283 | 5288 | | |
| |||
5366 | 5371 | | |
5367 | 5372 | | |
5368 | 5373 | | |
| 5374 | + | |
| 5375 | + | |
| 5376 | + | |
| 5377 | + | |
| 5378 | + | |
| 5379 | + | |
| 5380 | + | |
| 5381 | + | |
| 5382 | + | |
| 5383 | + | |
| 5384 | + | |
5369 | 5385 | | |
5370 | 5386 | | |
5371 | 5387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2851 | 2851 | | |
2852 | 2852 | | |
2853 | 2853 | | |
2854 | | - | |
| 2854 | + | |
2855 | 2855 | | |
2856 | 2856 | | |
2857 | 2857 | | |
| |||
7080 | 7080 | | |
7081 | 7081 | | |
7082 | 7082 | | |
| 7083 | + | |
7083 | 7084 | | |
7084 | 7085 | | |
7085 | 7086 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
157 | 202 | | |
158 | 203 | | |
159 | 204 | | |
| |||
191 | 236 | | |
192 | 237 | | |
193 | 238 | | |
| 239 | + | |
| 240 | + | |
194 | 241 | | |
195 | 242 | | |
196 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
356 | 376 | | |
357 | 377 | | |
358 | 378 | | |
359 | 379 | | |
360 | 380 | | |
| 381 | + | |
361 | 382 | | |
362 | 383 | | |
363 | 384 | | |
| |||
384 | 405 | | |
385 | 406 | | |
386 | 407 | | |
387 | | - | |
388 | | - | |
389 | | - | |
| 408 | + | |
| 409 | + | |
390 | 410 | | |
391 | 411 | | |
392 | 412 | | |
| |||
0 commit comments