Date: Sun, 8 Jan 2017 22:53:11 +0100 From: Kamil Czekirda <kczekirda@freebsd.org> To: Baptiste Daroussin <bapt@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r311659 - head/lib/libstand Message-ID: <CADSgWNEP%2BYFFsw2Pq%2BsU1F2fBwCMTCkbBeo_eJHKxdq6rOGZ2g@mail.gmail.com> In-Reply-To: <201701072342.v07NgHrk059834@repo.freebsd.org> References: <201701072342.v07NgHrk059834@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks. 2017-01-08 0:42 GMT+01:00 Baptiste Daroussin <bapt@freebsd.org>: > Author: bapt > Date: Sat Jan 7 23:42:17 2017 > New Revision: 311659 > URL: https://svnweb.freebsd.org/changeset/base/311659 > > Log: > 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 > MFC after: 3 weeks > Sponsored by: Oktawave > Differential Revision: https://reviews.freebsd.org/D8740 > > Modified: > head/lib/libstand/bootp.c > > Modified: head/lib/libstand/bootp.c > ============================================================ > ================== > --- head/lib/libstand/bootp.c Sat Jan 7 22:55:23 2017 (r311658) > +++ head/lib/libstand/bootp.c Sat Jan 7 23:42:17 2017 (r311659) > @@ -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; > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADSgWNEP%2BYFFsw2Pq%2BsU1F2fBwCMTCkbBeo_eJHKxdq6rOGZ2g>