• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef __LINUX_IF_PACKET_H
20 #define __LINUX_IF_PACKET_H
21 #include <linux/types.h>
22 struct sockaddr_pkt {
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24   unsigned short spkt_family;
25   unsigned char spkt_device[14];
26   __be16 spkt_protocol;
27 };
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 struct sockaddr_ll {
30   unsigned short sll_family;
31   __be16 sll_protocol;
32   int sll_ifindex;
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34   unsigned short sll_hatype;
35   unsigned char sll_pkttype;
36   unsigned char sll_halen;
37   unsigned char sll_addr[8];
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 };
40 #define PACKET_HOST 0
41 #define PACKET_BROADCAST 1
42 #define PACKET_MULTICAST 2
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define PACKET_OTHERHOST 3
45 #define PACKET_OUTGOING 4
46 #define PACKET_LOOPBACK 5
47 #define PACKET_USER 6
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #define PACKET_KERNEL 7
50 #define PACKET_FASTROUTE 6
51 #define PACKET_ADD_MEMBERSHIP 1
52 #define PACKET_DROP_MEMBERSHIP 2
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define PACKET_RECV_OUTPUT 3
55 #define PACKET_RX_RING 5
56 #define PACKET_STATISTICS 6
57 #define PACKET_COPY_THRESH 7
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define PACKET_AUXDATA 8
60 #define PACKET_ORIGDEV 9
61 #define PACKET_VERSION 10
62 #define PACKET_HDRLEN 11
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 #define PACKET_RESERVE 12
65 #define PACKET_TX_RING 13
66 #define PACKET_LOSS 14
67 #define PACKET_VNET_HDR 15
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69 #define PACKET_TX_TIMESTAMP 16
70 #define PACKET_TIMESTAMP 17
71 #define PACKET_FANOUT 18
72 #define PACKET_TX_HAS_OFF 19
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 #define PACKET_QDISC_BYPASS 20
75 #define PACKET_ROLLOVER_STATS 21
76 #define PACKET_FANOUT_DATA 22
77 #define PACKET_FANOUT_HASH 0
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79 #define PACKET_FANOUT_LB 1
80 #define PACKET_FANOUT_CPU 2
81 #define PACKET_FANOUT_ROLLOVER 3
82 #define PACKET_FANOUT_RND 4
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84 #define PACKET_FANOUT_QM 5
85 #define PACKET_FANOUT_CBPF 6
86 #define PACKET_FANOUT_EBPF 7
87 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89 #define PACKET_FANOUT_FLAG_DEFRAG 0x8000
90 struct tpacket_stats {
91   unsigned int tp_packets;
92   unsigned int tp_drops;
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94 };
95 struct tpacket_stats_v3 {
96   unsigned int tp_packets;
97   unsigned int tp_drops;
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99   unsigned int tp_freeze_q_cnt;
100 };
101 struct tpacket_rollover_stats {
102   __aligned_u64 tp_all;
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104   __aligned_u64 tp_huge;
105   __aligned_u64 tp_failed;
106 };
107 union tpacket_stats_u {
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109   struct tpacket_stats stats1;
110   struct tpacket_stats_v3 stats3;
111 };
112 struct tpacket_auxdata {
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114   __u32 tp_status;
115   __u32 tp_len;
116   __u32 tp_snaplen;
117   __u16 tp_mac;
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119   __u16 tp_net;
120   __u16 tp_vlan_tci;
121   __u16 tp_vlan_tpid;
122 };
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 #define TP_STATUS_KERNEL 0
125 #define TP_STATUS_USER (1 << 0)
126 #define TP_STATUS_COPY (1 << 1)
127 #define TP_STATUS_LOSING (1 << 2)
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129 #define TP_STATUS_CSUMNOTREADY (1 << 3)
130 #define TP_STATUS_VLAN_VALID (1 << 4)
131 #define TP_STATUS_BLK_TMO (1 << 5)
132 #define TP_STATUS_VLAN_TPID_VALID (1 << 6)
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 #define TP_STATUS_CSUM_VALID (1 << 7)
135 #define TP_STATUS_AVAILABLE 0
136 #define TP_STATUS_SEND_REQUEST (1 << 0)
137 #define TP_STATUS_SENDING (1 << 1)
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139 #define TP_STATUS_WRONG_FORMAT (1 << 2)
140 #define TP_STATUS_TS_SOFTWARE (1 << 29)
141 #define TP_STATUS_TS_SYS_HARDWARE (1 << 30)
142 #define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144 #define TP_FT_REQ_FILL_RXHASH 0x1
145 struct tpacket_hdr {
146   unsigned long tp_status;
147   unsigned int tp_len;
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149   unsigned int tp_snaplen;
150   unsigned short tp_mac;
151   unsigned short tp_net;
152   unsigned int tp_sec;
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154   unsigned int tp_usec;
155 };
156 #define TPACKET_ALIGNMENT 16
157 #define TPACKET_ALIGN(x) (((x) + TPACKET_ALIGNMENT - 1) & ~(TPACKET_ALIGNMENT - 1))
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
160 struct tpacket2_hdr {
161   __u32 tp_status;
162   __u32 tp_len;
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164   __u32 tp_snaplen;
165   __u16 tp_mac;
166   __u16 tp_net;
167   __u32 tp_sec;
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169   __u32 tp_nsec;
170   __u16 tp_vlan_tci;
171   __u16 tp_vlan_tpid;
172   __u8 tp_padding[4];
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 };
175 struct tpacket_hdr_variant1 {
176   __u32 tp_rxhash;
177   __u32 tp_vlan_tci;
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179   __u16 tp_vlan_tpid;
180   __u16 tp_padding;
181 };
182 struct tpacket3_hdr {
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   __u32 tp_next_offset;
185   __u32 tp_sec;
186   __u32 tp_nsec;
187   __u32 tp_snaplen;
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189   __u32 tp_len;
190   __u32 tp_status;
191   __u16 tp_mac;
192   __u16 tp_net;
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194   union {
195     struct tpacket_hdr_variant1 hv1;
196   };
197   __u8 tp_padding[8];
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199 };
200 struct tpacket_bd_ts {
201   unsigned int ts_sec;
202   union {
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204     unsigned int ts_usec;
205     unsigned int ts_nsec;
206   };
207 };
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209 struct tpacket_hdr_v1 {
210   __u32 block_status;
211   __u32 num_pkts;
212   __u32 offset_to_first_pkt;
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214   __u32 blk_len;
215   __aligned_u64 seq_num;
216   struct tpacket_bd_ts ts_first_pkt, ts_last_pkt;
217 };
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219 union tpacket_bd_header_u {
220   struct tpacket_hdr_v1 bh1;
221 };
222 struct tpacket_block_desc {
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224   __u32 version;
225   __u32 offset_to_priv;
226   union tpacket_bd_header_u hdr;
227 };
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229 #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
230 #define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll))
231 enum tpacket_versions {
232   TPACKET_V1,
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234   TPACKET_V2,
235   TPACKET_V3
236 };
237 struct tpacket_req {
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239   unsigned int tp_block_size;
240   unsigned int tp_block_nr;
241   unsigned int tp_frame_size;
242   unsigned int tp_frame_nr;
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244 };
245 struct tpacket_req3 {
246   unsigned int tp_block_size;
247   unsigned int tp_block_nr;
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249   unsigned int tp_frame_size;
250   unsigned int tp_frame_nr;
251   unsigned int tp_retire_blk_tov;
252   unsigned int tp_sizeof_priv;
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254   unsigned int tp_feature_req_word;
255 };
256 union tpacket_req_u {
257   struct tpacket_req req;
258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259   struct tpacket_req3 req3;
260 };
261 struct packet_mreq {
262   int mr_ifindex;
263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
264   unsigned short mr_type;
265   unsigned short mr_alen;
266   unsigned char mr_address[8];
267 };
268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
269 #define PACKET_MR_MULTICAST 0
270 #define PACKET_MR_PROMISC 1
271 #define PACKET_MR_ALLMULTI 2
272 #define PACKET_MR_UNICAST 3
273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
274 #endif
275