Repository navigation
Commit 9fed900
bpf: Allow selecting reuseport socket from a SOCKMAP/SOCKHASH
SOCKMAP & SOCKHASH now support storing references to listening
sockets. Nothing keeps us from using these map types a collection of
sockets to select from in BPF reuseport programs. Whitelist the map types
with the bpf_sk_select_reuseport helper.
The restriction that the socket has to be a member of a reuseport group
still applies. Sockets in SOCKMAP/SOCKHASH that don't have sk_reuseport_cb
set are not a valid target and we signal it with -EINVAL.
The main benefit from this change is that, in contrast to
REUSEPORT_SOCKARRAY, SOCK{MAP,HASH} don't impose a restriction that a
listening socket can be just one BPF map at the same time.
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200218171023.844439-9-jakub@cloudflare.com1 parent 1d59f3b commit 9fed900
2 files changed
Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3693 | 3693 | | |
3694 | 3694 | | |
3695 | 3695 | | |
3696 | | - | |
| 3696 | + | |
| 3697 | + | |
3697 | 3698 | | |
3698 | 3699 | | |
3699 | 3700 | | |
3700 | 3701 | | |
3701 | 3702 | | |
3702 | 3703 | | |
3703 | | - | |
| 3704 | + | |
| 3705 | + | |
3704 | 3706 | | |
3705 | 3707 | | |
3706 | 3708 | | |
| |||
3774 | 3776 | | |
3775 | 3777 | | |
3776 | 3778 | | |
3777 | | - | |
| 3779 | + | |
| 3780 | + | |
| 3781 | + | |
3778 | 3782 | | |
3779 | 3783 | | |
3780 | 3784 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8620 | 8620 | | |
8621 | 8621 | | |
8622 | 8622 | | |
| 8623 | + | |
8623 | 8624 | | |
8624 | 8625 | | |
8625 | 8626 | | |
| |||
8628 | 8629 | | |
8629 | 8630 | | |
8630 | 8631 | | |
8631 | | - | |
8632 | | - | |
8633 | | - | |
8634 | | - | |
| 8632 | + | |
| 8633 | + | |
| 8634 | + | |
| 8635 | + | |
| 8636 | + | |
| 8637 | + | |
| 8638 | + | |
8635 | 8639 | | |
8636 | | - | |
| 8640 | + | |
| 8641 | + | |
8637 | 8642 | | |
8638 | 8643 | | |
8639 | 8644 | | |
| |||
0 commit comments