Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  4 Oct 2000 02:00:26 -0700 (PDT)
From:      B.Candler@pobox.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/21743: pxeboot ignores NFS server IP address in root-path; libstand tweak
Message-ID:  <20001004090026.3D42737B66C@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         21743
>Category:       i386
>Synopsis:       pxeboot ignores NFS server IP address in root-path; libstand tweak
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 04 02:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Brian Candler
>Release:        4.1.1
>Organization:
>Environment:
>Description:
pxeboot ignores the IP address component of the root-path, i.e.
    options root-path "10.0.0.1:/remoteroot";
                       ^^^^^^^^
and instead uses the DHCP server's IP address and tries to mount that.
Hence it is impossible to have one machine as DHCP/TFTP server and a
different machine as NFS server.

The kernel itself, with 'options BOOTP' and 'options BOOTP_NFSROOT', _does_
honour the NFS server IP address - so it's only a problem with pxeboot.
>How-To-Repeat:
Set up DHCP and TFTP server on 10.0.0.200 with
  next-server 10.0.0.200;
  filename "pxeboot";
  option root-path "10.0.0.1:/os/freebsd-4.1";
Start up a DHCP/PXE machine. It reports:

  pxe_open: server addr: 10.0.0.200         <<< This should be 10.0.0.1
  pxe_open: server path: /os/freebsd-4.1
  pxe_open: gateway ip:  0.0.0.0


>Fix:
--- sys/boot/i386/libi386/pxe.c.orig    Sun Sep 10 02:52:18 2000
+++ sys/boot/i386/libi386/pxe.c Wed Oct  4 09:13:06 2000
@@ -292,6 +292,8 @@
                        if(rootpath[i] == ':')
                                break;
                if(i && i != FNAME_SIZE) {
+                       rootpath[i] = '\0';
+                       rootip.s_addr = inet_addr(&rootpath[0]);
                        i++;
                        bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
                        bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);

However this turns up another problem; there are two versions of
inet_addr, one in libstand/net.o and the other in libstand/inet_addr.o
(the problem being that inet_addr.o comes from libc/inet_addr.c and
references other libc things, so the link fails)

The solution is to remove libstand's reliance on libc, which I guess
is a hangover from olden times:

--- lib/libstand/Makefile.orig  Wed Oct  4 10:42:22 2000
+++ lib/libstand/Makefile       Wed Oct  4 10:44:16 2000
@@ -86,10 +86,6 @@
                ${.ALLSRC} > ${.TARGET}
 .endif
 
-# network support from libc
-.PATH: ${.CURDIR}/../libc/net
-SRCS+= inet_ntoa.c inet_addr.c
-
 # _setjmp/_longjmp
 .PATH: ${.CURDIR}/${MACHINE_ARCH}
 SRCS+= _setjmp.S
@@ -107,7 +103,7 @@
        fstat.c close.c lseek.c open.c read.c write.c readdir.c
 
 # network routines
-SRCS+= arp.c ether.c in_cksum.c net.c udp.c netif.c rpc.c
+SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
 
 # network info services:
 SRCS+= bootp.c rarp.c bootparam.c

However, note that I haven't done a buildworld to check that this
doesn't affect anything else which uses libstand.

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001004090026.3D42737B66C>