Date: Sat, 7 Jan 2017 23:42:37 +0000 From: "bapt (Baptiste Daroussin)" <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] D8740: remove network mask calculation for Classful network Message-ID: <6171846ec62e901d6348e51a28d1396a@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-sr3av7dtearbtprpipym-req@FreeBSD.org> References: <differential-rev-PHID-DREV-sr3av7dtearbtprpipym-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] This revision was automatically updated to reflect the committed changes. Closed by commit rS311659: remove network mask calculation for Classful network (authored by bapt). REPOSITORY rS FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D8740?vs=22858&id=23726 REVISION DETAIL https://reviews.freebsd.org/D8740 AFFECTED FILES head/lib/libstand/bootp.c EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: kczekirda, imp, ian, oshogbo, tsoome, freebsd-net-list, glebius, #network, bapt Cc: glebius [-- Attachment #2 --] diff --git a/head/lib/libstand/bootp.c b/head/lib/libstand/bootp.c --- a/head/lib/libstand/bootp.c +++ b/head/lib/libstand/bootp.c @@ -62,8 +62,6 @@ struct in_addr servip; -static n_long nmask, smask; - static time_t bot; static char vm_rfc1048[4] = VM_RFC1048; @@ -223,30 +221,19 @@ 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 @@ 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 @@ 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6171846ec62e901d6348e51a28d1396a>
