summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2017-01-28 17:37:51 +0000
committerbapt <bapt@FreeBSD.org>2017-01-28 17:37:51 +0000
commite98f2965168b94625c3f81a98692f2b6ab8d6d2d (patch)
tree7b7761d9d146a216a52109cc0934de62d1b58473 /lib
parente4632580321a32da8868f0307f9284dbef33f906 (diff)
downloadFreeBSD-src-e98f2965168b94625c3f81a98692f2b6ab8d6d2d.zip
FreeBSD-src-e98f2965168b94625c3f81a98692f2b6ab8d6d2d.tar.gz
MFC r311659:
remove network mask calculation for Classful network Nowadays it's not necessary to compute network mask from the IP address and compare to given by DHCP. Submitted by: kczekirda Reviewed by: glebius, bapt Sponsored by: Oktawave MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D8740
Diffstat (limited to 'lib')
-rw-r--r--lib/libstand/bootp.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 0c48748..0bd37b1 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$");
struct in_addr servip;
-static n_long nmask, smask;
-
static time_t bot;
static char vm_rfc1048[4] = VM_RFC1048;
@@ -223,30 +221,19 @@ bootp(sock, flag)
bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile));
bootfile[sizeof(bootfile) - 1] = '\0';
- if (IN_CLASSA(ntohl(myip.s_addr)))
- nmask = htonl(IN_CLASSA_NET);
- else if (IN_CLASSB(ntohl(myip.s_addr)))
- nmask = htonl(IN_CLASSB_NET);
- else
- nmask = htonl(IN_CLASSC_NET);
-#ifdef BOOTP_DEBUG
- if (debug)
- printf("'native netmask' is %s\n", intoa(nmask));
-#endif
-
- /* Check subnet mask against net mask; toss if bogus */
- if ((nmask & smask) != nmask) {
+ if (!netmask) {
+ if (IN_CLASSA(ntohl(myip.s_addr)))
+ netmask = htonl(IN_CLASSA_NET);
+ else if (IN_CLASSB(ntohl(myip.s_addr)))
+ netmask = htonl(IN_CLASSB_NET);
+ else
+ netmask = htonl(IN_CLASSC_NET);
#ifdef BOOTP_DEBUG
if (debug)
- printf("subnet mask (%s) bad\n", intoa(smask));
+ printf("'native netmask' is %s\n", intoa(netmask));
#endif
- smask = 0;
}
- /* Get subnet (or natural net) mask */
- netmask = nmask;
- if (smask)
- netmask = smask;
#ifdef BOOTP_DEBUG
if (debug)
printf("mask: %s\n", intoa(netmask));
@@ -385,7 +372,7 @@ vend_rfc1048(cp, len)
break;
if (tag == TAG_SUBNET_MASK) {
- bcopy(cp, &smask, sizeof(smask));
+ bcopy(cp, &netmask, sizeof(netmask));
}
if (tag == TAG_GATEWAY) {
bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr));
@@ -445,7 +432,7 @@ vend_cmu(cp)
vp = (struct cmu_vend *)cp;
if (vp->v_smask.s_addr != 0) {
- smask = vp->v_smask.s_addr;
+ netmask = vp->v_smask.s_addr;
}
if (vp->v_dgate.s_addr != 0) {
gateip = vp->v_dgate;
OpenPOWER on IntegriCloud