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.
This commit is contained in:
Luigi Rizzo 2010-03-15 15:43:35 +00:00
parent 6eafba267e
commit 72662a7566
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205169
2 changed files with 4 additions and 2 deletions

View File

@ -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 @@ ipfw_add(char *av[])
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;

View File

@ -125,6 +125,7 @@ enum tokens {
TOK_IPLEN,
TOK_IPID,
TOK_IPPRECEDENCE,
TOK_DSCP,
TOK_IPTOS,
TOK_IPTTL,
TOK_IPVER,