From owner-freebsd-hackers Wed Sep 20 11: 2:22 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from earth.backplane.com (backplane-inc.SanFranciscosfd.cw.net [206.24.214.242]) by hub.freebsd.org (Postfix) with ESMTP id 64E9B37B423; Wed, 20 Sep 2000 11:02:20 -0700 (PDT) Received: (from dillon@localhost) by earth.backplane.com (8.11.0/8.9.3) id e8KI2Fe45459; Wed, 20 Sep 2000 11:02:15 -0700 (PDT) (envelope-from dillon) Date: Wed, 20 Sep 2000 11:02:15 -0700 (PDT) From: Matt Dillon Message-Id: <200009201802.e8KI2Fe45459@earth.backplane.com> To: Paul Saab Cc: Danny Braniss , Mike Smith , freebsd-hackers@FreeBSD.ORG Subject: Re: diskless workstation References: <20000920093025.A53255@elvis.mu.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG A quick review of the code seems to indicate that this is indeed a bug. As far as I can tell, the IN_CLASS*() macros assume host order. e.g. from /usr/include/netinet/in.h: #define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) Since s_addr is in network byte order, the conversion is necessary. If this fixes Danny's problems, and doesn't break anyone else (Paul?), I'd say it should be committed. -Matt :Umm.. I'm using the netboot just fine here for the ports cluster and :it is using the code in the tree w/ zero modifications. It boots via :nfs and comes up with ip, netmask, and gateway. : :paul : :Danny Braniss (danny@cs.huji.ac.il) wrote: :> bug report: :> in lib/libstand/bootp.c: :> :> if (IN_CLASSA(myip.s_addr)) :> nmask = htonl(IN_CLASSA_NET); :> else if (IN_CLASSB(myip.s_addr)) :> nmask = htonl(IN_CLASSB_NET); :> else :> nmask = htonl(IN_CLASSC_NET); :> should be: :> :> 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); :> :> which explains why gateway was zero, even if it was provided by dhcp. :> it also explains why it hung trying to mount via nfs. :> :> danny To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message