We will call sock_reuseport.prog for socket migration in the next commit, so the eBPF program has to know which listener is closing to select a new listener. We can currently get a unique ID of each listener in the userspace by calling bpf_map_lookup_elem() for BPF_MAP_TYPE_REUSEPORT_SOCKARRAY map. This patch makes the pointer of sk available in sk_reuseport_md so that we can get the ID by BPF_FUNC_get_socket_cookie() in the eBPF program.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -5416,6 +5416,7 @@ struct sk_reuseport_md { · 5415 unmodified lines | |||
| 5416 | __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */ | 5416 | __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */ |
| 5417 | __u32 bind_inany; /* Is sock bound to an INANY address? */ | 5417 | __u32 bind_inany; /* Is sock bound to an INANY address? */ |
| 5418 | __u32 hash; /* A hash of the packet 4 tuples */ | 5418 | __u32 hash; /* A hash of the packet 4 tuples */ |
| 5419 | __bpf_md_ptr(struct bpf_sock *, sk); | ||
| 5419 | }; | 5420 | }; |
| 5420 | 5421 | ||
| 5421 | #define BPF_TAG_SIZE 8 | 5422 | #define BPF_TAG_SIZE 8 |