13c0c8717SLuigi Rizzo /* 23c0c8717SLuigi Rizzo * Copyright (c) 2002-2003 Luigi Rizzo 33c0c8717SLuigi Rizzo * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp 43c0c8717SLuigi Rizzo * Copyright (c) 1994 Ugen J.S.Antsilevich 53c0c8717SLuigi Rizzo * 63c0c8717SLuigi Rizzo * Idea and grammar partially left from: 73c0c8717SLuigi Rizzo * Copyright (c) 1993 Daniel Boulet 83c0c8717SLuigi Rizzo * 93c0c8717SLuigi Rizzo * Redistribution and use in source forms, with and without modification, 103c0c8717SLuigi Rizzo * are permitted provided that this entire comment appears intact. 113c0c8717SLuigi Rizzo * 123c0c8717SLuigi Rizzo * Redistribution in binary form may occur without any restrictions. 133c0c8717SLuigi Rizzo * Obviously, it would be nice if you gave credit where credit is due 143c0c8717SLuigi Rizzo * but requiring it would be too onerous. 153c0c8717SLuigi Rizzo * 163c0c8717SLuigi Rizzo * This software is provided ``AS IS'' without any warranties of any kind. 173c0c8717SLuigi Rizzo * 183c0c8717SLuigi Rizzo * NEW command line interface for IP firewall facility 193c0c8717SLuigi Rizzo * 203c0c8717SLuigi Rizzo * $FreeBSD$ 213c0c8717SLuigi Rizzo */ 223c0c8717SLuigi Rizzo 233c0c8717SLuigi Rizzo /* 243c0c8717SLuigi Rizzo * Options that can be set on the command line. 253c0c8717SLuigi Rizzo * When reading commands from a file, a subset of the options can also 263c0c8717SLuigi Rizzo * be applied globally by specifying them before the file name. 273c0c8717SLuigi Rizzo * After that, each line can contain its own option that changes 283c0c8717SLuigi Rizzo * the global value. 293c0c8717SLuigi Rizzo * XXX The context is not restored after each line. 303c0c8717SLuigi Rizzo */ 313c0c8717SLuigi Rizzo 323c0c8717SLuigi Rizzo struct cmdline_opts { 333c0c8717SLuigi Rizzo /* boolean options: */ 343c0c8717SLuigi Rizzo int do_value_as_ip; /* show table value as IP */ 353c0c8717SLuigi Rizzo int do_resolv; /* try to resolve all ip to names */ 363c0c8717SLuigi Rizzo int do_time; /* Show time stamps */ 373c0c8717SLuigi Rizzo int do_quiet; /* Be quiet in add and flush */ 38cc4d3c30SLuigi Rizzo int do_pipe; /* this cmd refers to a pipe/queue/sched */ 393c0c8717SLuigi Rizzo int do_nat; /* this cmd refers to a nat config */ 403c0c8717SLuigi Rizzo int do_dynamic; /* display dynamic rules */ 413c0c8717SLuigi Rizzo int do_expired; /* display expired dynamic rules */ 423c0c8717SLuigi Rizzo int do_compact; /* show rules in compact mode */ 433c0c8717SLuigi Rizzo int do_force; /* do not ask for confirmation */ 443c0c8717SLuigi Rizzo int show_sets; /* display the set each rule belongs to */ 453c0c8717SLuigi Rizzo int test_only; /* only check syntax */ 463c0c8717SLuigi Rizzo int comment_only; /* only print action and comment */ 473c0c8717SLuigi Rizzo int verbose; /* be verbose on some commands */ 483c0c8717SLuigi Rizzo 493c0c8717SLuigi Rizzo /* The options below can have multiple values. */ 503c0c8717SLuigi Rizzo 513c0c8717SLuigi Rizzo int do_sort; /* field to sort results (0 = no) */ 523c0c8717SLuigi Rizzo /* valid fields are 1 and above */ 533c0c8717SLuigi Rizzo 543c0c8717SLuigi Rizzo int use_set; /* work with specified set number */ 553c0c8717SLuigi Rizzo /* 0 means all sets, otherwise apply to set use_set - 1 */ 563c0c8717SLuigi Rizzo 573c0c8717SLuigi Rizzo }; 583c0c8717SLuigi Rizzo 593c0c8717SLuigi Rizzo extern struct cmdline_opts co; 603c0c8717SLuigi Rizzo 613c0c8717SLuigi Rizzo /* 623c0c8717SLuigi Rizzo * _s_x is a structure that stores a string <-> token pairs, used in 633c0c8717SLuigi Rizzo * various places in the parser. Entries are stored in arrays, 643c0c8717SLuigi Rizzo * with an entry with s=NULL as terminator. 653c0c8717SLuigi Rizzo * The search routines are match_token() and match_value(). 663c0c8717SLuigi Rizzo * Often, an element with x=0 contains an error string. 673c0c8717SLuigi Rizzo * 683c0c8717SLuigi Rizzo */ 693c0c8717SLuigi Rizzo struct _s_x { 703c0c8717SLuigi Rizzo char const *s; 713c0c8717SLuigi Rizzo int x; 723c0c8717SLuigi Rizzo }; 733c0c8717SLuigi Rizzo 74ac35ff17SAlexander V. Chernikov extern struct _s_x f_ipdscp[]; 75ac35ff17SAlexander V. Chernikov 764e9c8ae7SLuigi Rizzo enum tokens { 774e9c8ae7SLuigi Rizzo TOK_NULL=0, 784e9c8ae7SLuigi Rizzo 794e9c8ae7SLuigi Rizzo TOK_OR, 804e9c8ae7SLuigi Rizzo TOK_NOT, 814e9c8ae7SLuigi Rizzo TOK_STARTBRACE, 824e9c8ae7SLuigi Rizzo TOK_ENDBRACE, 834e9c8ae7SLuigi Rizzo 844e9c8ae7SLuigi Rizzo TOK_ACCEPT, 854e9c8ae7SLuigi Rizzo TOK_COUNT, 862acdf79fSAndrey V. Elsukov TOK_EACTION, 874e9c8ae7SLuigi Rizzo TOK_PIPE, 88cc4d3c30SLuigi Rizzo TOK_LINK, 894e9c8ae7SLuigi Rizzo TOK_QUEUE, 90cc4d3c30SLuigi Rizzo TOK_FLOWSET, 91cc4d3c30SLuigi Rizzo TOK_SCHED, 924e9c8ae7SLuigi Rizzo TOK_DIVERT, 934e9c8ae7SLuigi Rizzo TOK_TEE, 944e9c8ae7SLuigi Rizzo TOK_NETGRAPH, 954e9c8ae7SLuigi Rizzo TOK_NGTEE, 964e9c8ae7SLuigi Rizzo TOK_FORWARD, 974e9c8ae7SLuigi Rizzo TOK_SKIPTO, 984e9c8ae7SLuigi Rizzo TOK_DENY, 994e9c8ae7SLuigi Rizzo TOK_REJECT, 1004e9c8ae7SLuigi Rizzo TOK_RESET, 1014e9c8ae7SLuigi Rizzo TOK_UNREACH, 1024e9c8ae7SLuigi Rizzo TOK_CHECKSTATE, 1034e9c8ae7SLuigi Rizzo TOK_NAT, 104eb2e4119SPaolo Pisati TOK_REASS, 1059527ec6eSAndrey V. Elsukov TOK_CALL, 1069527ec6eSAndrey V. Elsukov TOK_RETURN, 1074e9c8ae7SLuigi Rizzo 1084e9c8ae7SLuigi Rizzo TOK_ALTQ, 1094e9c8ae7SLuigi Rizzo TOK_LOG, 1104e9c8ae7SLuigi Rizzo TOK_TAG, 1114e9c8ae7SLuigi Rizzo TOK_UNTAG, 1124e9c8ae7SLuigi Rizzo 1134e9c8ae7SLuigi Rizzo TOK_TAGGED, 1144e9c8ae7SLuigi Rizzo TOK_UID, 1154e9c8ae7SLuigi Rizzo TOK_GID, 1164e9c8ae7SLuigi Rizzo TOK_JAIL, 1174e9c8ae7SLuigi Rizzo TOK_IN, 1184e9c8ae7SLuigi Rizzo TOK_LIMIT, 1194e9c8ae7SLuigi Rizzo TOK_KEEPSTATE, 1204e9c8ae7SLuigi Rizzo TOK_LAYER2, 1214e9c8ae7SLuigi Rizzo TOK_OUT, 1224e9c8ae7SLuigi Rizzo TOK_DIVERTED, 1234e9c8ae7SLuigi Rizzo TOK_DIVERTEDLOOPBACK, 1244e9c8ae7SLuigi Rizzo TOK_DIVERTEDOUTPUT, 1254e9c8ae7SLuigi Rizzo TOK_XMIT, 1264e9c8ae7SLuigi Rizzo TOK_RECV, 1274e9c8ae7SLuigi Rizzo TOK_VIA, 1284e9c8ae7SLuigi Rizzo TOK_FRAG, 1294e9c8ae7SLuigi Rizzo TOK_IPOPTS, 1304e9c8ae7SLuigi Rizzo TOK_IPLEN, 1314e9c8ae7SLuigi Rizzo TOK_IPID, 1324e9c8ae7SLuigi Rizzo TOK_IPPRECEDENCE, 13372662a75SLuigi Rizzo TOK_DSCP, 1344e9c8ae7SLuigi Rizzo TOK_IPTOS, 1354e9c8ae7SLuigi Rizzo TOK_IPTTL, 1364e9c8ae7SLuigi Rizzo TOK_IPVER, 1374e9c8ae7SLuigi Rizzo TOK_ESTAB, 1384e9c8ae7SLuigi Rizzo TOK_SETUP, 1394e9c8ae7SLuigi Rizzo TOK_TCPDATALEN, 1404e9c8ae7SLuigi Rizzo TOK_TCPFLAGS, 1414e9c8ae7SLuigi Rizzo TOK_TCPOPTS, 1424e9c8ae7SLuigi Rizzo TOK_TCPSEQ, 1434e9c8ae7SLuigi Rizzo TOK_TCPACK, 1444e9c8ae7SLuigi Rizzo TOK_TCPWIN, 1454e9c8ae7SLuigi Rizzo TOK_ICMPTYPES, 1464e9c8ae7SLuigi Rizzo TOK_MAC, 1474e9c8ae7SLuigi Rizzo TOK_MACTYPE, 1484e9c8ae7SLuigi Rizzo TOK_VERREVPATH, 1494e9c8ae7SLuigi Rizzo TOK_VERSRCREACH, 1504e9c8ae7SLuigi Rizzo TOK_ANTISPOOF, 1514e9c8ae7SLuigi Rizzo TOK_IPSEC, 1524e9c8ae7SLuigi Rizzo TOK_COMMENT, 1534e9c8ae7SLuigi Rizzo 1544e9c8ae7SLuigi Rizzo TOK_PLR, 1554e9c8ae7SLuigi Rizzo TOK_NOERROR, 1564e9c8ae7SLuigi Rizzo TOK_BUCKETS, 1574e9c8ae7SLuigi Rizzo TOK_DSTIP, 1584e9c8ae7SLuigi Rizzo TOK_SRCIP, 1594e9c8ae7SLuigi Rizzo TOK_DSTPORT, 1604e9c8ae7SLuigi Rizzo TOK_SRCPORT, 1614e9c8ae7SLuigi Rizzo TOK_ALL, 1624e9c8ae7SLuigi Rizzo TOK_MASK, 163cc4d3c30SLuigi Rizzo TOK_FLOW_MASK, 164cc4d3c30SLuigi Rizzo TOK_SCHED_MASK, 1654e9c8ae7SLuigi Rizzo TOK_BW, 1664e9c8ae7SLuigi Rizzo TOK_DELAY, 167cc4d3c30SLuigi Rizzo TOK_PROFILE, 1686882bf4dSOleg Bulyzhin TOK_BURST, 1694e9c8ae7SLuigi Rizzo TOK_RED, 1704e9c8ae7SLuigi Rizzo TOK_GRED, 171fc5e1956SHiren Panchasara TOK_ECN, 1724e9c8ae7SLuigi Rizzo TOK_DROPTAIL, 1734e9c8ae7SLuigi Rizzo TOK_PROTO, 17491336b40SDon Lewis #ifdef NEW_AQM 17591336b40SDon Lewis /* AQM tokens*/ 17691336b40SDon Lewis TOK_NO_ECN, 17791336b40SDon Lewis TOK_CODEL, 17891336b40SDon Lewis TOK_FQ_CODEL, 17991336b40SDon Lewis TOK_TARGET, 18091336b40SDon Lewis TOK_INTERVAL, 18191336b40SDon Lewis TOK_FLOWS, 18291336b40SDon Lewis TOK_QUANTUM, 18391336b40SDon Lewis 18491336b40SDon Lewis TOK_PIE, 18591336b40SDon Lewis TOK_FQ_PIE, 18691336b40SDon Lewis TOK_TUPDATE, 18791336b40SDon Lewis TOK_MAX_BURST, 18891336b40SDon Lewis TOK_MAX_ECNTH, 18991336b40SDon Lewis TOK_ALPHA, 19091336b40SDon Lewis TOK_BETA, 19191336b40SDon Lewis TOK_CAPDROP, 19291336b40SDon Lewis TOK_NO_CAPDROP, 19391336b40SDon Lewis TOK_ONOFF, 19491336b40SDon Lewis TOK_DRE, 19591336b40SDon Lewis TOK_TS, 19691336b40SDon Lewis TOK_DERAND, 19791336b40SDon Lewis TOK_NO_DERAND, 19891336b40SDon Lewis #endif 199cc4d3c30SLuigi Rizzo /* dummynet tokens */ 2004e9c8ae7SLuigi Rizzo TOK_WEIGHT, 201cc4d3c30SLuigi Rizzo TOK_LMAX, 202cc4d3c30SLuigi Rizzo TOK_PRI, 203cc4d3c30SLuigi Rizzo TOK_TYPE, 204cc4d3c30SLuigi Rizzo TOK_SLOTSIZE, 205cc4d3c30SLuigi Rizzo 2064e9c8ae7SLuigi Rizzo TOK_IP, 2074e9c8ae7SLuigi Rizzo TOK_IF, 2084e9c8ae7SLuigi Rizzo TOK_ALOG, 2094e9c8ae7SLuigi Rizzo TOK_DENY_INC, 2104e9c8ae7SLuigi Rizzo TOK_SAME_PORTS, 2114e9c8ae7SLuigi Rizzo TOK_UNREG_ONLY, 2121875bbfeSAndrey V. Elsukov TOK_SKIP_GLOBAL, 2134e9c8ae7SLuigi Rizzo TOK_RESET_ADDR, 2144e9c8ae7SLuigi Rizzo TOK_ALIAS_REV, 2154e9c8ae7SLuigi Rizzo TOK_PROXY_ONLY, 2164e9c8ae7SLuigi Rizzo TOK_REDIR_ADDR, 2174e9c8ae7SLuigi Rizzo TOK_REDIR_PORT, 2184e9c8ae7SLuigi Rizzo TOK_REDIR_PROTO, 2194e9c8ae7SLuigi Rizzo 2204e9c8ae7SLuigi Rizzo TOK_IPV6, 2214e9c8ae7SLuigi Rizzo TOK_FLOWID, 2224e9c8ae7SLuigi Rizzo TOK_ICMP6TYPES, 2234e9c8ae7SLuigi Rizzo TOK_EXT6HDR, 2244e9c8ae7SLuigi Rizzo TOK_DSTIP6, 2254e9c8ae7SLuigi Rizzo TOK_SRCIP6, 2264e9c8ae7SLuigi Rizzo 2274e9c8ae7SLuigi Rizzo TOK_IPV4, 2284e9c8ae7SLuigi Rizzo TOK_UNREACH6, 2294e9c8ae7SLuigi Rizzo TOK_RESET6, 2304e9c8ae7SLuigi Rizzo 2314e9c8ae7SLuigi Rizzo TOK_FIB, 2324e9c8ae7SLuigi Rizzo TOK_SETFIB, 233472099c4SLuigi Rizzo TOK_LOOKUP, 234ae99fd0eSLuigi Rizzo TOK_SOCKARG, 235ae01d73cSAlexander V. Chernikov TOK_SETDSCP, 236358b9d09SAlexander V. Chernikov TOK_FLOW, 237358b9d09SAlexander V. Chernikov TOK_IFLIST, 238ac35ff17SAlexander V. Chernikov /* Table tokens */ 239ac35ff17SAlexander V. Chernikov TOK_CREATE, 240ac35ff17SAlexander V. Chernikov TOK_DESTROY, 241ac35ff17SAlexander V. Chernikov TOK_LIST, 242ac35ff17SAlexander V. Chernikov TOK_INFO, 243358b9d09SAlexander V. Chernikov TOK_DETAIL, 244adf3b2b9SAlexander V. Chernikov TOK_MODIFY, 245ac35ff17SAlexander V. Chernikov TOK_FLUSH, 24646d52008SAlexander V. Chernikov TOK_SWAP, 247ac35ff17SAlexander V. Chernikov TOK_ADD, 248ac35ff17SAlexander V. Chernikov TOK_DEL, 249ac35ff17SAlexander V. Chernikov TOK_VALTYPE, 250ac35ff17SAlexander V. Chernikov TOK_ALGO, 251358b9d09SAlexander V. Chernikov TOK_TALIST, 2523a845e10SAlexander V. Chernikov TOK_ATOMIC, 2534f43138aSAlexander V. Chernikov TOK_LOCK, 2544f43138aSAlexander V. Chernikov TOK_UNLOCK, 2550cba2b28SAlexander V. Chernikov TOK_VLIST, 2565dc5a0e0SAndrey V. Elsukov TOK_OLIST, 2574e9c8ae7SLuigi Rizzo }; 2581940fa77SAlexander V. Chernikov 2593c0c8717SLuigi Rizzo /* 2603c0c8717SLuigi Rizzo * the following macro returns an error message if we run out of 2613c0c8717SLuigi Rizzo * arguments. 2623c0c8717SLuigi Rizzo */ 263cc4d3c30SLuigi Rizzo #define NEED(_p, msg) {if (!_p) errx(EX_USAGE, msg);} 264cc4d3c30SLuigi Rizzo #define NEED1(msg) {if (!(*av)) errx(EX_USAGE, msg);} 2653c0c8717SLuigi Rizzo 266563b5ab1SAlexander V. Chernikov struct buf_pr { 267563b5ab1SAlexander V. Chernikov char *buf; /* allocated buffer */ 268563b5ab1SAlexander V. Chernikov char *ptr; /* current pointer */ 269563b5ab1SAlexander V. Chernikov size_t size; /* total buffer size */ 270563b5ab1SAlexander V. Chernikov size_t avail; /* available storage */ 271563b5ab1SAlexander V. Chernikov size_t needed; /* length needed */ 272563b5ab1SAlexander V. Chernikov }; 273563b5ab1SAlexander V. Chernikov 274563b5ab1SAlexander V. Chernikov int pr_u64(struct buf_pr *bp, uint64_t *pd, int width); 275563b5ab1SAlexander V. Chernikov int bp_alloc(struct buf_pr *b, size_t size); 276563b5ab1SAlexander V. Chernikov void bp_free(struct buf_pr *b); 277563b5ab1SAlexander V. Chernikov int bprintf(struct buf_pr *b, char *format, ...); 278563b5ab1SAlexander V. Chernikov 27950a99912SLuigi Rizzo 2803c0c8717SLuigi Rizzo /* memory allocation support */ 2813c0c8717SLuigi Rizzo void *safe_calloc(size_t number, size_t size); 2823c0c8717SLuigi Rizzo void *safe_realloc(void *ptr, size_t size); 2833c0c8717SLuigi Rizzo 284ead75a59SLuigi Rizzo /* string comparison functions used for historical compatibility */ 2853c0c8717SLuigi Rizzo int _substrcmp(const char *str1, const char* str2); 2864e9c8ae7SLuigi Rizzo int _substrcmp2(const char *str1, const char* str2, const char* str3); 28768394ec8SAlexander V. Chernikov int stringnum_cmp(const char *a, const char *b); 2884e9c8ae7SLuigi Rizzo 289ead75a59SLuigi Rizzo /* utility functions */ 2902acdf79fSAndrey V. Elsukov int match_token(struct _s_x *table, const char *string); 2912acdf79fSAndrey V. Elsukov int match_token_relaxed(struct _s_x *table, const char *string); 2922acdf79fSAndrey V. Elsukov int get_token(struct _s_x *table, const char *string, const char *errbase); 293ead75a59SLuigi Rizzo char const *match_value(struct _s_x *p, int value); 294ac35ff17SAlexander V. Chernikov size_t concat_tokens(char *buf, size_t bufsize, struct _s_x *table, 295ac35ff17SAlexander V. Chernikov char *delimiter); 2960cba2b28SAlexander V. Chernikov int fill_flags(struct _s_x *flags, char *p, char **e, uint32_t *set, 2970cba2b28SAlexander V. Chernikov uint32_t *clear); 2980cba2b28SAlexander V. Chernikov void print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set); 299ead75a59SLuigi Rizzo 300f1220db8SAlexander V. Chernikov struct _ip_fw3_opheader; 3014e9c8ae7SLuigi Rizzo int do_cmd(int optname, void *optval, uintptr_t optlen); 302f1220db8SAlexander V. Chernikov int do_set3(int optname, struct _ip_fw3_opheader *op3, uintptr_t optlen); 303f1220db8SAlexander V. Chernikov int do_get3(int optname, struct _ip_fw3_opheader *op3, size_t *optlen); 3041058f177SAlexander V. Chernikov 3054e9c8ae7SLuigi Rizzo struct in6_addr; 3064e9c8ae7SLuigi Rizzo void n2mask(struct in6_addr *mask, int n); 307ead75a59SLuigi Rizzo int contigmask(uint8_t *p, int len); 308ead75a59SLuigi Rizzo 30916e3606fSLuigi Rizzo /* 31016e3606fSLuigi Rizzo * Forward declarations to avoid include way too many headers. 31116e3606fSLuigi Rizzo * C does not allow duplicated typedefs, so we use the base struct 31216e3606fSLuigi Rizzo * that the typedef points to. 31316e3606fSLuigi Rizzo * Should the typedefs use a different type, the compiler will 31416e3606fSLuigi Rizzo * still detect the change when compiling the body of the 31516e3606fSLuigi Rizzo * functions involved, so we do not lose error checking. 31616e3606fSLuigi Rizzo */ 31716e3606fSLuigi Rizzo struct _ipfw_insn; 31823c608c8SLuigi Rizzo struct _ipfw_insn_altq; 31916e3606fSLuigi Rizzo struct _ipfw_insn_u32; 32016e3606fSLuigi Rizzo struct _ipfw_insn_ip6; 32116e3606fSLuigi Rizzo struct _ipfw_insn_icmp6; 3223c0c8717SLuigi Rizzo 3233c0c8717SLuigi Rizzo /* 3243c0c8717SLuigi Rizzo * The reserved set numer. This is a constant in ip_fw.h 3253c0c8717SLuigi Rizzo * but we store it in a variable so other files do not depend 3263c0c8717SLuigi Rizzo * in that header just for one constant. 3273c0c8717SLuigi Rizzo */ 3283c0c8717SLuigi Rizzo extern int resvd_set_number; 3293c0c8717SLuigi Rizzo 330ead75a59SLuigi Rizzo /* first-level command handlers */ 331cc4d3c30SLuigi Rizzo void ipfw_add(char *av[]); 3323c0c8717SLuigi Rizzo void ipfw_show_nat(int ac, char **av); 3333c0c8717SLuigi Rizzo void ipfw_config_pipe(int ac, char **av); 3343c0c8717SLuigi Rizzo void ipfw_config_nat(int ac, char **av); 335cc4d3c30SLuigi Rizzo void ipfw_sets_handler(char *av[]); 3363c0c8717SLuigi Rizzo void ipfw_table_handler(int ac, char *av[]); 337cc4d3c30SLuigi Rizzo void ipfw_sysctl_handler(char *av[], int which); 338cc4d3c30SLuigi Rizzo void ipfw_delete(char *av[]); 3393c0c8717SLuigi Rizzo void ipfw_flush(int force); 3403c0c8717SLuigi Rizzo void ipfw_zero(int ac, char *av[], int optname); 3413c0c8717SLuigi Rizzo void ipfw_list(int ac, char *av[], int show_counters); 342358b9d09SAlexander V. Chernikov void ipfw_internal_handler(int ac, char *av[]); 3432acdf79fSAndrey V. Elsukov int ipfw_check_object_name(const char *name); 3443c0c8717SLuigi Rizzo 3459968f056SGleb Smirnoff #ifdef PF 34623c608c8SLuigi Rizzo /* altq.c */ 34723c608c8SLuigi Rizzo void altq_set_enabled(int enabled); 34823c608c8SLuigi Rizzo u_int32_t altq_name_to_qid(const char *name); 349563b5ab1SAlexander V. Chernikov void print_altq_cmd(struct buf_pr *bp, struct _ipfw_insn_altq *altqptr); 3509968f056SGleb Smirnoff #else 3519968f056SGleb Smirnoff #define NO_ALTQ 3529968f056SGleb Smirnoff #endif 35323c608c8SLuigi Rizzo 354ead75a59SLuigi Rizzo /* dummynet.c */ 355cc4d3c30SLuigi Rizzo void dummynet_list(int ac, char *av[], int show_counters); 356cc4d3c30SLuigi Rizzo void dummynet_flush(void); 3574e9c8ae7SLuigi Rizzo int ipfw_delete_pipe(int pipe_or_queue, int n); 3584e9c8ae7SLuigi Rizzo 359ead75a59SLuigi Rizzo /* ipv6.c */ 3607b34dbe4SAndrey V. Elsukov void print_unreach6_code(struct buf_pr *bp, uint16_t code); 3614df4dadaSAlexander V. Chernikov void print_ip6(struct buf_pr *bp, struct _ipfw_insn_ip6 *cmd, char const *s); 3624df4dadaSAlexander V. Chernikov void print_flow6id(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); 3634df4dadaSAlexander V. Chernikov void print_icmp6types(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); 3644df4dadaSAlexander V. Chernikov void print_ext6hdr(struct buf_pr *bp, struct _ipfw_insn *cmd ); 365ead75a59SLuigi Rizzo 366579ed7bdSAlexander V. Chernikov struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen); 367579ed7bdSAlexander V. Chernikov struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen); 368ead75a59SLuigi Rizzo 369579ed7bdSAlexander V. Chernikov void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av, int cblen); 370ead75a59SLuigi Rizzo void fill_unreach6_code(u_short *codep, char *str); 371579ed7bdSAlexander V. Chernikov void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen); 37216e3606fSLuigi Rizzo int fill_ext6hdr(struct _ipfw_insn *cmd, char *av); 373563b5ab1SAlexander V. Chernikov 374*b04471d8SCy Schubert /* ipfw2.c */ 375*b04471d8SCy Schubert void bp_flush(struct buf_pr *b); 376*b04471d8SCy Schubert 377563b5ab1SAlexander V. Chernikov /* tables.c */ 378563b5ab1SAlexander V. Chernikov struct _ipfw_obj_ctlv; 3792acdf79fSAndrey V. Elsukov int table_check_name(const char *tablename); 380358b9d09SAlexander V. Chernikov void ipfw_list_ta(int ac, char *av[]); 3810cba2b28SAlexander V. Chernikov void ipfw_list_values(int ac, char *av[]); 382563b5ab1SAlexander V. Chernikov 383