FreeBSD/Linux Kernel Cross Reference
sys/netinet/ip_fw.h
1 /*-
2 * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 * $FreeBSD: releng/9.1/sys/netinet/ip_fw.h 234597 2012-04-23 07:15:15Z melifaro $
26 */
27
28 #ifndef _IPFW2_H
29 #define _IPFW2_H
30
31 /*
32 * The default rule number. By the design of ip_fw, the default rule
33 * is the last one, so its number can also serve as the highest number
34 * allowed for a rule. The ip_fw code relies on both meanings of this
35 * constant.
36 */
37 #define IPFW_DEFAULT_RULE 65535
38
39 /*
40 * Default number of ipfw tables.
41 */
42 #define IPFW_TABLES_MAX 65535
43 #define IPFW_TABLES_DEFAULT 128
44
45 /*
46 * Most commands (queue, pipe, tag, untag, limit...) can have a 16-bit
47 * argument between 1 and 65534. The value 0 is unused, the value
48 * 65535 (IP_FW_TABLEARG) is used to represent 'tablearg', i.e. the
49 * can be 1..65534, or 65535 to indicate the use of a 'tablearg'
50 * result of the most recent table() lookup.
51 * Note that 16bit is only a historical limit, resulting from
52 * the use of a 16-bit fields for that value. In reality, we can have
53 * 2^32 pipes, queues, tag values and so on, and use 0 as a tablearg.
54 */
55 #define IPFW_ARG_MIN 1
56 #define IPFW_ARG_MAX 65534
57 #define IP_FW_TABLEARG 65535 /* XXX should use 0 */
58
59 /*
60 * Number of entries in the call stack of the call/return commands.
61 * Call stack currently is an uint16_t array with rule numbers.
62 */
63 #define IPFW_CALLSTACK_SIZE 16
64
65 /* IP_FW3 header/opcodes */
66 typedef struct _ip_fw3_opheader {
67 uint16_t opcode; /* Operation opcode */
68 uint16_t reserved[3]; /* Align to 64-bit boundary */
69 } ip_fw3_opheader;
70
71
72 /* IPFW extented tables support */
73 #define IP_FW_TABLE_XADD 86 /* add entry */
74 #define IP_FW_TABLE_XDEL 87 /* delete entry */
75 #define IP_FW_TABLE_XGETSIZE 88 /* get table size */
76 #define IP_FW_TABLE_XLIST 89 /* list table contents */
77
78 /*
79 * The kernel representation of ipfw rules is made of a list of
80 * 'instructions' (for all practical purposes equivalent to BPF
81 * instructions), which specify which fields of the packet
82 * (or its metadata) should be analysed.
83 *
84 * Each instruction is stored in a structure which begins with
85 * "ipfw_insn", and can contain extra fields depending on the
86 * instruction type (listed below).
87 * Note that the code is written so that individual instructions
88 * have a size which is a multiple of 32 bits. This means that, if
89 * such structures contain pointers or other 64-bit entities,
90 * (there is just one instance now) they may end up unaligned on
91 * 64-bit architectures, so the must be handled with care.
92 *
93 * "enum ipfw_opcodes" are the opcodes supported. We can have up
94 * to 256 different opcodes. When adding new opcodes, they should
95 * be appended to the end of the opcode list before O_LAST_OPCODE,
96 * this will prevent the ABI from being broken, otherwise users
97 * will have to recompile ipfw(8) when they update the kernel.
98 */
99
100 enum ipfw_opcodes { /* arguments (4 byte each) */
101 O_NOP,
102
103 O_IP_SRC, /* u32 = IP */
104 O_IP_SRC_MASK, /* ip = IP/mask */
105 O_IP_SRC_ME, /* none */
106 O_IP_SRC_SET, /* u32=base, arg1=len, bitmap */
107
108 O_IP_DST, /* u32 = IP */
109 O_IP_DST_MASK, /* ip = IP/mask */
110 O_IP_DST_ME, /* none */
111 O_IP_DST_SET, /* u32=base, arg1=len, bitmap */
112
113 O_IP_SRCPORT, /* (n)port list:mask 4 byte ea */
114 O_IP_DSTPORT, /* (n)port list:mask 4 byte ea */
115 O_PROTO, /* arg1=protocol */
116
117 O_MACADDR2, /* 2 mac addr:mask */
118 O_MAC_TYPE, /* same as srcport */
119
120 O_LAYER2, /* none */
121 O_IN, /* none */
122 O_FRAG, /* none */
123
124 O_RECV, /* none */
125 O_XMIT, /* none */
126 O_VIA, /* none */
127
128 O_IPOPT, /* arg1 = 2*u8 bitmap */
129 O_IPLEN, /* arg1 = len */
130 O_IPID, /* arg1 = id */
131
132 O_IPTOS, /* arg1 = id */
133 O_IPPRECEDENCE, /* arg1 = precedence << 5 */
134 O_IPTTL, /* arg1 = TTL */
135
136 O_IPVER, /* arg1 = version */
137 O_UID, /* u32 = id */
138 O_GID, /* u32 = id */
139 O_ESTAB, /* none (tcp established) */
140 O_TCPFLAGS, /* arg1 = 2*u8 bitmap */
141 O_TCPWIN, /* arg1 = desired win */
142 O_TCPSEQ, /* u32 = desired seq. */
143 O_TCPACK, /* u32 = desired seq. */
144 O_ICMPTYPE, /* u32 = icmp bitmap */
145 O_TCPOPTS, /* arg1 = 2*u8 bitmap */
146
147 O_VERREVPATH, /* none */
148 O_VERSRCREACH, /* none */
149
150 O_PROBE_STATE, /* none */
151 O_KEEP_STATE, /* none */
152 O_LIMIT, /* ipfw_insn_limit */
153 O_LIMIT_PARENT, /* dyn_type, not an opcode. */
154
155 /*
156 * These are really 'actions'.
157 */
158
159 O_LOG, /* ipfw_insn_log */
160 O_PROB, /* u32 = match probability */
161
162 O_CHECK_STATE, /* none */
163 O_ACCEPT, /* none */
164 O_DENY, /* none */
165 O_REJECT, /* arg1=icmp arg (same as deny) */
166 O_COUNT, /* none */
167 O_SKIPTO, /* arg1=next rule number */
168 O_PIPE, /* arg1=pipe number */
169 O_QUEUE, /* arg1=queue number */
170 O_DIVERT, /* arg1=port number */
171 O_TEE, /* arg1=port number */
172 O_FORWARD_IP, /* fwd sockaddr */
173 O_FORWARD_MAC, /* fwd mac */
174 O_NAT, /* nope */
175 O_REASS, /* none */
176
177 /*
178 * More opcodes.
179 */
180 O_IPSEC, /* has ipsec history */
181 O_IP_SRC_LOOKUP, /* arg1=table number, u32=value */
182 O_IP_DST_LOOKUP, /* arg1=table number, u32=value */
183 O_ANTISPOOF, /* none */
184 O_JAIL, /* u32 = id */
185 O_ALTQ, /* u32 = altq classif. qid */
186 O_DIVERTED, /* arg1=bitmap (1:loop, 2:out) */
187 O_TCPDATALEN, /* arg1 = tcp data len */
188 O_IP6_SRC, /* address without mask */
189 O_IP6_SRC_ME, /* my addresses */
190 O_IP6_SRC_MASK, /* address with the mask */
191 O_IP6_DST,
192 O_IP6_DST_ME,
193 O_IP6_DST_MASK,
194 O_FLOW6ID, /* for flow id tag in the ipv6 pkt */
195 O_ICMP6TYPE, /* icmp6 packet type filtering */
196 O_EXT_HDR, /* filtering for ipv6 extension header */
197 O_IP6,
198
199 /*
200 * actions for ng_ipfw
201 */
202 O_NETGRAPH, /* send to ng_ipfw */
203 O_NGTEE, /* copy to ng_ipfw */
204
205 O_IP4,
206
207 O_UNREACH6, /* arg1=icmpv6 code arg (deny) */
208
209 O_TAG, /* arg1=tag number */
210 O_TAGGED, /* arg1=tag number */
211
212 O_SETFIB, /* arg1=FIB number */
213 O_FIB, /* arg1=FIB desired fib number */
214
215 O_SOCKARG, /* socket argument */
216
217 O_CALLRETURN, /* arg1=called rule number */
218
219 O_FORWARD_IP6, /* fwd sockaddr_in6 */
220
221 O_LAST_OPCODE /* not an opcode! */
222 };
223
224
225 /*
226 * The extension header are filtered only for presence using a bit
227 * vector with a flag for each header.
228 */
229 #define EXT_FRAGMENT 0x1
230 #define EXT_HOPOPTS 0x2
231 #define EXT_ROUTING 0x4
232 #define EXT_AH 0x8
233 #define EXT_ESP 0x10
234 #define EXT_DSTOPTS 0x20
235 #define EXT_RTHDR0 0x40
236 #define EXT_RTHDR2 0x80
237
238 /*
239 * Template for instructions.
240 *
241 * ipfw_insn is used for all instructions which require no operands,
242 * a single 16-bit value (arg1), or a couple of 8-bit values.
243 *
244 * For other instructions which require different/larger arguments
245 * we have derived structures, ipfw_insn_*.
246 *
247 * The size of the instruction (in 32-bit words) is in the low
248 * 6 bits of "len". The 2 remaining bits are used to implement
249 * NOT and OR on individual instructions. Given a type, you can
250 * compute the length to be put in "len" using F_INSN_SIZE(t)
251 *
252 * F_NOT negates the match result of the instruction.
253 *
254 * F_OR is used to build or blocks. By default, instructions
255 * are evaluated as part of a logical AND. An "or" block
256 * { X or Y or Z } contains F_OR set in all but the last
257 * instruction of the block. A match will cause the code
258 * to skip past the last instruction of the block.
259 *
260 * NOTA BENE: in a couple of places we assume that
261 * sizeof(ipfw_insn) == sizeof(u_int32_t)
262 * this needs to be fixed.
263 *
264 */
265 typedef struct _ipfw_insn { /* template for instructions */
266 u_int8_t opcode;
267 u_int8_t len; /* number of 32-bit words */
268 #define F_NOT 0x80
269 #define F_OR 0x40
270 #define F_LEN_MASK 0x3f
271 #define F_LEN(cmd) ((cmd)->len & F_LEN_MASK)
272
273 u_int16_t arg1;
274 } ipfw_insn;
275
276 /*
277 * The F_INSN_SIZE(type) computes the size, in 4-byte words, of
278 * a given type.
279 */
280 #define F_INSN_SIZE(t) ((sizeof (t))/sizeof(u_int32_t))
281
282 /*
283 * This is used to store an array of 16-bit entries (ports etc.)
284 */
285 typedef struct _ipfw_insn_u16 {
286 ipfw_insn o;
287 u_int16_t ports[2]; /* there may be more */
288 } ipfw_insn_u16;
289
290 /*
291 * This is used to store an array of 32-bit entries
292 * (uid, single IPv4 addresses etc.)
293 */
294 typedef struct _ipfw_insn_u32 {
295 ipfw_insn o;
296 u_int32_t d[1]; /* one or more */
297 } ipfw_insn_u32;
298
299 /*
300 * This is used to store IP addr-mask pairs.
301 */
302 typedef struct _ipfw_insn_ip {
303 ipfw_insn o;
304 struct in_addr addr;
305 struct in_addr mask;
306 } ipfw_insn_ip;
307
308 /*
309 * This is used to forward to a given address (ip).
310 */
311 typedef struct _ipfw_insn_sa {
312 ipfw_insn o;
313 struct sockaddr_in sa;
314 } ipfw_insn_sa;
315
316 /*
317 * This is used to forward to a given address (ipv6).
318 */
319 typedef struct _ipfw_insn_sa6 {
320 ipfw_insn o;
321 struct sockaddr_in6 sa;
322 } ipfw_insn_sa6;
323
324 /*
325 * This is used for MAC addr-mask pairs.
326 */
327 typedef struct _ipfw_insn_mac {
328 ipfw_insn o;
329 u_char addr[12]; /* dst[6] + src[6] */
330 u_char mask[12]; /* dst[6] + src[6] */
331 } ipfw_insn_mac;
332
333 /*
334 * This is used for interface match rules (recv xx, xmit xx).
335 */
336 typedef struct _ipfw_insn_if {
337 ipfw_insn o;
338 union {
339 struct in_addr ip;
340 int glob;
341 } p;
342 char name[IFNAMSIZ];
343 } ipfw_insn_if;
344
345 /*
346 * This is used for storing an altq queue id number.
347 */
348 typedef struct _ipfw_insn_altq {
349 ipfw_insn o;
350 u_int32_t qid;
351 } ipfw_insn_altq;
352
353 /*
354 * This is used for limit rules.
355 */
356 typedef struct _ipfw_insn_limit {
357 ipfw_insn o;
358 u_int8_t _pad;
359 u_int8_t limit_mask; /* combination of DYN_* below */
360 #define DYN_SRC_ADDR 0x1
361 #define DYN_SRC_PORT 0x2
362 #define DYN_DST_ADDR 0x4
363 #define DYN_DST_PORT 0x8
364
365 u_int16_t conn_limit;
366 } ipfw_insn_limit;
367
368 /*
369 * This is used for log instructions.
370 */
371 typedef struct _ipfw_insn_log {
372 ipfw_insn o;
373 u_int32_t max_log; /* how many do we log -- 0 = all */
374 u_int32_t log_left; /* how many left to log */
375 } ipfw_insn_log;
376
377 /*
378 * Data structures required by both ipfw(8) and ipfw(4) but not part of the
379 * management API are protected by IPFW_INTERNAL.
380 */
381 #ifdef IPFW_INTERNAL
382 /* Server pool support (LSNAT). */
383 struct cfg_spool {
384 LIST_ENTRY(cfg_spool) _next; /* chain of spool instances */
385 struct in_addr addr;
386 u_short port;
387 };
388 #endif
389
390 /* Redirect modes id. */
391 #define REDIR_ADDR 0x01
392 #define REDIR_PORT 0x02
393 #define REDIR_PROTO 0x04
394
395 #ifdef IPFW_INTERNAL
396 /* Nat redirect configuration. */
397 struct cfg_redir {
398 LIST_ENTRY(cfg_redir) _next; /* chain of redir instances */
399 u_int16_t mode; /* type of redirect mode */
400 struct in_addr laddr; /* local ip address */
401 struct in_addr paddr; /* public ip address */
402 struct in_addr raddr; /* remote ip address */
403 u_short lport; /* local port */
404 u_short pport; /* public port */
405 u_short rport; /* remote port */
406 u_short pport_cnt; /* number of public ports */
407 u_short rport_cnt; /* number of remote ports */
408 int proto; /* protocol: tcp/udp */
409 struct alias_link **alink;
410 /* num of entry in spool chain */
411 u_int16_t spool_cnt;
412 /* chain of spool instances */
413 LIST_HEAD(spool_chain, cfg_spool) spool_chain;
414 };
415 #endif
416
417 #ifdef IPFW_INTERNAL
418 /* Nat configuration data struct. */
419 struct cfg_nat {
420 /* chain of nat instances */
421 LIST_ENTRY(cfg_nat) _next;
422 int id; /* nat id */
423 struct in_addr ip; /* nat ip address */
424 char if_name[IF_NAMESIZE]; /* interface name */
425 int mode; /* aliasing mode */
426 struct libalias *lib; /* libalias instance */
427 /* number of entry in spool chain */
428 int redir_cnt;
429 /* chain of redir instances */
430 LIST_HEAD(redir_chain, cfg_redir) redir_chain;
431 };
432 #endif
433
434 #define SOF_NAT sizeof(struct cfg_nat)
435 #define SOF_REDIR sizeof(struct cfg_redir)
436 #define SOF_SPOOL sizeof(struct cfg_spool)
437
438 /* Nat command. */
439 typedef struct _ipfw_insn_nat {
440 ipfw_insn o;
441 struct cfg_nat *nat;
442 } ipfw_insn_nat;
443
444 /* Apply ipv6 mask on ipv6 addr */
445 #define APPLY_MASK(addr,mask) \
446 (addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \
447 (addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \
448 (addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \
449 (addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3];
450
451 /* Structure for ipv6 */
452 typedef struct _ipfw_insn_ip6 {
453 ipfw_insn o;
454 struct in6_addr addr6;
455 struct in6_addr mask6;
456 } ipfw_insn_ip6;
457
458 /* Used to support icmp6 types */
459 typedef struct _ipfw_insn_icmp6 {
460 ipfw_insn o;
461 uint32_t d[7]; /* XXX This number si related to the netinet/icmp6.h
462 * define ICMP6_MAXTYPE
463 * as follows: n = ICMP6_MAXTYPE/32 + 1
464 * Actually is 203
465 */
466 } ipfw_insn_icmp6;
467
468 /*
469 * Here we have the structure representing an ipfw rule.
470 *
471 * It starts with a general area (with link fields and counters)
472 * followed by an array of one or more instructions, which the code
473 * accesses as an array of 32-bit values.
474 *
475 * Given a rule pointer r:
476 *
477 * r->cmd is the start of the first instruction.
478 * ACTION_PTR(r) is the start of the first action (things to do
479 * once a rule matched).
480 *
481 * When assembling instruction, remember the following:
482 *
483 * + if a rule has a "keep-state" (or "limit") option, then the
484 * first instruction (at r->cmd) MUST BE an O_PROBE_STATE
485 * + if a rule has a "log" option, then the first action
486 * (at ACTION_PTR(r)) MUST be O_LOG
487 * + if a rule has an "altq" option, it comes after "log"
488 * + if a rule has an O_TAG option, it comes after "log" and "altq"
489 *
490 * NOTE: we use a simple linked list of rules because we never need
491 * to delete a rule without scanning the list. We do not use
492 * queue(3) macros for portability and readability.
493 */
494
495 struct ip_fw {
496 struct ip_fw *x_next; /* linked list of rules */
497 struct ip_fw *next_rule; /* ptr to next [skipto] rule */
498 /* 'next_rule' is used to pass up 'set_disable' status */
499
500 uint16_t act_ofs; /* offset of action in 32-bit units */
501 uint16_t cmd_len; /* # of 32-bit words in cmd */
502 uint16_t rulenum; /* rule number */
503 uint8_t set; /* rule set (0..31) */
504 #define RESVD_SET 31 /* set for default and persistent rules */
505 uint8_t _pad; /* padding */
506 uint32_t id; /* rule id */
507
508 /* These fields are present in all rules. */
509 uint64_t pcnt; /* Packet counter */
510 uint64_t bcnt; /* Byte counter */
511 uint32_t timestamp; /* tv_sec of last match */
512
513 ipfw_insn cmd[1]; /* storage for commands */
514 };
515
516 #define ACTION_PTR(rule) \
517 (ipfw_insn *)( (u_int32_t *)((rule)->cmd) + ((rule)->act_ofs) )
518
519 #define RULESIZE(rule) (sizeof(struct ip_fw) + \
520 ((struct ip_fw *)(rule))->cmd_len * 4 - 4)
521
522 #if 1 // should be moved to in.h
523 /*
524 * This structure is used as a flow mask and a flow id for various
525 * parts of the code.
526 * addr_type is used in userland and kernel to mark the address type.
527 * fib is used in the kernel to record the fib in use.
528 * _flags is used in the kernel to store tcp flags for dynamic rules.
529 */
530 struct ipfw_flow_id {
531 uint32_t dst_ip;
532 uint32_t src_ip;
533 uint16_t dst_port;
534 uint16_t src_port;
535 uint8_t fib;
536 uint8_t proto;
537 uint8_t _flags; /* protocol-specific flags */
538 uint8_t addr_type; /* 4=ip4, 6=ip6, 1=ether ? */
539 struct in6_addr dst_ip6;
540 struct in6_addr src_ip6;
541 uint32_t flow_id6;
542 uint32_t extra; /* queue/pipe or frag_id */
543 };
544 #endif
545
546 #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6)
547
548 /*
549 * Dynamic ipfw rule.
550 */
551 typedef struct _ipfw_dyn_rule ipfw_dyn_rule;
552
553 struct _ipfw_dyn_rule {
554 ipfw_dyn_rule *next; /* linked list of rules. */
555 struct ip_fw *rule; /* pointer to rule */
556 /* 'rule' is used to pass up the rule number (from the parent) */
557
558 ipfw_dyn_rule *parent; /* pointer to parent rule */
559 u_int64_t pcnt; /* packet match counter */
560 u_int64_t bcnt; /* byte match counter */
561 struct ipfw_flow_id id; /* (masked) flow id */
562 u_int32_t expire; /* expire time */
563 u_int32_t bucket; /* which bucket in hash table */
564 u_int32_t state; /* state of this rule (typically a
565 * combination of TCP flags)
566 */
567 u_int32_t ack_fwd; /* most recent ACKs in forward */
568 u_int32_t ack_rev; /* and reverse directions (used */
569 /* to generate keepalives) */
570 u_int16_t dyn_type; /* rule type */
571 u_int16_t count; /* refcount */
572 };
573
574 /*
575 * Definitions for IP option names.
576 */
577 #define IP_FW_IPOPT_LSRR 0x01
578 #define IP_FW_IPOPT_SSRR 0x02
579 #define IP_FW_IPOPT_RR 0x04
580 #define IP_FW_IPOPT_TS 0x08
581
582 /*
583 * Definitions for TCP option names.
584 */
585 #define IP_FW_TCPOPT_MSS 0x01
586 #define IP_FW_TCPOPT_WINDOW 0x02
587 #define IP_FW_TCPOPT_SACK 0x04
588 #define IP_FW_TCPOPT_TS 0x08
589 #define IP_FW_TCPOPT_CC 0x10
590
591 #define ICMP_REJECT_RST 0x100 /* fake ICMP code (send a TCP RST) */
592 #define ICMP6_UNREACH_RST 0x100 /* fake ICMPv6 code (send a TCP RST) */
593
594 /*
595 * These are used for lookup tables.
596 */
597
598 #define IPFW_TABLE_CIDR 1 /* Table for holding IPv4/IPv6 prefixes */
599 #define IPFW_TABLE_INTERFACE 2 /* Table for holding interface names */
600 #define IPFW_TABLE_MAXTYPE 2 /* Maximum valid number */
601
602 typedef struct _ipfw_table_entry {
603 in_addr_t addr; /* network address */
604 u_int32_t value; /* value */
605 u_int16_t tbl; /* table number */
606 u_int8_t masklen; /* mask length */
607 } ipfw_table_entry;
608
609 typedef struct _ipfw_table_xentry {
610 uint16_t len; /* Total entry length */
611 uint8_t type; /* entry type */
612 uint8_t masklen; /* mask length */
613 uint16_t tbl; /* table number */
614 uint32_t value; /* value */
615 union {
616 /* Longest field needs to be aligned by 4-byte boundary */
617 struct in6_addr addr6; /* IPv6 address */
618 char iface[IF_NAMESIZE]; /* interface name */
619 } k;
620 } ipfw_table_xentry;
621
622 typedef struct _ipfw_table {
623 u_int32_t size; /* size of entries in bytes */
624 u_int32_t cnt; /* # of entries */
625 u_int16_t tbl; /* table number */
626 ipfw_table_entry ent[0]; /* entries */
627 } ipfw_table;
628
629 typedef struct _ipfw_xtable {
630 ip_fw3_opheader opheader; /* eXtended tables are controlled via IP_FW3 */
631 uint32_t size; /* size of entries in bytes */
632 uint32_t cnt; /* # of entries */
633 uint16_t tbl; /* table number */
634 uint8_t type; /* table type */
635 ipfw_table_xentry xent[0]; /* entries */
636 } ipfw_xtable;
637
638 #endif /* _IPFW2_H */
Cache object: a1f4cd6c23687b4b98780c651c9f7269
|