Index: UPDATING =================================================================== --- UPDATING +++ UPDATING @@ -33,6 +33,11 @@ Users that wish to keep using mfi(4) with such hardware should set it to 0 in loader.conf. +20240617: + ifconfig now treats IPv4 addresses without a width or mask as an error. + Specify the desired mask or width along with the IP address on the + ifconfig command line and in rc.conf. + 20240428: OpenBSM auditing runtime (auditd, etc.) has been moved into the new package FreeBSD-audit. If you use OpenBSM auditing and pkgbase, you Index: sbin/ifconfig/af_inet.c =================================================================== --- sbin/ifconfig/af_inet.c +++ sbin/ifconfig/af_inet.c @@ -436,36 +436,13 @@ return (e.error); } - -static void -in_setdefaultmask_nl(void) -{ - struct in_px *px = sintab_nl[ADDR]; - - in_addr_t i = ntohl(px->addr.s_addr); - - /* - * If netmask isn't supplied, use historical default. - * This is deprecated for interfaces other than loopback - * or point-to-point; warn in other cases. In the future - * we should return an error rather than warning. - */ - if (IN_CLASSA(i)) - px->plen = 32 - IN_CLASSA_NSHIFT; - else if (IN_CLASSB(i)) - px->plen = 32 - IN_CLASSB_NSHIFT; - else - px->plen = 32 - IN_CLASSC_NSHIFT; - px->maskset = true; -} #endif static void -warn_nomask(int ifflags) +err_nomask(int ifflags) { if ((ifflags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) { - warnx("WARNING: setting interface address without mask " - "is deprecated,\ndefault mask may not be correct."); + errx(1, "ERROR: setting interface address without mask is no longer supported."); } } @@ -474,12 +451,11 @@ { #ifdef WITHOUT_NETLINK if (sintab[ADDR]->sin_len != 0 && sintab[MASK]->sin_len == 0 && newaddr) { - warn_nomask(ifflags); + err_nomask(ifflags); } #else if (sintab_nl[ADDR]->addrset && !sintab_nl[ADDR]->maskset && newaddr) { - warn_nomask(ifflags); - in_setdefaultmask_nl(); + err_nomask(ifflags); } #endif }