Page MenuHomeFreeBSD

D32951.id.diff
No OneTemporary

D32951.id.diff

diff --git a/sys/netinet/in.c b/sys/netinet/in.c
--- 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 @@
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;
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -42,6 +42,8 @@
* $NetBSD: krpc_subr.c,v 1.10 1995/08/08 20:43:43 gwr Exp $
*/
+#define IN_HISTORICAL_NETS /* include class masks */
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -1486,11 +1488,16 @@
if (ifctx->gotnetmask == 0) {
/*
- * If there is no netmask, use a default, but we really
- * need the right mask from the server.
+ * If there is no netmask, use historical default,
+ * but we really need the right mask from the server.
*/
printf("%s: no netmask received!\n", ifctx->ireq.ifr_name);
- ifctx->netmask.sin_addr.s_addr = htonl(IN_NETMASK_DEFAULT);
+ if (IN_CLASSA(ntohl(ifctx->myaddr.sin_addr.s_addr)))
+ ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSA_NET);
+ else if (IN_CLASSB(ntohl(ifctx->myaddr.sin_addr.s_addr)))
+ ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSB_NET);
+ else
+ ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSC_NET);
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 5, 7:17 PM (35 m, 20 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33762263
Default Alt Text
D32951.id.diff (2 KB)

Event Timeline