diff options
| author | Mike Karels <karels@FreeBSD.org> | 2021-11-10 21:35:33 +0000 |
|---|---|---|
| committer | Mike Karels <karels@FreeBSD.org> | 2021-11-14 20:12:25 +0000 |
| commit | 2f35e7d9fa03f27543f347cd6277af5bfc6a7e95 (patch) | |
| tree | e4b1953e9634f8e94cee5204330823879837afba /sys/netinet/in.c | |
| parent | 6b96bb739548a8b8c2b13bd46234f70a29be12fb (diff) | |
Diffstat (limited to 'sys/netinet/in.c')
| -rw-r--r-- | sys/netinet/in.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index fccad3d9ede2..70fbe32c05ac 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -35,6 +35,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#define IN_HISTORICAL_NETS /* include class masks */ + #include <sys/param.h> #include <sys/eventhandler.h> #include <sys/systm.h> @@ -467,17 +469,24 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) ia->ia_sockmask = *mask; ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr); } else { + in_addr_t i = ntohl(addr->sin_addr.s_addr); + /* - * If netmask isn't supplied, use default for now. + * 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 ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) - printf("%s: set address: WARNING: network mask" - " should be specified; using default mask\n", + printf("%s: set address: WARNING: network mask " + "should be specified; using historical default\n", ifp->if_xname); - ia->ia_subnetmask = IN_NETMASK_DEFAULT; + if (IN_CLASSA(i)) + ia->ia_subnetmask = IN_CLASSA_NET; + else if (IN_CLASSB(i)) + ia->ia_subnetmask = IN_CLASSB_NET; + else + ia->ia_subnetmask = IN_CLASSC_NET; ia->ia_sockmask.sin_addr.s_addr = htonl(ia->ia_subnetmask); } ia->ia_subnet = ntohl(addr->sin_addr.s_addr) & ia->ia_subnetmask; |
