summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-08-13 12:04:45 +0000
committermelifaro <melifaro@FreeBSD.org>2014-08-13 12:04:45 +0000
commit21ceaa3a9fee4ff9b5d6a289bd62fc9733c50419 (patch)
tree648787014f1cdeff133d5ec0937284196eca0fc1 /sbin/ipfw
parent2bb7ccb159b53c7999065ca55b2fa8eb95061663 (diff)
downloadFreeBSD-src-21ceaa3a9fee4ff9b5d6a289bd62fc9733c50419.zip
FreeBSD-src-21ceaa3a9fee4ff9b5d6a289bd62fc9733c50419.tar.gz
* Pass proper table set numbers from userland side.
* Ignore them, but honor V_fw_tables_sets value on kernel side.
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index f09375f..deb7522 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -2711,10 +2711,11 @@ struct tidx {
uint32_t count;
uint32_t size;
uint16_t counter;
+ uint8_t set;
};
static uint16_t
-pack_table(struct tidx *tstate, char *name, uint32_t set)
+pack_table(struct tidx *tstate, char *name)
{
int i;
ipfw_obj_ntlv *ntlv;
@@ -2725,7 +2726,7 @@ pack_table(struct tidx *tstate, char *name, uint32_t set)
for (i = 0; i < tstate->count; i++) {
if (strcmp(tstate->idx[i].name, name) != 0)
continue;
- if (tstate->idx[i].set != set)
+ if (tstate->idx[i].set != tstate->set)
continue;
return (tstate->idx[i].idx);
@@ -2744,7 +2745,7 @@ pack_table(struct tidx *tstate, char *name, uint32_t set)
strlcpy(ntlv->name, name, sizeof(ntlv->name));
ntlv->head.type = IPFW_TLV_TBL_NAME;
ntlv->head.length = sizeof(ipfw_obj_ntlv);
- ntlv->set = set;
+ ntlv->set = tstate->set;
ntlv->idx = ++tstate->counter;
tstate->count++;
@@ -2765,7 +2766,7 @@ fill_table(ipfw_insn *cmd, char *av, uint8_t opcode, struct tidx *tstate)
if (p)
*p++ = '\0';
- if ((uidx = pack_table(tstate, av + 6, 0)) == 0)
+ if ((uidx = pack_table(tstate, av + 6)) == 0)
errx(EX_DATAERR, "Invalid table name: %s", av + 6);
cmd->opcode = opcode;
@@ -3091,7 +3092,7 @@ fill_iface(ipfw_insn_if *cmd, char *arg, int cblen, struct tidx *tstate)
p = strchr(arg + 6, ',');
if (p)
*p++ = '\0';
- if ((uidx = pack_table(tstate, arg + 6, 0)) == 0)
+ if ((uidx = pack_table(tstate, arg + 6)) == 0)
errx(EX_DATAERR, "Invalid table name: %s", arg + 6);
cmd->name[0] = '\1'; /* Special value indicating table */
@@ -3494,6 +3495,7 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate)
if (set < 0 || set > RESVD_SET)
errx(EX_DATAERR, "illegal set %s", av[1]);
rule->set = set;
+ tstate->set = set;
av += 2;
}
@@ -4496,7 +4498,7 @@ read_options:
__PAST_END(c->d, 1) = j; // i converted to option
av++;
- if ((j = pack_table(tstate, *av, 0)) == 0)
+ if ((j = pack_table(tstate, *av)) == 0)
errx(EX_DATAERR, "Invalid table name: %s", *av);
cmd->arg1 = j;
OpenPOWER on IntegriCloud