xref: /linux/tools/testing/selftests/bpf/progs/bpf_tracing_net.h (revision 4b660dbd9ee2059850fd30e0df420ca7a38a1856)
1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
2 #ifndef __BPF_TRACING_NET_H__
3 #define __BPF_TRACING_NET_H__
4 
5 #define AF_INET			2
6 #define AF_INET6		10
7 
8 #define SOL_SOCKET		1
9 #define SO_REUSEADDR		2
10 #define SO_SNDBUF		7
11 #define SO_RCVBUF		8
12 #define SO_KEEPALIVE		9
13 #define SO_PRIORITY		12
14 #define SO_REUSEPORT		15
15 #define SO_RCVLOWAT		18
16 #define SO_BINDTODEVICE		25
17 #define SO_MARK			36
18 #define SO_MAX_PACING_RATE	47
19 #define SO_BINDTOIFINDEX	62
20 #define SO_TXREHASH		74
21 #define __SO_ACCEPTCON		(1 << 16)
22 
23 #define IP_TOS			1
24 
25 #define IPV6_TCLASS		67
26 #define IPV6_AUTOFLOWLABEL	70
27 
28 #define TC_ACT_UNSPEC		(-1)
29 #define TC_ACT_OK		0
30 #define TC_ACT_SHOT		2
31 
32 #define SOL_TCP			6
33 #define TCP_NODELAY		1
34 #define TCP_MAXSEG		2
35 #define TCP_KEEPIDLE		4
36 #define TCP_KEEPINTVL		5
37 #define TCP_KEEPCNT		6
38 #define TCP_SYNCNT		7
39 #define TCP_WINDOW_CLAMP	10
40 #define TCP_CONGESTION		13
41 #define TCP_THIN_LINEAR_TIMEOUTS	16
42 #define TCP_USER_TIMEOUT	18
43 #define TCP_NOTSENT_LOWAT	25
44 #define TCP_SAVE_SYN		27
45 #define TCP_SAVED_SYN		28
46 #define TCP_CA_NAME_MAX		16
47 #define TCP_NAGLE_OFF		1
48 
49 #define ICSK_TIME_RETRANS	1
50 #define ICSK_TIME_PROBE0	3
51 #define ICSK_TIME_LOSS_PROBE	5
52 #define ICSK_TIME_REO_TIMEOUT	6
53 
54 #define ETH_ALEN		6
55 #define ETH_HLEN		14
56 #define ETH_P_IP		0x0800
57 #define ETH_P_IPV6		0x86DD
58 
59 #define NEXTHDR_TCP		6
60 
61 #define TCPOPT_NOP		1
62 #define TCPOPT_EOL		0
63 #define TCPOPT_MSS		2
64 #define TCPOPT_WINDOW		3
65 #define TCPOPT_TIMESTAMP	8
66 #define TCPOPT_SACK_PERM	4
67 
68 #define TCPOLEN_MSS		4
69 #define TCPOLEN_WINDOW		3
70 #define TCPOLEN_TIMESTAMP	10
71 #define TCPOLEN_SACK_PERM	2
72 
73 #define CHECKSUM_NONE		0
74 #define CHECKSUM_PARTIAL	3
75 
76 #define IFNAMSIZ		16
77 
78 #define RTF_GATEWAY		0x0002
79 
80 #define TCP_INFINITE_SSTHRESH	0x7fffffff
81 #define TCP_PINGPONG_THRESH	3
82 
83 #define fib_nh_dev		nh_common.nhc_dev
84 #define fib_nh_gw_family	nh_common.nhc_gw_family
85 #define fib_nh_gw6		nh_common.nhc_gw.ipv6
86 
87 #define inet_daddr		sk.__sk_common.skc_daddr
88 #define inet_rcv_saddr		sk.__sk_common.skc_rcv_saddr
89 #define inet_dport		sk.__sk_common.skc_dport
90 
91 #define udp_portaddr_hash	inet.sk.__sk_common.skc_u16hashes[1]
92 
93 #define ir_loc_addr		req.__req_common.skc_rcv_saddr
94 #define ir_num			req.__req_common.skc_num
95 #define ir_rmt_addr		req.__req_common.skc_daddr
96 #define ir_rmt_port		req.__req_common.skc_dport
97 #define ir_v6_rmt_addr		req.__req_common.skc_v6_daddr
98 #define ir_v6_loc_addr		req.__req_common.skc_v6_rcv_saddr
99 
100 #define sk_num			__sk_common.skc_num
101 #define sk_dport		__sk_common.skc_dport
102 #define sk_family		__sk_common.skc_family
103 #define sk_rmem_alloc		sk_backlog.rmem_alloc
104 #define sk_refcnt		__sk_common.skc_refcnt
105 #define sk_state		__sk_common.skc_state
106 #define sk_net			__sk_common.skc_net
107 #define sk_v6_daddr		__sk_common.skc_v6_daddr
108 #define sk_v6_rcv_saddr		__sk_common.skc_v6_rcv_saddr
109 #define sk_flags		__sk_common.skc_flags
110 #define sk_reuse		__sk_common.skc_reuse
111 #define sk_cookie		__sk_common.skc_cookie
112 
113 #define s6_addr32		in6_u.u6_addr32
114 
115 #define tw_daddr		__tw_common.skc_daddr
116 #define tw_rcv_saddr		__tw_common.skc_rcv_saddr
117 #define tw_dport		__tw_common.skc_dport
118 #define tw_refcnt		__tw_common.skc_refcnt
119 #define tw_v6_daddr		__tw_common.skc_v6_daddr
120 #define tw_v6_rcv_saddr		__tw_common.skc_v6_rcv_saddr
121 
122 #endif
123