Makes ifconfig(8) deny non-contiguous netmask.
Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.378
diff -u -p -r1.378 ifconfig.c
--- ifconfig.c 9 Sep 2018 20:32:55 -0000 1.378
+++ ifconfig.c 29 Sep 2018 15:16:04 -0000
@@ -5760,6 +5760,9 @@ in_getaddr(const char *s, int which)
else
errx(1, "%s: bad value", s);
}
+ if (which == MASK && ((~ntohl(sin->sin_addr.s_addr)) &
+ (ntohl(sin->sin_addr.s_addr)+1)) > 1)
+ errx(1, "%s: non-contiguous netmask", s);
}
/* ARGSUSED */