Rework the previous diff. Thanks to job@ who noticed that it failed in some
cases.
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 - 1.378
+++ ifconfig.c 30 Sep 2018 07:42:26 -
@@ -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)))
+ errx(1, "%s: non-contiguous mask", s);
}
/* ARGSUSED */