diff options
author | luigi <luigi@FreeBSD.org> | 2010-03-15 15:43:35 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2010-03-15 15:43:35 +0000 |
commit | 3a68724891acc310ddc8fbf436121e9727dcee70 (patch) | |
tree | 783e7f0d88b0ec853bb4aed62579d513735ebb82 /sbin | |
parent | 8a3325736a863dcc8563cc5c49df082b9692f15d (diff) | |
download | FreeBSD-src-3a68724891acc310ddc8fbf436121e9727dcee70.zip FreeBSD-src-3a68724891acc310ddc8fbf436121e9727dcee70.tar.gz |
Implement "lookup dscp N" which does a lookup of the DSCP (top 6 bits
of ip->ip_tos) in a table. This can be useful to direct traffic to
different pipes/queues according to the DSCP of the packet, as follows:
ipfw add 100 queue tablearg lookup dscp 3 // table 3 maps dscp->queue
This change is a no-op (but harmless) until the two-line kernel
side is committed, which will happen shortly.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 5 | ||||
-rw-r--r-- | sbin/ipfw/ipfw2.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 27c6b0a..7940e54 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -231,7 +231,7 @@ static struct _s_x rule_action_params[] = { */ static int lookup_key[] = { TOK_DSTIP, TOK_SRCIP, TOK_DSTPORT, TOK_SRCPORT, - TOK_UID, TOK_JAIL, -1 }; + TOK_UID, TOK_JAIL, TOK_DSCP, -1 }; static struct _s_x rule_options[] = { { "tagged", TOK_TAGGED }, @@ -258,6 +258,7 @@ static struct _s_x rule_options[] = { { "iplen", TOK_IPLEN }, { "ipid", TOK_IPID }, { "ipprecedence", TOK_IPPRECEDENCE }, + { "dscp", TOK_DSCP }, { "iptos", TOK_IPTOS }, { "ipttl", TOK_IPTTL }, { "ipversion", TOK_IPVER }, @@ -3519,7 +3520,7 @@ read_options: char *p; int j; - if (av[0] && av[1]) + if (!av[0] || !av[1]) errx(EX_USAGE, "format: lookup argument tablenum"); cmd->opcode = O_IP_DST_LOOKUP; cmd->len |= F_INSN_SIZE(ipfw_insn) + 2; diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 1dbb42b..d172984 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -125,6 +125,7 @@ enum tokens { TOK_IPLEN, TOK_IPID, TOK_IPPRECEDENCE, + TOK_DSCP, TOK_IPTOS, TOK_IPTTL, TOK_IPVER, |