Fix ipfw2 panics on 64-bit platforms.

Quoting luigi:

In order to make the userland code fully 64-bit clean it may
be necessary to commit other changes that may or may not cause
a minor change in the ABI.

Reviewed by:	luigi
This commit is contained in:
Maxime Henrion 2002-10-24 18:04:44 +00:00
parent 18f13da2be
commit 7c697970f4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105887
2 changed files with 7 additions and 11 deletions

View File

@ -811,7 +811,7 @@ show_ipfw(struct ip_fw *rule)
ipfw_insn_log *logptr = NULL; /* set if we find an O_LOG */
int or_block = 0; /* we are in an or block */
u_int32_t set_disable = (u_int32_t)(rule->next_rule);
u_int32_t set_disable = rule->set_disable;
if (set_disable & (1 << rule->set)) { /* disabled */
if (!show_sets)
@ -1198,7 +1198,7 @@ show_dyn_ipfw(ipfw_dyn_rule *d)
}
printf("%05d %10qu %10qu (%ds)",
(int)(d->rule), d->pcnt, d->bcnt, d->expire);
d->rulenum, d->pcnt, d->bcnt, d->expire);
switch (d->dyn_type) {
case O_LIMIT_PARENT:
printf(" PARENT %d", d->count);
@ -1432,7 +1432,7 @@ sets_handler(int ac, char *av[])
err(EX_OSERR, "malloc");
if (getsockopt(s, IPPROTO_IP, IP_FW_GET, data, &nbytes) < 0)
err(EX_OSERR, "getsockopt(IP_FW_GET)");
set_disable = (u_int32_t)(((struct ip_fw *)data)->next_rule);
set_disable = ((struct ip_fw *)data)->set_disable;
for (i = 0, msg = "disable" ; i < 31; i++)
if ( (set_disable & (1<<i))) {
@ -1618,9 +1618,9 @@ list(int ac, char *av[])
/* already warned */
continue;
for (n = 0, d = dynrules; n < ndyn; n++, d++) {
if ((int)(d->rule) > rnum)
if (d->rulenum > rnum)
break;
if ((int)(d->rule) == rnum)
if (d->rulenum == rnum)
show_dyn_ipfw(d);
}
}

View File

@ -2501,11 +2501,7 @@ ipfw_ctl(struct sockopt *sopt)
for (rule = layer3_chain; rule ; rule = rule->next) {
int i = RULESIZE(rule);
bcopy(rule, bp, i);
/*
* abuse 'next_rule' to store the set_disable word
*/
(u_int32_t)(((struct ip_fw *)bp)->next_rule) =
set_disable;
((struct ip_fw *)bp)->set_disable = set_disable;
bp = (struct ip_fw *)((char *)bp + i);
}
if (ipfw_dyn_v) {
@ -2517,7 +2513,7 @@ ipfw_ctl(struct sockopt *sopt)
for ( p = ipfw_dyn_v[i] ; p != NULL ;
p = p->next, dst++ ) {
bcopy(p, dst, sizeof *p);
(int)dst->rule = p->rule->rulenum ;
dst->rulenum = p->rule->rulenum;
/*
* store a non-null value in "next".
* The userland code will interpret a