1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* Copyright (c) 2026 Isovalent */ 3 4 #ifndef _BPF_KSOCK_H 5 #define _BPF_KSOCK_H 6 7 #include <linux/types.h> 8 #include <linux/in.h> 9 #include <linux/in6.h> 10 11 /** 12 * struct bpf_ksock_create_opts - BPF kernel socket creation parameters 13 * @family: Address family: AF_INET or AF_INET6. 14 * @type: Socket type: only SOCK_DGRAM supported for now. 15 * @protocol: Protocol number (e.g. IPPROTO_UDP), or 0 for the default protocol 16 * of the given type. 17 * @reserved: Must be zero. Reserved for future use. 18 */ 19 struct bpf_ksock_create_opts { 20 __u8 family; 21 __u8 type; 22 __u8 protocol; 23 __u8 reserved; 24 }; 25 26 /** 27 * union bpf_ksock_addr - IPv4 or IPv6 socket address 28 * @sin: IPv4 socket address. 29 * @sin6: IPv6 socket address. 30 */ 31 union bpf_ksock_addr { 32 struct sockaddr_in sin; 33 struct sockaddr_in6 sin6; 34 }; 35 36 #endif /* _BPF_KSOCK_H */ 37