2017-12-19 22:40:16 +00:00
|
|
|
/*-
|
2009-01-27 10:18:55 +00:00
|
|
|
* Copyright (c) 2002-2003 Luigi Rizzo
|
|
|
|
* Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp
|
|
|
|
* Copyright (c) 1994 Ugen J.S.Antsilevich
|
|
|
|
*
|
|
|
|
* Idea and grammar partially left from:
|
|
|
|
* Copyright (c) 1993 Daniel Boulet
|
|
|
|
*
|
|
|
|
* Redistribution and use in source forms, with and without modification,
|
|
|
|
* are permitted provided that this entire comment appears intact.
|
|
|
|
*
|
|
|
|
* Redistribution in binary form may occur without any restrictions.
|
|
|
|
* Obviously, it would be nice if you gave credit where credit is due
|
|
|
|
* but requiring it would be too onerous.
|
|
|
|
*
|
|
|
|
* This software is provided ``AS IS'' without any warranties of any kind.
|
|
|
|
*
|
|
|
|
* NEW command line interface for IP firewall facility
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
2021-05-25 14:54:32 +00:00
|
|
|
enum cmdline_prog {
|
|
|
|
cmdline_prog_ipfw,
|
|
|
|
cmdline_prog_dnctl
|
|
|
|
};
|
|
|
|
|
2009-01-27 10:18:55 +00:00
|
|
|
/*
|
|
|
|
* Options that can be set on the command line.
|
|
|
|
* When reading commands from a file, a subset of the options can also
|
|
|
|
* be applied globally by specifying them before the file name.
|
|
|
|
* After that, each line can contain its own option that changes
|
|
|
|
* the global value.
|
|
|
|
* XXX The context is not restored after each line.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct cmdline_opts {
|
|
|
|
/* boolean options: */
|
|
|
|
int do_value_as_ip; /* show table value as IP */
|
|
|
|
int do_resolv; /* try to resolve all ip to names */
|
|
|
|
int do_time; /* Show time stamps */
|
|
|
|
int do_quiet; /* Be quiet in add and flush */
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
int do_pipe; /* this cmd refers to a pipe/queue/sched */
|
2009-01-27 10:18:55 +00:00
|
|
|
int do_nat; /* this cmd refers to a nat config */
|
|
|
|
int do_compact; /* show rules in compact mode */
|
|
|
|
int do_force; /* do not ask for confirmation */
|
|
|
|
int show_sets; /* display the set each rule belongs to */
|
|
|
|
int test_only; /* only check syntax */
|
|
|
|
int comment_only; /* only print action and comment */
|
|
|
|
int verbose; /* be verbose on some commands */
|
2023-06-11 08:12:04 +00:00
|
|
|
int debug_only; /* output ioctl i/o on stdout */
|
2009-01-27 10:18:55 +00:00
|
|
|
|
|
|
|
/* The options below can have multiple values. */
|
|
|
|
|
2018-12-04 16:12:43 +00:00
|
|
|
int do_dynamic; /* 1 - display dynamic rules */
|
|
|
|
/* 2 - display/delete only dynamic rules */
|
2009-01-27 10:18:55 +00:00
|
|
|
int do_sort; /* field to sort results (0 = no) */
|
|
|
|
/* valid fields are 1 and above */
|
|
|
|
|
2020-07-13 17:51:04 +00:00
|
|
|
uint32_t use_set; /* work with specified set number */
|
2009-01-27 10:18:55 +00:00
|
|
|
/* 0 means all sets, otherwise apply to set use_set - 1 */
|
|
|
|
|
2021-05-25 14:54:32 +00:00
|
|
|
enum cmdline_prog prog; /* Are we ipfw or dnctl? */
|
2009-01-27 10:18:55 +00:00
|
|
|
};
|
|
|
|
|
2021-05-25 14:54:32 +00:00
|
|
|
int is_ipfw(void);
|
|
|
|
|
2018-03-28 12:44:28 +00:00
|
|
|
enum {
|
|
|
|
TIMESTAMP_NONE = 0,
|
|
|
|
TIMESTAMP_STRING,
|
|
|
|
TIMESTAMP_NUMERIC,
|
|
|
|
};
|
|
|
|
|
2020-07-13 17:51:04 +00:00
|
|
|
extern struct cmdline_opts g_co;
|
2009-01-27 10:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* _s_x is a structure that stores a string <-> token pairs, used in
|
|
|
|
* various places in the parser. Entries are stored in arrays,
|
|
|
|
* with an entry with s=NULL as terminator.
|
|
|
|
* The search routines are match_token() and match_value().
|
|
|
|
* Often, an element with x=0 contains an error string.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct _s_x {
|
|
|
|
char const *s;
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
|
2014-07-03 22:25:59 +00:00
|
|
|
extern struct _s_x f_ipdscp[];
|
|
|
|
|
2009-01-27 11:06:59 +00:00
|
|
|
enum tokens {
|
|
|
|
TOK_NULL=0,
|
|
|
|
|
|
|
|
TOK_OR,
|
|
|
|
TOK_NOT,
|
|
|
|
TOK_STARTBRACE,
|
|
|
|
TOK_ENDBRACE,
|
|
|
|
|
2017-11-26 18:19:01 +00:00
|
|
|
TOK_ABORT6,
|
|
|
|
TOK_ABORT,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_ACCEPT,
|
|
|
|
TOK_COUNT,
|
2016-04-14 22:51:23 +00:00
|
|
|
TOK_EACTION,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_PIPE,
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
TOK_LINK,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_QUEUE,
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
TOK_FLOWSET,
|
|
|
|
TOK_SCHED,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_DIVERT,
|
|
|
|
TOK_TEE,
|
|
|
|
TOK_NETGRAPH,
|
|
|
|
TOK_NGTEE,
|
|
|
|
TOK_FORWARD,
|
|
|
|
TOK_SKIPTO,
|
|
|
|
TOK_DENY,
|
|
|
|
TOK_REJECT,
|
|
|
|
TOK_RESET,
|
|
|
|
TOK_UNREACH,
|
|
|
|
TOK_CHECKSTATE,
|
|
|
|
TOK_NAT,
|
2009-04-01 20:23:47 +00:00
|
|
|
TOK_REASS,
|
2011-06-29 10:06:58 +00:00
|
|
|
TOK_CALL,
|
|
|
|
TOK_RETURN,
|
2009-01-27 11:06:59 +00:00
|
|
|
|
|
|
|
TOK_ALTQ,
|
|
|
|
TOK_LOG,
|
|
|
|
TOK_TAG,
|
|
|
|
TOK_UNTAG,
|
|
|
|
|
|
|
|
TOK_TAGGED,
|
|
|
|
TOK_UID,
|
|
|
|
TOK_GID,
|
|
|
|
TOK_JAIL,
|
|
|
|
TOK_IN,
|
|
|
|
TOK_LIMIT,
|
2018-07-09 11:35:18 +00:00
|
|
|
TOK_SETLIMIT,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_KEEPSTATE,
|
2018-07-09 11:35:18 +00:00
|
|
|
TOK_RECORDSTATE,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_LAYER2,
|
|
|
|
TOK_OUT,
|
|
|
|
TOK_DIVERTED,
|
|
|
|
TOK_DIVERTEDLOOPBACK,
|
|
|
|
TOK_DIVERTEDOUTPUT,
|
|
|
|
TOK_XMIT,
|
|
|
|
TOK_RECV,
|
|
|
|
TOK_VIA,
|
|
|
|
TOK_FRAG,
|
|
|
|
TOK_IPOPTS,
|
|
|
|
TOK_IPLEN,
|
|
|
|
TOK_IPID,
|
|
|
|
TOK_IPPRECEDENCE,
|
2010-03-15 15:43:35 +00:00
|
|
|
TOK_DSCP,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_IPTOS,
|
|
|
|
TOK_IPTTL,
|
|
|
|
TOK_IPVER,
|
|
|
|
TOK_ESTAB,
|
|
|
|
TOK_SETUP,
|
|
|
|
TOK_TCPDATALEN,
|
|
|
|
TOK_TCPFLAGS,
|
|
|
|
TOK_TCPOPTS,
|
|
|
|
TOK_TCPSEQ,
|
|
|
|
TOK_TCPACK,
|
2019-06-21 10:54:51 +00:00
|
|
|
TOK_TCPMSS,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_TCPWIN,
|
|
|
|
TOK_ICMPTYPES,
|
|
|
|
TOK_MAC,
|
|
|
|
TOK_MACTYPE,
|
|
|
|
TOK_VERREVPATH,
|
|
|
|
TOK_VERSRCREACH,
|
|
|
|
TOK_ANTISPOOF,
|
|
|
|
TOK_IPSEC,
|
|
|
|
TOK_COMMENT,
|
|
|
|
|
|
|
|
TOK_PLR,
|
|
|
|
TOK_NOERROR,
|
|
|
|
TOK_BUCKETS,
|
|
|
|
TOK_DSTIP,
|
|
|
|
TOK_SRCIP,
|
|
|
|
TOK_DSTPORT,
|
|
|
|
TOK_SRCPORT,
|
2022-06-04 16:12:29 +00:00
|
|
|
TOK_DSTMAC,
|
|
|
|
TOK_SRCMAC,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_ALL,
|
|
|
|
TOK_MASK,
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
TOK_FLOW_MASK,
|
|
|
|
TOK_SCHED_MASK,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_BW,
|
|
|
|
TOK_DELAY,
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
TOK_PROFILE,
|
2009-06-24 22:57:07 +00:00
|
|
|
TOK_BURST,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_RED,
|
|
|
|
TOK_GRED,
|
2014-06-01 07:28:24 +00:00
|
|
|
TOK_ECN,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_DROPTAIL,
|
|
|
|
TOK_PROTO,
|
Import Dummynet AQM version 0.2.1 (CoDel, FQ-CoDel, PIE and FQ-PIE).
Centre for Advanced Internet Architectures
Implementing AQM in FreeBSD
* Overview <http://caia.swin.edu.au/freebsd/aqm/index.html>
* Articles, Papers and Presentations
<http://caia.swin.edu.au/freebsd/aqm/papers.html>
* Patches and Tools <http://caia.swin.edu.au/freebsd/aqm/downloads.html>
Overview
Recent years have seen a resurgence of interest in better managing
the depth of bottleneck queues in routers, switches and other places
that get congested. Solutions include transport protocol enhancements
at the end-hosts (such as delay-based or hybrid congestion control
schemes) and active queue management (AQM) schemes applied within
bottleneck queues.
The notion of AQM has been around since at least the late 1990s
(e.g. RFC 2309). In recent years the proliferation of oversized
buffers in all sorts of network devices (aka bufferbloat) has
stimulated keen community interest in four new AQM schemes -- CoDel,
FQ-CoDel, PIE and FQ-PIE.
The IETF AQM working group is looking to document these schemes,
and independent implementations are a corner-stone of the IETF's
process for confirming the clarity of publicly available protocol
descriptions. While significant development work on all three schemes
has occured in the Linux kernel, there is very little in FreeBSD.
Project Goals
This project began in late 2015, and aims to design and implement
functionally-correct versions of CoDel, FQ-CoDel, PIE and FQ_PIE
in FreeBSD (with code BSD-licensed as much as practical). We have
chosen to do this as extensions to FreeBSD's ipfw/dummynet firewall
and traffic shaper. Implementation of these AQM schemes in FreeBSD
will:
* Demonstrate whether the publicly available documentation is
sufficient to enable independent, functionally equivalent implementations
* Provide a broader suite of AQM options for sections the networking
community that rely on FreeBSD platforms
Program Members:
* Rasool Al Saadi (developer)
* Grenville Armitage (project lead)
Acknowledgements:
This project has been made possible in part by a gift from the
Comcast Innovation Fund.
Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
X-No objection: core
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6388
2016-05-26 21:40:13 +00:00
|
|
|
#ifdef NEW_AQM
|
|
|
|
/* AQM tokens*/
|
|
|
|
TOK_NO_ECN,
|
|
|
|
TOK_CODEL,
|
|
|
|
TOK_FQ_CODEL,
|
|
|
|
TOK_TARGET,
|
|
|
|
TOK_INTERVAL,
|
|
|
|
TOK_FLOWS,
|
|
|
|
TOK_QUANTUM,
|
|
|
|
|
|
|
|
TOK_PIE,
|
|
|
|
TOK_FQ_PIE,
|
|
|
|
TOK_TUPDATE,
|
|
|
|
TOK_MAX_BURST,
|
|
|
|
TOK_MAX_ECNTH,
|
|
|
|
TOK_ALPHA,
|
|
|
|
TOK_BETA,
|
|
|
|
TOK_CAPDROP,
|
|
|
|
TOK_NO_CAPDROP,
|
|
|
|
TOK_ONOFF,
|
|
|
|
TOK_DRE,
|
|
|
|
TOK_TS,
|
|
|
|
TOK_DERAND,
|
|
|
|
TOK_NO_DERAND,
|
|
|
|
#endif
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
/* dummynet tokens */
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_WEIGHT,
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
TOK_LMAX,
|
|
|
|
TOK_PRI,
|
|
|
|
TOK_TYPE,
|
|
|
|
TOK_SLOTSIZE,
|
|
|
|
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_IP,
|
|
|
|
TOK_IF,
|
2017-10-02 20:02:25 +00:00
|
|
|
TOK_ALOG,
|
|
|
|
TOK_DENY_INC,
|
|
|
|
TOK_SAME_PORTS,
|
|
|
|
TOK_UNREG_ONLY,
|
2020-01-24 20:35:41 +00:00
|
|
|
TOK_UNREG_CGN,
|
2011-06-14 13:35:24 +00:00
|
|
|
TOK_SKIP_GLOBAL,
|
2017-10-02 20:02:25 +00:00
|
|
|
TOK_RESET_ADDR,
|
|
|
|
TOK_ALIAS_REV,
|
|
|
|
TOK_PROXY_ONLY,
|
2009-01-27 11:06:59 +00:00
|
|
|
TOK_REDIR_ADDR,
|
|
|
|
TOK_REDIR_PORT,
|
2011-04-18 22:09:03 +00:00
|
|
|
TOK_REDIR_PROTO,
|
2009-01-27 11:06:59 +00:00
|
|
|
|
|
|
|
TOK_IPV6,
|
|
|
|
TOK_FLOWID,
|
|
|
|
TOK_ICMP6TYPES,
|
|
|
|
TOK_EXT6HDR,
|
|
|
|
TOK_DSTIP6,
|
|
|
|
TOK_SRCIP6,
|
|
|
|
|
|
|
|
TOK_IPV4,
|
|
|
|
TOK_UNREACH6,
|
|
|
|
TOK_RESET6,
|
|
|
|
|
|
|
|
TOK_FIB,
|
|
|
|
TOK_SETFIB,
|
2009-12-15 09:46:27 +00:00
|
|
|
TOK_LOOKUP,
|
2010-11-12 13:05:17 +00:00
|
|
|
TOK_SOCKARG,
|
2013-03-20 10:35:33 +00:00
|
|
|
TOK_SETDSCP,
|
2014-08-03 16:22:14 +00:00
|
|
|
TOK_FLOW,
|
|
|
|
TOK_IFLIST,
|
2014-07-03 22:25:59 +00:00
|
|
|
/* Table tokens */
|
|
|
|
TOK_CREATE,
|
|
|
|
TOK_DESTROY,
|
|
|
|
TOK_LIST,
|
|
|
|
TOK_INFO,
|
2014-08-03 16:22:14 +00:00
|
|
|
TOK_DETAIL,
|
2014-08-08 09:27:49 +00:00
|
|
|
TOK_MODIFY,
|
2014-07-03 22:25:59 +00:00
|
|
|
TOK_FLUSH,
|
2014-08-03 21:37:12 +00:00
|
|
|
TOK_SWAP,
|
2014-07-03 22:25:59 +00:00
|
|
|
TOK_ADD,
|
|
|
|
TOK_DEL,
|
|
|
|
TOK_VALTYPE,
|
|
|
|
TOK_ALGO,
|
2014-08-03 16:22:14 +00:00
|
|
|
TOK_TALIST,
|
2014-08-11 17:34:25 +00:00
|
|
|
TOK_ATOMIC,
|
2014-08-11 18:09:37 +00:00
|
|
|
TOK_LOCK,
|
|
|
|
TOK_UNLOCK,
|
Add support for multi-field values inside ipfw tables.
This is the last major change in given branch.
Kernel changes:
* Use 64-bytes structures to hold multi-value variables.
* Use shared array to hold values from all tables (assume
each table algo is capable of holding 32-byte variables).
* Add some placeholders to support per-table value arrays in future.
* Use simple eventhandler-style API to ease the process of adding new
table items. Currently table addition may required multiple UH drops/
acquires which is quite tricky due to atomic table modificatio/swap
support, shared array resize, etc. Deal with it by calling special
notifier capable of rolling back state before actually performing
swap/resize operations. Original operation then restarts itself after
acquiring UH lock.
* Bump all objhash users default values to at least 64
* Fix custom hashing inside objhash.
Userland changes:
* Add support for dumping shared value array via "vlist" internal cmd.
* Some small print/fill_flags dixes to support u32 values.
* valtype is now bitmask of
<skipto|pipe|fib|nat|dscp|tag|divert|netgraph|limit|ipv4|ipv6>.
New values can hold distinct values for each of this types.
* Provide special "legacy" type which assumes all values are the same.
* More helpers/docs following..
Some examples:
3:41 [1] zfscurr0# ipfw table mimimi create valtype skipto,limit,ipv4,ipv6
3:41 [1] zfscurr0# ipfw table mimimi info
+++ table(mimimi), set(0) +++
kindex: 2, type: addr
references: 0, valtype: skipto,limit,ipv4,ipv6
algorithm: addr:radix
items: 0, size: 296
3:42 [1] zfscurr0# ipfw table mimimi add 10.0.0.5 3000,10,10.0.0.1,2a02:978:2::1
added: 10.0.0.5/32 3000,10,10.0.0.1,2a02:978:2::1
3:42 [1] zfscurr0# ipfw table mimimi list
+++ table(mimimi), set(0) +++
10.0.0.5/32 3000,0,10.0.0.1,2a02:978:2::1
2014-08-31 23:51:09 +00:00
|
|
|
TOK_VLIST,
|
2015-11-03 10:21:53 +00:00
|
|
|
TOK_OLIST,
|
2019-05-24 11:06:24 +00:00
|
|
|
TOK_MISSING,
|
|
|
|
TOK_ORFLUSH,
|
2016-08-13 16:09:49 +00:00
|
|
|
|
|
|
|
/* NAT64 tokens */
|
|
|
|
TOK_NAT64STL,
|
|
|
|
TOK_NAT64LSN,
|
2016-07-18 19:46:31 +00:00
|
|
|
TOK_STATS,
|
2016-08-13 16:09:49 +00:00
|
|
|
TOK_STATES,
|
|
|
|
TOK_CONFIG,
|
|
|
|
TOK_TABLE4,
|
|
|
|
TOK_TABLE6,
|
|
|
|
TOK_PREFIX4,
|
|
|
|
TOK_PREFIX6,
|
|
|
|
TOK_AGG_LEN,
|
|
|
|
TOK_AGG_COUNT,
|
|
|
|
TOK_MAX_PORTS,
|
2019-03-19 10:57:03 +00:00
|
|
|
TOK_STATES_CHUNKS,
|
2016-08-13 16:09:49 +00:00
|
|
|
TOK_JMAXLEN,
|
|
|
|
TOK_PORT_RANGE,
|
2021-02-02 21:24:17 +00:00
|
|
|
TOK_PORT_ALIAS,
|
2016-08-13 16:09:49 +00:00
|
|
|
TOK_HOST_DEL_AGE,
|
|
|
|
TOK_PG_DEL_AGE,
|
|
|
|
TOK_TCP_SYN_AGE,
|
|
|
|
TOK_TCP_CLOSE_AGE,
|
|
|
|
TOK_TCP_EST_AGE,
|
|
|
|
TOK_UDP_AGE,
|
|
|
|
TOK_ICMP_AGE,
|
|
|
|
TOK_LOGOFF,
|
2019-03-18 10:39:14 +00:00
|
|
|
TOK_PRIVATE,
|
|
|
|
TOK_PRIVATEOFF,
|
2016-07-18 19:46:31 +00:00
|
|
|
|
2019-03-18 11:44:53 +00:00
|
|
|
/* NAT64 CLAT tokens */
|
|
|
|
TOK_NAT64CLAT,
|
|
|
|
TOK_PLAT_PREFIX,
|
|
|
|
TOK_CLAT_PREFIX,
|
|
|
|
|
2016-07-18 19:46:31 +00:00
|
|
|
/* NPTv6 tokens */
|
|
|
|
TOK_NPTV6,
|
|
|
|
TOK_INTPREFIX,
|
|
|
|
TOK_EXTPREFIX,
|
|
|
|
TOK_PREFIXLEN,
|
2018-11-12 11:20:59 +00:00
|
|
|
TOK_EXTIF,
|
2017-04-03 03:07:48 +00:00
|
|
|
|
|
|
|
TOK_TCPSETMSS,
|
2018-07-09 11:35:18 +00:00
|
|
|
|
2023-04-25 12:38:36 +00:00
|
|
|
TOK_MARK,
|
|
|
|
TOK_SETMARK,
|
|
|
|
|
2018-07-09 11:35:18 +00:00
|
|
|
TOK_SKIPACTION,
|
2009-01-27 11:06:59 +00:00
|
|
|
};
|
Change tablearg value to be 0 (try #2).
Most of the tablearg-supported opcodes does not accept 0 as valid value:
O_TAG, O_TAGGED, O_PIPE, O_QUEUE, O_DIVERT, O_TEE, O_SKIPTO, O_CALLRET,
O_NETGRAPH, O_NGTEE, O_NAT treats 0 as invalid input.
The rest are O_SETDSCP and O_SETFIB.
'Fix' them by adding high-order bit (0x8000) set for non-tablearg values.
Do translation in kernel for old clients (import_rule0 / export_rule0),
teach current ipfw(8) binary to add/remove given bit.
This change does not affect handling SETDSCP values, but limit
O_SETFIB values to 32767 instead of 65k. Since currently we have either
old (16) or new (2^32) max fibs, this should not be a big deal:
we're definitely OK for former and have to add another opcode to deal
with latter, regardless of tablearg value.
2014-08-12 15:51:48 +00:00
|
|
|
|
2009-01-27 10:18:55 +00:00
|
|
|
/*
|
|
|
|
* the following macro returns an error message if we run out of
|
|
|
|
* arguments.
|
|
|
|
*/
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
#define NEED(_p, msg) {if (!_p) errx(EX_USAGE, msg);}
|
|
|
|
#define NEED1(msg) {if (!(*av)) errx(EX_USAGE, msg);}
|
2009-01-27 10:18:55 +00:00
|
|
|
|
2014-06-28 23:20:24 +00:00
|
|
|
struct buf_pr {
|
|
|
|
char *buf; /* allocated buffer */
|
|
|
|
char *ptr; /* current pointer */
|
|
|
|
size_t size; /* total buffer size */
|
|
|
|
size_t avail; /* available storage */
|
|
|
|
size_t needed; /* length needed */
|
|
|
|
};
|
|
|
|
|
2020-07-13 19:10:16 +00:00
|
|
|
int pr_u64(struct buf_pr *bp, void *pd, int width);
|
2014-06-28 23:20:24 +00:00
|
|
|
int bp_alloc(struct buf_pr *b, size_t size);
|
|
|
|
void bp_free(struct buf_pr *b);
|
2020-07-13 17:51:04 +00:00
|
|
|
int bprintf(struct buf_pr *b, const char *format, ...);
|
2014-06-28 23:20:24 +00:00
|
|
|
|
2009-01-27 20:26:45 +00:00
|
|
|
|
2009-01-27 10:18:55 +00:00
|
|
|
/* memory allocation support */
|
|
|
|
void *safe_calloc(size_t number, size_t size);
|
|
|
|
void *safe_realloc(void *ptr, size_t size);
|
|
|
|
|
2009-01-27 12:01:30 +00:00
|
|
|
/* string comparison functions used for historical compatibility */
|
2009-01-27 10:18:55 +00:00
|
|
|
int _substrcmp(const char *str1, const char* str2);
|
2009-01-27 11:06:59 +00:00
|
|
|
int _substrcmp2(const char *str1, const char* str2, const char* str3);
|
2014-07-28 19:01:25 +00:00
|
|
|
int stringnum_cmp(const char *a, const char *b);
|
2009-01-27 11:06:59 +00:00
|
|
|
|
2009-01-27 12:01:30 +00:00
|
|
|
/* utility functions */
|
2016-04-14 22:51:23 +00:00
|
|
|
int match_token(struct _s_x *table, const char *string);
|
|
|
|
int match_token_relaxed(struct _s_x *table, const char *string);
|
|
|
|
int get_token(struct _s_x *table, const char *string, const char *errbase);
|
2009-01-27 12:01:30 +00:00
|
|
|
char const *match_value(struct _s_x *p, int value);
|
2014-07-03 22:25:59 +00:00
|
|
|
size_t concat_tokens(char *buf, size_t bufsize, struct _s_x *table,
|
2020-07-13 17:51:04 +00:00
|
|
|
const char *delimiter);
|
Add support for multi-field values inside ipfw tables.
This is the last major change in given branch.
Kernel changes:
* Use 64-bytes structures to hold multi-value variables.
* Use shared array to hold values from all tables (assume
each table algo is capable of holding 32-byte variables).
* Add some placeholders to support per-table value arrays in future.
* Use simple eventhandler-style API to ease the process of adding new
table items. Currently table addition may required multiple UH drops/
acquires which is quite tricky due to atomic table modificatio/swap
support, shared array resize, etc. Deal with it by calling special
notifier capable of rolling back state before actually performing
swap/resize operations. Original operation then restarts itself after
acquiring UH lock.
* Bump all objhash users default values to at least 64
* Fix custom hashing inside objhash.
Userland changes:
* Add support for dumping shared value array via "vlist" internal cmd.
* Some small print/fill_flags dixes to support u32 values.
* valtype is now bitmask of
<skipto|pipe|fib|nat|dscp|tag|divert|netgraph|limit|ipv4|ipv6>.
New values can hold distinct values for each of this types.
* Provide special "legacy" type which assumes all values are the same.
* More helpers/docs following..
Some examples:
3:41 [1] zfscurr0# ipfw table mimimi create valtype skipto,limit,ipv4,ipv6
3:41 [1] zfscurr0# ipfw table mimimi info
+++ table(mimimi), set(0) +++
kindex: 2, type: addr
references: 0, valtype: skipto,limit,ipv4,ipv6
algorithm: addr:radix
items: 0, size: 296
3:42 [1] zfscurr0# ipfw table mimimi add 10.0.0.5 3000,10,10.0.0.1,2a02:978:2::1
added: 10.0.0.5/32 3000,10,10.0.0.1,2a02:978:2::1
3:42 [1] zfscurr0# ipfw table mimimi list
+++ table(mimimi), set(0) +++
10.0.0.5/32 3000,0,10.0.0.1,2a02:978:2::1
2014-08-31 23:51:09 +00:00
|
|
|
int fill_flags(struct _s_x *flags, char *p, char **e, uint32_t *set,
|
|
|
|
uint32_t *clear);
|
|
|
|
void print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set);
|
2009-01-27 12:01:30 +00:00
|
|
|
|
2014-06-14 22:47:25 +00:00
|
|
|
struct _ip_fw3_opheader;
|
2009-01-27 11:06:59 +00:00
|
|
|
int do_cmd(int optname, void *optval, uintptr_t optlen);
|
2016-12-28 23:34:28 +00:00
|
|
|
int do_set3(int optname, struct _ip_fw3_opheader *op3, size_t optlen);
|
2014-06-14 22:47:25 +00:00
|
|
|
int do_get3(int optname, struct _ip_fw3_opheader *op3, size_t *optlen);
|
2013-11-28 10:28:28 +00:00
|
|
|
|
2009-01-27 11:06:59 +00:00
|
|
|
struct in6_addr;
|
|
|
|
void n2mask(struct in6_addr *mask, int n);
|
2020-07-13 17:51:04 +00:00
|
|
|
int contigmask(const uint8_t *p, int len);
|
2009-01-27 12:01:30 +00:00
|
|
|
|
2009-01-28 11:43:12 +00:00
|
|
|
/*
|
|
|
|
* Forward declarations to avoid include way too many headers.
|
|
|
|
* C does not allow duplicated typedefs, so we use the base struct
|
|
|
|
* that the typedef points to.
|
|
|
|
* Should the typedefs use a different type, the compiler will
|
|
|
|
* still detect the change when compiling the body of the
|
|
|
|
* functions involved, so we do not lose error checking.
|
|
|
|
*/
|
|
|
|
struct _ipfw_insn;
|
2009-02-01 16:00:49 +00:00
|
|
|
struct _ipfw_insn_altq;
|
2009-01-28 11:43:12 +00:00
|
|
|
struct _ipfw_insn_u32;
|
|
|
|
struct _ipfw_insn_ip6;
|
|
|
|
struct _ipfw_insn_icmp6;
|
2009-01-27 10:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The reserved set numer. This is a constant in ip_fw.h
|
|
|
|
* but we store it in a variable so other files do not depend
|
|
|
|
* in that header just for one constant.
|
|
|
|
*/
|
|
|
|
extern int resvd_set_number;
|
|
|
|
|
2009-01-27 12:01:30 +00:00
|
|
|
/* first-level command handlers */
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
void ipfw_add(char *av[]);
|
2009-01-27 10:18:55 +00:00
|
|
|
void ipfw_show_nat(int ac, char **av);
|
2020-03-24 12:27:02 +00:00
|
|
|
int ipfw_delete_nat(int i);
|
2009-01-27 10:18:55 +00:00
|
|
|
void ipfw_config_pipe(int ac, char **av);
|
|
|
|
void ipfw_config_nat(int ac, char **av);
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
void ipfw_sets_handler(char *av[]);
|
2009-01-27 10:18:55 +00:00
|
|
|
void ipfw_table_handler(int ac, char *av[]);
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
void ipfw_sysctl_handler(char *av[], int which);
|
|
|
|
void ipfw_delete(char *av[]);
|
2009-01-27 10:18:55 +00:00
|
|
|
void ipfw_flush(int force);
|
|
|
|
void ipfw_zero(int ac, char *av[], int optname);
|
|
|
|
void ipfw_list(int ac, char *av[], int show_counters);
|
2014-08-03 16:22:14 +00:00
|
|
|
void ipfw_internal_handler(int ac, char *av[]);
|
2019-03-18 11:44:53 +00:00
|
|
|
void ipfw_nat64clat_handler(int ac, char *av[]);
|
2016-08-13 16:09:49 +00:00
|
|
|
void ipfw_nat64lsn_handler(int ac, char *av[]);
|
|
|
|
void ipfw_nat64stl_handler(int ac, char *av[]);
|
2016-07-18 19:46:31 +00:00
|
|
|
void ipfw_nptv6_handler(int ac, char *av[]);
|
2016-04-14 22:51:23 +00:00
|
|
|
int ipfw_check_object_name(const char *name);
|
2018-05-09 11:59:24 +00:00
|
|
|
int ipfw_check_nat64prefix(const struct in6_addr *prefix, int length);
|
2009-01-27 10:18:55 +00:00
|
|
|
|
2014-02-12 09:59:48 +00:00
|
|
|
#ifdef PF
|
2009-02-01 16:00:49 +00:00
|
|
|
/* altq.c */
|
|
|
|
void altq_set_enabled(int enabled);
|
|
|
|
u_int32_t altq_name_to_qid(const char *name);
|
2020-07-13 17:51:04 +00:00
|
|
|
void print_altq_cmd(struct buf_pr *bp, const struct _ipfw_insn_altq *altqptr);
|
2014-02-12 09:59:48 +00:00
|
|
|
#else
|
|
|
|
#define NO_ALTQ
|
|
|
|
#endif
|
2009-02-01 16:00:49 +00:00
|
|
|
|
2009-01-27 12:01:30 +00:00
|
|
|
/* dummynet.c */
|
Bring in the most recent version of ipfw and dummynet, developed
and tested over the past two months in the ipfw3-head branch. This
also happens to be the same code available in the Linux and Windows
ports of ipfw and dummynet.
The major enhancement is a completely restructured version of
dummynet, with support for different packet scheduling algorithms
(loadable at runtime), faster queue/pipe lookup, and a much cleaner
internal architecture and kernel/userland ABI which simplifies
future extensions.
In addition to the existing schedulers (FIFO and WF2Q+), we include
a Deficit Round Robin (DRR or RR for brevity) scheduler, and a new,
very fast version of WF2Q+ called QFQ.
Some test code is also present (in sys/netinet/ipfw/test) that
lets you build and test schedulers in userland.
Also, we have added a compatibility layer that understands requests
from the RELENG_7 and RELENG_8 versions of the /sbin/ipfw binaries,
and replies correctly (at least, it does its best; sometimes you
just cannot tell who sent the request and how to answer).
The compatibility layer should make it possible to MFC this code in a
relatively short time.
Some minor glitches (e.g. handling of ipfw set enable/disable,
and a workaround for a bug in RELENG_7's /sbin/ipfw) will be
fixed with separate commits.
CREDITS:
This work has been partly supported by the ONELAB2 project, and
mostly developed by Riccardo Panicucci and myself.
The code for the qfq scheduler is mostly from Fabio Checconi,
and Marta Carbone and Francesco Magno have helped with testing,
debugging and some bug fixes.
2010-03-02 17:40:48 +00:00
|
|
|
void dummynet_list(int ac, char *av[], int show_counters);
|
|
|
|
void dummynet_flush(void);
|
2009-01-27 11:06:59 +00:00
|
|
|
int ipfw_delete_pipe(int pipe_or_queue, int n);
|
|
|
|
|
2009-01-27 12:01:30 +00:00
|
|
|
/* ipv6.c */
|
2016-04-14 18:22:08 +00:00
|
|
|
void print_unreach6_code(struct buf_pr *bp, uint16_t code);
|
2020-07-13 17:51:04 +00:00
|
|
|
void print_ip6(struct buf_pr *bp, const struct _ipfw_insn_ip6 *cmd);
|
|
|
|
void print_flow6id(struct buf_pr *bp, const struct _ipfw_insn_u32 *cmd);
|
|
|
|
void print_icmp6types(struct buf_pr *bp, const struct _ipfw_insn_u32 *cmd);
|
|
|
|
void print_ext6hdr(struct buf_pr *bp, const struct _ipfw_insn *cmd);
|
2009-01-27 12:01:30 +00:00
|
|
|
|
2016-11-15 07:13:16 +00:00
|
|
|
struct tidx;
|
|
|
|
struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen,
|
|
|
|
struct tidx *tstate);
|
|
|
|
struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen,
|
|
|
|
struct tidx *tstate);
|
2009-01-27 12:01:30 +00:00
|
|
|
|
2013-03-03 14:05:03 +00:00
|
|
|
void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av, int cblen);
|
2009-01-27 12:01:30 +00:00
|
|
|
void fill_unreach6_code(u_short *codep, char *str);
|
2013-03-03 14:05:03 +00:00
|
|
|
void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen);
|
2009-01-28 11:43:12 +00:00
|
|
|
int fill_ext6hdr(struct _ipfw_insn *cmd, char *av);
|
2014-06-28 23:20:24 +00:00
|
|
|
|
2016-07-11 13:41:40 +00:00
|
|
|
/* ipfw2.c */
|
|
|
|
void bp_flush(struct buf_pr *b);
|
2016-11-15 07:13:16 +00:00
|
|
|
void fill_table(struct _ipfw_insn *cmd, char *av, uint8_t opcode,
|
|
|
|
struct tidx *tstate);
|
2016-07-11 13:41:40 +00:00
|
|
|
|
2014-06-28 23:20:24 +00:00
|
|
|
/* tables.c */
|
|
|
|
struct _ipfw_obj_ctlv;
|
2016-08-13 16:09:49 +00:00
|
|
|
struct _ipfw_obj_ntlv;
|
2016-04-14 22:51:23 +00:00
|
|
|
int table_check_name(const char *tablename);
|
2014-08-03 16:22:14 +00:00
|
|
|
void ipfw_list_ta(int ac, char *av[]);
|
Add support for multi-field values inside ipfw tables.
This is the last major change in given branch.
Kernel changes:
* Use 64-bytes structures to hold multi-value variables.
* Use shared array to hold values from all tables (assume
each table algo is capable of holding 32-byte variables).
* Add some placeholders to support per-table value arrays in future.
* Use simple eventhandler-style API to ease the process of adding new
table items. Currently table addition may required multiple UH drops/
acquires which is quite tricky due to atomic table modificatio/swap
support, shared array resize, etc. Deal with it by calling special
notifier capable of rolling back state before actually performing
swap/resize operations. Original operation then restarts itself after
acquiring UH lock.
* Bump all objhash users default values to at least 64
* Fix custom hashing inside objhash.
Userland changes:
* Add support for dumping shared value array via "vlist" internal cmd.
* Some small print/fill_flags dixes to support u32 values.
* valtype is now bitmask of
<skipto|pipe|fib|nat|dscp|tag|divert|netgraph|limit|ipv4|ipv6>.
New values can hold distinct values for each of this types.
* Provide special "legacy" type which assumes all values are the same.
* More helpers/docs following..
Some examples:
3:41 [1] zfscurr0# ipfw table mimimi create valtype skipto,limit,ipv4,ipv6
3:41 [1] zfscurr0# ipfw table mimimi info
+++ table(mimimi), set(0) +++
kindex: 2, type: addr
references: 0, valtype: skipto,limit,ipv4,ipv6
algorithm: addr:radix
items: 0, size: 296
3:42 [1] zfscurr0# ipfw table mimimi add 10.0.0.5 3000,10,10.0.0.1,2a02:978:2::1
added: 10.0.0.5/32 3000,10,10.0.0.1,2a02:978:2::1
3:42 [1] zfscurr0# ipfw table mimimi list
+++ table(mimimi), set(0) +++
10.0.0.5/32 3000,0,10.0.0.1,2a02:978:2::1
2014-08-31 23:51:09 +00:00
|
|
|
void ipfw_list_values(int ac, char *av[]);
|
2016-08-13 16:09:49 +00:00
|
|
|
void table_fill_ntlv(struct _ipfw_obj_ntlv *ntlv, const char *name,
|
|
|
|
uint8_t set, uint16_t uidx);
|
2014-06-28 23:20:24 +00:00
|
|
|
|