summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-08-12 21:07:57 +0000
committerdim <dim@FreeBSD.org>2015-08-12 21:07:57 +0000
commit06a3ccc4849881b77d332f022c58c3ac0df7e669 (patch)
treebb3451e2ea1f70372c8364f64338d9f408b842f2 /sbin/ipfw
parente0651881704df238dfc803e134962b3295655d3a (diff)
downloadFreeBSD-src-06a3ccc4849881b77d332f022c58c3ac0df7e669.zip
FreeBSD-src-06a3ccc4849881b77d332f022c58c3ac0df7e669.tar.gz
In ipfw2, avoid left-shifting negative integers, which is undefined.
While here, make some other arguments to htonl(3) unsigned too. MFC after: 3 days
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 5dea974..9669dc6 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -2869,14 +2869,14 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int cblen, struct tidx *tstate)
case '/':
masklen = atoi(p);
if (masklen == 0)
- d[1] = htonl(0); /* mask */
+ d[1] = htonl(0U); /* mask */
else if (masklen > 32)
errx(EX_DATAERR, "bad width ``%s''", p);
else
- d[1] = htonl(~0 << (32 - masklen));
+ d[1] = htonl(~0U << (32 - masklen));
break;
case '{': /* no mask, assume /24 and put back the '{' */
- d[1] = htonl(~0 << (32 - 24));
+ d[1] = htonl(~0U << (32 - 24));
*(--p) = md;
break;
@@ -2885,7 +2885,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int cblen, struct tidx *tstate)
/* FALLTHROUGH */
case 0: /* initialization value */
default:
- d[1] = htonl(~0); /* force /32 */
+ d[1] = htonl(~0U); /* force /32 */
break;
}
d[0] &= d[1]; /* mask base address with mask */
OpenPOWER on IntegriCloud