xref: /f-stack/tools/ipfw/ipfw2.h (revision d4a07e70)
122ce4affSfengbojiang /*-
2127dd473Swhl739  * Copyright (c) 2002-2003 Luigi Rizzo
3127dd473Swhl739  * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp
4127dd473Swhl739  * Copyright (c) 1994 Ugen J.S.Antsilevich
5127dd473Swhl739  *
6127dd473Swhl739  * Idea and grammar partially left from:
7127dd473Swhl739  * Copyright (c) 1993 Daniel Boulet
8127dd473Swhl739  *
9127dd473Swhl739  * Redistribution and use in source forms, with and without modification,
10127dd473Swhl739  * are permitted provided that this entire comment appears intact.
11127dd473Swhl739  *
12127dd473Swhl739  * Redistribution in binary form may occur without any restrictions.
13127dd473Swhl739  * Obviously, it would be nice if you gave credit where credit is due
14127dd473Swhl739  * but requiring it would be too onerous.
15127dd473Swhl739  *
16127dd473Swhl739  * This software is provided ``AS IS'' without any warranties of any kind.
17127dd473Swhl739  *
18127dd473Swhl739  * NEW command line interface for IP firewall facility
19127dd473Swhl739  *
20127dd473Swhl739  * $FreeBSD$
21127dd473Swhl739  */
22127dd473Swhl739 
23127dd473Swhl739 /*
24127dd473Swhl739  * Options that can be set on the command line.
25127dd473Swhl739  * When reading commands from a file, a subset of the options can also
26127dd473Swhl739  * be applied globally by specifying them before the file name.
27127dd473Swhl739  * After that, each line can contain its own option that changes
28127dd473Swhl739  * the global value.
29127dd473Swhl739  * XXX The context is not restored after each line.
30127dd473Swhl739  */
31127dd473Swhl739 
32127dd473Swhl739 struct cmdline_opts {
33127dd473Swhl739 	/* boolean options: */
34127dd473Swhl739 	int	do_value_as_ip;	/* show table value as IP */
35127dd473Swhl739 	int	do_resolv;	/* try to resolve all ip to names */
36127dd473Swhl739 	int	do_time;	/* Show time stamps */
37127dd473Swhl739 	int	do_quiet;	/* Be quiet in add and flush */
38127dd473Swhl739 	int	do_pipe;	/* this cmd refers to a pipe/queue/sched */
39127dd473Swhl739 	int	do_nat; 	/* this cmd refers to a nat config */
40127dd473Swhl739 	int	do_compact;	/* show rules in compact mode */
41127dd473Swhl739 	int	do_force;	/* do not ask for confirmation */
42127dd473Swhl739 	int	show_sets;	/* display the set each rule belongs to */
43127dd473Swhl739 	int	test_only;	/* only check syntax */
44127dd473Swhl739 	int	comment_only;	/* only print action and comment */
45127dd473Swhl739 	int	verbose;	/* be verbose on some commands */
46127dd473Swhl739 
47127dd473Swhl739 	/* The options below can have multiple values. */
48127dd473Swhl739 
4922ce4affSfengbojiang 	int	do_dynamic;	/* 1 - display dynamic rules */
5022ce4affSfengbojiang 				/* 2 - display/delete only dynamic rules */
51127dd473Swhl739 	int	do_sort;	/* field to sort results (0 = no) */
52127dd473Swhl739 		/* valid fields are 1 and above */
53127dd473Swhl739 
5422ce4affSfengbojiang 	uint32_t use_set;	/* work with specified set number */
55127dd473Swhl739 		/* 0 means all sets, otherwise apply to set use_set - 1 */
56127dd473Swhl739 
57127dd473Swhl739 };
58127dd473Swhl739 
5922ce4affSfengbojiang enum {
6022ce4affSfengbojiang 	TIMESTAMP_NONE = 0,
6122ce4affSfengbojiang 	TIMESTAMP_STRING,
6222ce4affSfengbojiang 	TIMESTAMP_NUMERIC,
6322ce4affSfengbojiang };
6422ce4affSfengbojiang 
6522ce4affSfengbojiang extern struct cmdline_opts g_co;
66127dd473Swhl739 
67127dd473Swhl739 /*
68127dd473Swhl739  * _s_x is a structure that stores a string <-> token pairs, used in
69127dd473Swhl739  * various places in the parser. Entries are stored in arrays,
70127dd473Swhl739  * with an entry with s=NULL as terminator.
71127dd473Swhl739  * The search routines are match_token() and match_value().
72127dd473Swhl739  * Often, an element with x=0 contains an error string.
73127dd473Swhl739  *
74127dd473Swhl739  */
75127dd473Swhl739 struct _s_x {
76127dd473Swhl739 	char const *s;
77127dd473Swhl739 	int x;
78127dd473Swhl739 };
79127dd473Swhl739 
80127dd473Swhl739 extern struct _s_x f_ipdscp[];
81127dd473Swhl739 
82127dd473Swhl739 enum tokens {
83127dd473Swhl739 	TOK_NULL=0,
84127dd473Swhl739 
85127dd473Swhl739 	TOK_OR,
86127dd473Swhl739 	TOK_NOT,
87127dd473Swhl739 	TOK_STARTBRACE,
88127dd473Swhl739 	TOK_ENDBRACE,
89127dd473Swhl739 
9022ce4affSfengbojiang 	TOK_ABORT6,
9122ce4affSfengbojiang 	TOK_ABORT,
92127dd473Swhl739 	TOK_ACCEPT,
93127dd473Swhl739 	TOK_COUNT,
94127dd473Swhl739 	TOK_EACTION,
95127dd473Swhl739 	TOK_PIPE,
96127dd473Swhl739 	TOK_LINK,
97127dd473Swhl739 	TOK_QUEUE,
98127dd473Swhl739 	TOK_FLOWSET,
99127dd473Swhl739 	TOK_SCHED,
100127dd473Swhl739 	TOK_DIVERT,
101127dd473Swhl739 	TOK_TEE,
102127dd473Swhl739 	TOK_NETGRAPH,
103127dd473Swhl739 	TOK_NGTEE,
104127dd473Swhl739 	TOK_FORWARD,
105127dd473Swhl739 	TOK_SKIPTO,
106127dd473Swhl739 	TOK_DENY,
107127dd473Swhl739 	TOK_REJECT,
108127dd473Swhl739 	TOK_RESET,
109127dd473Swhl739 	TOK_UNREACH,
110127dd473Swhl739 	TOK_CHECKSTATE,
111127dd473Swhl739 	TOK_NAT,
112127dd473Swhl739 	TOK_REASS,
113127dd473Swhl739 	TOK_CALL,
114127dd473Swhl739 	TOK_RETURN,
115127dd473Swhl739 
116127dd473Swhl739 	TOK_ALTQ,
117127dd473Swhl739 	TOK_LOG,
118127dd473Swhl739 	TOK_TAG,
119127dd473Swhl739 	TOK_UNTAG,
120127dd473Swhl739 
121127dd473Swhl739 	TOK_TAGGED,
122127dd473Swhl739 	TOK_UID,
123127dd473Swhl739 	TOK_GID,
124127dd473Swhl739 	TOK_JAIL,
125127dd473Swhl739 	TOK_IN,
126127dd473Swhl739 	TOK_LIMIT,
12722ce4affSfengbojiang 	TOK_SETLIMIT,
128127dd473Swhl739 	TOK_KEEPSTATE,
12922ce4affSfengbojiang 	TOK_RECORDSTATE,
130127dd473Swhl739 	TOK_LAYER2,
131127dd473Swhl739 	TOK_OUT,
132127dd473Swhl739 	TOK_DIVERTED,
133127dd473Swhl739 	TOK_DIVERTEDLOOPBACK,
134127dd473Swhl739 	TOK_DIVERTEDOUTPUT,
135127dd473Swhl739 	TOK_XMIT,
136127dd473Swhl739 	TOK_RECV,
137127dd473Swhl739 	TOK_VIA,
138127dd473Swhl739 	TOK_FRAG,
139127dd473Swhl739 	TOK_IPOPTS,
140127dd473Swhl739 	TOK_IPLEN,
141127dd473Swhl739 	TOK_IPID,
142127dd473Swhl739 	TOK_IPPRECEDENCE,
143127dd473Swhl739 	TOK_DSCP,
144127dd473Swhl739 	TOK_IPTOS,
145127dd473Swhl739 	TOK_IPTTL,
146127dd473Swhl739 	TOK_IPVER,
147127dd473Swhl739 	TOK_ESTAB,
148127dd473Swhl739 	TOK_SETUP,
149127dd473Swhl739 	TOK_TCPDATALEN,
150127dd473Swhl739 	TOK_TCPFLAGS,
151127dd473Swhl739 	TOK_TCPOPTS,
152127dd473Swhl739 	TOK_TCPSEQ,
153127dd473Swhl739 	TOK_TCPACK,
15422ce4affSfengbojiang 	TOK_TCPMSS,
155127dd473Swhl739 	TOK_TCPWIN,
156127dd473Swhl739 	TOK_ICMPTYPES,
157127dd473Swhl739 	TOK_MAC,
158127dd473Swhl739 	TOK_MACTYPE,
159127dd473Swhl739 	TOK_VERREVPATH,
160127dd473Swhl739 	TOK_VERSRCREACH,
161127dd473Swhl739 	TOK_ANTISPOOF,
162127dd473Swhl739 	TOK_IPSEC,
163127dd473Swhl739 	TOK_COMMENT,
164127dd473Swhl739 
165127dd473Swhl739 	TOK_PLR,
166127dd473Swhl739 	TOK_NOERROR,
167127dd473Swhl739 	TOK_BUCKETS,
168127dd473Swhl739 	TOK_DSTIP,
169127dd473Swhl739 	TOK_SRCIP,
170127dd473Swhl739 	TOK_DSTPORT,
171127dd473Swhl739 	TOK_SRCPORT,
172127dd473Swhl739 	TOK_ALL,
173127dd473Swhl739 	TOK_MASK,
174127dd473Swhl739 	TOK_FLOW_MASK,
175127dd473Swhl739 	TOK_SCHED_MASK,
176127dd473Swhl739 	TOK_BW,
177127dd473Swhl739 	TOK_DELAY,
178127dd473Swhl739 	TOK_PROFILE,
179127dd473Swhl739 	TOK_BURST,
180127dd473Swhl739 	TOK_RED,
181127dd473Swhl739 	TOK_GRED,
182127dd473Swhl739 	TOK_ECN,
183127dd473Swhl739 	TOK_DROPTAIL,
184127dd473Swhl739 	TOK_PROTO,
185127dd473Swhl739 #ifdef NEW_AQM
186127dd473Swhl739 	/* AQM tokens*/
187127dd473Swhl739 	TOK_NO_ECN,
188127dd473Swhl739 	TOK_CODEL,
189127dd473Swhl739 	TOK_FQ_CODEL,
190127dd473Swhl739 	TOK_TARGET,
191127dd473Swhl739 	TOK_INTERVAL,
192127dd473Swhl739 	TOK_FLOWS,
193127dd473Swhl739 	TOK_QUANTUM,
194127dd473Swhl739 
195127dd473Swhl739 	TOK_PIE,
196127dd473Swhl739 	TOK_FQ_PIE,
197127dd473Swhl739 	TOK_TUPDATE,
198127dd473Swhl739 	TOK_MAX_BURST,
199127dd473Swhl739 	TOK_MAX_ECNTH,
200127dd473Swhl739 	TOK_ALPHA,
201127dd473Swhl739 	TOK_BETA,
202127dd473Swhl739 	TOK_CAPDROP,
203127dd473Swhl739 	TOK_NO_CAPDROP,
204127dd473Swhl739 	TOK_ONOFF,
205127dd473Swhl739 	TOK_DRE,
206127dd473Swhl739 	TOK_TS,
207127dd473Swhl739 	TOK_DERAND,
208127dd473Swhl739 	TOK_NO_DERAND,
209127dd473Swhl739 #endif
210127dd473Swhl739 	/* dummynet tokens */
211127dd473Swhl739 	TOK_WEIGHT,
212127dd473Swhl739 	TOK_LMAX,
213127dd473Swhl739 	TOK_PRI,
214127dd473Swhl739 	TOK_TYPE,
215127dd473Swhl739 	TOK_SLOTSIZE,
216127dd473Swhl739 
217127dd473Swhl739 	TOK_IP,
218127dd473Swhl739 	TOK_IF,
219127dd473Swhl739 	TOK_ALOG,
220127dd473Swhl739 	TOK_DENY_INC,
221127dd473Swhl739 	TOK_SAME_PORTS,
222127dd473Swhl739 	TOK_UNREG_ONLY,
22322ce4affSfengbojiang 	TOK_UNREG_CGN,
224127dd473Swhl739 	TOK_SKIP_GLOBAL,
225127dd473Swhl739 	TOK_RESET_ADDR,
226127dd473Swhl739 	TOK_ALIAS_REV,
227127dd473Swhl739 	TOK_PROXY_ONLY,
228127dd473Swhl739 	TOK_REDIR_ADDR,
229127dd473Swhl739 	TOK_REDIR_PORT,
230127dd473Swhl739 	TOK_REDIR_PROTO,
231127dd473Swhl739 
232127dd473Swhl739 	TOK_IPV6,
233127dd473Swhl739 	TOK_FLOWID,
234127dd473Swhl739 	TOK_ICMP6TYPES,
235127dd473Swhl739 	TOK_EXT6HDR,
236127dd473Swhl739 	TOK_DSTIP6,
237127dd473Swhl739 	TOK_SRCIP6,
238127dd473Swhl739 
239127dd473Swhl739 	TOK_IPV4,
240127dd473Swhl739 	TOK_UNREACH6,
241127dd473Swhl739 	TOK_RESET6,
242127dd473Swhl739 
243127dd473Swhl739 	TOK_FIB,
244127dd473Swhl739 	TOK_SETFIB,
245127dd473Swhl739 	TOK_LOOKUP,
246127dd473Swhl739 	TOK_SOCKARG,
247127dd473Swhl739 	TOK_SETDSCP,
248127dd473Swhl739 	TOK_FLOW,
249127dd473Swhl739 	TOK_IFLIST,
250127dd473Swhl739 	/* Table tokens */
251127dd473Swhl739 	TOK_CREATE,
252127dd473Swhl739 	TOK_DESTROY,
253127dd473Swhl739 	TOK_LIST,
254127dd473Swhl739 	TOK_INFO,
255127dd473Swhl739 	TOK_DETAIL,
256127dd473Swhl739 	TOK_MODIFY,
257127dd473Swhl739 	TOK_FLUSH,
258127dd473Swhl739 	TOK_SWAP,
259127dd473Swhl739 	TOK_ADD,
260127dd473Swhl739 	TOK_DEL,
261127dd473Swhl739 	TOK_VALTYPE,
262127dd473Swhl739 	TOK_ALGO,
263127dd473Swhl739 	TOK_TALIST,
264127dd473Swhl739 	TOK_ATOMIC,
265127dd473Swhl739 	TOK_LOCK,
266127dd473Swhl739 	TOK_UNLOCK,
267127dd473Swhl739 	TOK_VLIST,
268127dd473Swhl739 	TOK_OLIST,
26922ce4affSfengbojiang 	TOK_MISSING,
27022ce4affSfengbojiang 	TOK_ORFLUSH,
27122ce4affSfengbojiang 
27222ce4affSfengbojiang 	/* NAT64 tokens */
27322ce4affSfengbojiang 	TOK_NAT64STL,
27422ce4affSfengbojiang 	TOK_NAT64LSN,
27522ce4affSfengbojiang 	TOK_STATS,
27622ce4affSfengbojiang 	TOK_STATES,
27722ce4affSfengbojiang 	TOK_CONFIG,
27822ce4affSfengbojiang 	TOK_TABLE4,
27922ce4affSfengbojiang 	TOK_TABLE6,
28022ce4affSfengbojiang 	TOK_PREFIX4,
28122ce4affSfengbojiang 	TOK_PREFIX6,
28222ce4affSfengbojiang 	TOK_AGG_LEN,
28322ce4affSfengbojiang 	TOK_AGG_COUNT,
28422ce4affSfengbojiang 	TOK_MAX_PORTS,
28522ce4affSfengbojiang 	TOK_STATES_CHUNKS,
28622ce4affSfengbojiang 	TOK_JMAXLEN,
28722ce4affSfengbojiang 	TOK_PORT_RANGE,
28822ce4affSfengbojiang 	TOK_HOST_DEL_AGE,
28922ce4affSfengbojiang 	TOK_PG_DEL_AGE,
29022ce4affSfengbojiang 	TOK_TCP_SYN_AGE,
29122ce4affSfengbojiang 	TOK_TCP_CLOSE_AGE,
29222ce4affSfengbojiang 	TOK_TCP_EST_AGE,
29322ce4affSfengbojiang 	TOK_UDP_AGE,
29422ce4affSfengbojiang 	TOK_ICMP_AGE,
29522ce4affSfengbojiang 	TOK_LOGOFF,
29622ce4affSfengbojiang 	TOK_PRIVATE,
29722ce4affSfengbojiang 	TOK_PRIVATEOFF,
29822ce4affSfengbojiang 
29922ce4affSfengbojiang 	/* NAT64 CLAT tokens */
30022ce4affSfengbojiang 	TOK_NAT64CLAT,
30122ce4affSfengbojiang 	TOK_PLAT_PREFIX,
30222ce4affSfengbojiang 	TOK_CLAT_PREFIX,
30322ce4affSfengbojiang 
30422ce4affSfengbojiang 	/* NPTv6 tokens */
30522ce4affSfengbojiang 	TOK_NPTV6,
30622ce4affSfengbojiang 	TOK_INTPREFIX,
30722ce4affSfengbojiang 	TOK_EXTPREFIX,
30822ce4affSfengbojiang 	TOK_PREFIXLEN,
30922ce4affSfengbojiang 	TOK_EXTIF,
31022ce4affSfengbojiang 
31122ce4affSfengbojiang 	TOK_TCPSETMSS,
31222ce4affSfengbojiang 
31322ce4affSfengbojiang 	TOK_SKIPACTION,
314127dd473Swhl739 };
315127dd473Swhl739 
316127dd473Swhl739 /*
317127dd473Swhl739  * the following macro returns an error message if we run out of
318127dd473Swhl739  * arguments.
319127dd473Swhl739  */
320127dd473Swhl739 #define NEED(_p, msg)      {if (!_p) errx(EX_USAGE, msg);}
321127dd473Swhl739 #define NEED1(msg)      {if (!(*av)) errx(EX_USAGE, msg);}
322127dd473Swhl739 
323127dd473Swhl739 struct buf_pr {
324127dd473Swhl739 	char	*buf;	/* allocated buffer */
325127dd473Swhl739 	char	*ptr;	/* current pointer */
326127dd473Swhl739 	size_t	size;	/* total buffer size */
327127dd473Swhl739 	size_t	avail;	/* available storage */
328127dd473Swhl739 	size_t	needed;	/* length needed */
329127dd473Swhl739 };
330127dd473Swhl739 
33122ce4affSfengbojiang int pr_u64(struct buf_pr *bp, void *pd, int width);
332127dd473Swhl739 int bp_alloc(struct buf_pr *b, size_t size);
333127dd473Swhl739 void bp_free(struct buf_pr *b);
33422ce4affSfengbojiang int bprintf(struct buf_pr *b, const char *format, ...);
335127dd473Swhl739 
336127dd473Swhl739 
337127dd473Swhl739 /* memory allocation support */
338127dd473Swhl739 void *safe_calloc(size_t number, size_t size);
339127dd473Swhl739 void *safe_realloc(void *ptr, size_t size);
340127dd473Swhl739 
341127dd473Swhl739 /* string comparison functions used for historical compatibility */
342127dd473Swhl739 int _substrcmp(const char *str1, const char* str2);
343127dd473Swhl739 int _substrcmp2(const char *str1, const char* str2, const char* str3);
344127dd473Swhl739 int stringnum_cmp(const char *a, const char *b);
345127dd473Swhl739 
346127dd473Swhl739 /* utility functions */
347127dd473Swhl739 int match_token(struct _s_x *table, const char *string);
348127dd473Swhl739 int match_token_relaxed(struct _s_x *table, const char *string);
349127dd473Swhl739 int get_token(struct _s_x *table, const char *string, const char *errbase);
350127dd473Swhl739 char const *match_value(struct _s_x *p, int value);
351127dd473Swhl739 size_t concat_tokens(char *buf, size_t bufsize, struct _s_x *table,
35222ce4affSfengbojiang     const char *delimiter);
353127dd473Swhl739 int fill_flags(struct _s_x *flags, char *p, char **e, uint32_t *set,
354127dd473Swhl739     uint32_t *clear);
355127dd473Swhl739 void print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set);
356127dd473Swhl739 
357127dd473Swhl739 struct _ip_fw3_opheader;
358127dd473Swhl739 int do_cmd(int optname, void *optval, uintptr_t optlen);
35922ce4affSfengbojiang int do_set3(int optname, struct _ip_fw3_opheader *op3, size_t optlen);
360127dd473Swhl739 int do_get3(int optname, struct _ip_fw3_opheader *op3, size_t *optlen);
361127dd473Swhl739 
362127dd473Swhl739 struct in6_addr;
363127dd473Swhl739 void n2mask(struct in6_addr *mask, int n);
36422ce4affSfengbojiang int contigmask(const uint8_t *p, int len);
365127dd473Swhl739 
366127dd473Swhl739 /*
367127dd473Swhl739  * Forward declarations to avoid include way too many headers.
368127dd473Swhl739  * C does not allow duplicated typedefs, so we use the base struct
369127dd473Swhl739  * that the typedef points to.
370127dd473Swhl739  * Should the typedefs use a different type, the compiler will
371127dd473Swhl739  * still detect the change when compiling the body of the
372127dd473Swhl739  * functions involved, so we do not lose error checking.
373127dd473Swhl739  */
374127dd473Swhl739 struct _ipfw_insn;
375127dd473Swhl739 struct _ipfw_insn_altq;
376127dd473Swhl739 struct _ipfw_insn_u32;
377127dd473Swhl739 struct _ipfw_insn_ip6;
378127dd473Swhl739 struct _ipfw_insn_icmp6;
379127dd473Swhl739 
380127dd473Swhl739 /*
381127dd473Swhl739  * The reserved set numer. This is a constant in ip_fw.h
382127dd473Swhl739  * but we store it in a variable so other files do not depend
383127dd473Swhl739  * in that header just for one constant.
384127dd473Swhl739  */
385127dd473Swhl739 extern int resvd_set_number;
386127dd473Swhl739 
387127dd473Swhl739 /* first-level command handlers */
388127dd473Swhl739 void ipfw_add(char *av[]);
389127dd473Swhl739 void ipfw_show_nat(int ac, char **av);
39022ce4affSfengbojiang int ipfw_delete_nat(int i);
391127dd473Swhl739 void ipfw_config_pipe(int ac, char **av);
392127dd473Swhl739 void ipfw_config_nat(int ac, char **av);
393127dd473Swhl739 void ipfw_sets_handler(char *av[]);
394127dd473Swhl739 void ipfw_table_handler(int ac, char *av[]);
395127dd473Swhl739 void ipfw_sysctl_handler(char *av[], int which);
396127dd473Swhl739 void ipfw_delete(char *av[]);
397127dd473Swhl739 void ipfw_flush(int force);
398127dd473Swhl739 void ipfw_zero(int ac, char *av[], int optname);
399127dd473Swhl739 void ipfw_list(int ac, char *av[], int show_counters);
400127dd473Swhl739 void ipfw_internal_handler(int ac, char *av[]);
40122ce4affSfengbojiang void ipfw_nat64clat_handler(int ac, char *av[]);
40222ce4affSfengbojiang void ipfw_nat64lsn_handler(int ac, char *av[]);
40322ce4affSfengbojiang void ipfw_nat64stl_handler(int ac, char *av[]);
40422ce4affSfengbojiang void ipfw_nptv6_handler(int ac, char *av[]);
405127dd473Swhl739 int ipfw_check_object_name(const char *name);
40622ce4affSfengbojiang int ipfw_check_nat64prefix(const struct in6_addr *prefix, int length);
407127dd473Swhl739 
408127dd473Swhl739 #ifdef PF
409127dd473Swhl739 /* altq.c */
410127dd473Swhl739 void altq_set_enabled(int enabled);
411127dd473Swhl739 u_int32_t altq_name_to_qid(const char *name);
41222ce4affSfengbojiang void print_altq_cmd(struct buf_pr *bp, const struct _ipfw_insn_altq *altqptr);
413127dd473Swhl739 #else
414127dd473Swhl739 #define NO_ALTQ
415127dd473Swhl739 #endif
416127dd473Swhl739 
417127dd473Swhl739 /* dummynet.c */
418127dd473Swhl739 void dummynet_list(int ac, char *av[], int show_counters);
419127dd473Swhl739 void dummynet_flush(void);
420127dd473Swhl739 int ipfw_delete_pipe(int pipe_or_queue, int n);
421127dd473Swhl739 
422127dd473Swhl739 /* ipv6.c */
423127dd473Swhl739 void print_unreach6_code(struct buf_pr *bp, uint16_t code);
42422ce4affSfengbojiang void print_ip6(struct buf_pr *bp, const struct _ipfw_insn_ip6 *cmd);
42522ce4affSfengbojiang void print_flow6id(struct buf_pr *bp, const struct _ipfw_insn_u32 *cmd);
42622ce4affSfengbojiang void print_icmp6types(struct buf_pr *bp, const struct _ipfw_insn_u32 *cmd);
42722ce4affSfengbojiang void print_ext6hdr(struct buf_pr *bp, const struct _ipfw_insn *cmd);
428127dd473Swhl739 
42922ce4affSfengbojiang struct tidx;
43022ce4affSfengbojiang struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen,
43122ce4affSfengbojiang     struct tidx *tstate);
43222ce4affSfengbojiang struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen,
43322ce4affSfengbojiang     struct tidx *tstate);
434127dd473Swhl739 
435127dd473Swhl739 void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av, int cblen);
436127dd473Swhl739 void fill_unreach6_code(u_short *codep, char *str);
437127dd473Swhl739 void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen);
438127dd473Swhl739 int fill_ext6hdr(struct _ipfw_insn *cmd, char *av);
439127dd473Swhl739 
440127dd473Swhl739 /* ipfw2.c */
441127dd473Swhl739 void bp_flush(struct buf_pr *b);
44222ce4affSfengbojiang void fill_table(struct _ipfw_insn *cmd, char *av, uint8_t opcode,
44322ce4affSfengbojiang     struct tidx *tstate);
444127dd473Swhl739 
445127dd473Swhl739 /* tables.c */
446127dd473Swhl739 struct _ipfw_obj_ctlv;
44722ce4affSfengbojiang struct _ipfw_obj_ntlv;
448127dd473Swhl739 int table_check_name(const char *tablename);
449127dd473Swhl739 void ipfw_list_ta(int ac, char *av[]);
450127dd473Swhl739 void ipfw_list_values(int ac, char *av[]);
45122ce4affSfengbojiang void table_fill_ntlv(struct _ipfw_obj_ntlv *ntlv, const char *name,
45222ce4affSfengbojiang     uint8_t set, uint16_t uidx);
453127dd473Swhl739 
454*d4a07e70Sfengbojiang #ifdef FSTACK
455*d4a07e70Sfengbojiang     int ff_socket(int domain, int type, int protocol);
456*d4a07e70Sfengbojiang     int ff_getsockopt(int sockfd, int level, int optname,
457*d4a07e70Sfengbojiang         void *optval, socklen_t *optlen);
458*d4a07e70Sfengbojiang     int ff_setsockopt(int sockfd, int level, int optname,
459*d4a07e70Sfengbojiang         const void *optval, socklen_t optlen);
460*d4a07e70Sfengbojiang 
461*d4a07e70Sfengbojiang #define socket(a,b,c) ff_socket(a,b,c)
462*d4a07e70Sfengbojiang #define setsockopt(a,b,c,d,e) ff_setsockopt(a,b,c,d,e)
463*d4a07e70Sfengbojiang #define getsockopt(a,b,c,d,e) ff_getsockopt(a,b,c,d,e)
464*d4a07e70Sfengbojiang #endif
465*d4a07e70Sfengbojiang 
466