Subject: Re: Cobalt kernel with ramdisk? (fwd)
To: Andrew Gillham <gillhaa@ghost.whirlpool.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-net
Date: 04/05/2000 18:43:20
On Mon, Apr 03, 2000 at 06:32:41PM -0400, Andrew Gillham wrote:

 > Hi Jason,
 > 
 > As you seem to be one of the resident TCP/IP gurus, I thought I would forward
 > this message to you.  Do you think ip_output() should set ip_ttl to IPDEFTTL?
 > Or should it somehow check to see if it is a BOOTP/DHCP packet and set the
 > TTL then?  I understand the assumption that when bypassing the routing table
 > the destination must be on the local segment, but is that doesn't appear to
 > be valid for _all_ uses of SO_DONTROUTE.
 > 
 > Thanks for any help! 

Sorry it's taken me a couple of days to get back to you... This week has
been a little hectic (already! :-)

So, the whole point of SO_DONTROUTE is to send it to the "right network"
immediately.  It's *intended* that the packet not be forwarded.  That is
why the TTL gets set to 1; it guarantees that an IP gateway will not
forward the packet to another network.  If the network specified in the
destination address is not directly attached to the machine, the
transmission fails.

Perhaps I'm missing something in your configuration, here (since I didn't
see any of the messages on this thread until this one was forwarded to me),
but if your DHCP server is on the same IP subnet as your DHCP client, all
should be fine.  If you need to forward the request to a DHCP server on
another IP subnet, use a DHCP gateway program.  NetBSD includes both a
DHCP relay (dhcrelay) and a BOOTP relay (bootpgw).

If you think about it, it would be quite a goof to blindly forward
a packet from 0.0.0.0 to 255.255.255.255 to another IP subnet.  And
I would say that the Linux-based firmware on the Cobalt is QUITE WRONG
to tell the IP gateway on the network that doing so would be Just Fine.

 > 
 > -Andrew 
 > 
 > ----- Forwarded message from Andrew Gillham -----
 > 
 > >From port-cobalt-owner-gillhaa=ghost.whirlpool.com@netbsd.org Mon Apr  3 18:14:59 2000
 > From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
 > Message-Id: <200004032214.SAA18276@ghost.whirlpool.com>
 > Subject: Re: Cobalt kernel with ramdisk?
 > In-Reply-To: <20000403231200.B6895@gnyf.wheel.dk> from "Soren S. Jorvang" at "Apr 3, 2000 11:12:00 pm"
 > To: soren@wheel.dk (Soren S. Jorvang)
 > Date: Mon, 3 Apr 2000 18:14:49 -0400 (EDT)
 > Cc: port-cobalt@netbsd.org
 > X-Mailer: ELM [version 2.4ME+ PL54 (25)]
 > Sender: port-cobalt-owner@netbsd.org
 > Precedence: list
 > Delivered-To: port-cobalt@netbsd.org
 > 
 > Soren S. Jorvang writes:
 > > On Mon, Apr 03, 2000 at 04:50:55PM -0400, Andrew Gillham wrote:
 > > > For some reason I can't get a NFS root to work correctly.  I can load
 > > > the kernel ok, but then it times out on the DHCP.  So apparently the
 > > > firmware can DHCP, but NetBSD can't.  I did see a couple of 'tlp' related
 > > > commits recently, but I'm assuming your latest kernel has them.  Using
 > > > tcpdump, I don't seen any packets from NetBSD during the DHCP attempt.
 > > 
 > > Hmm. Could you send me the kernel output?
 > 
 > Ok, I think the problem is that NetBSD is apparently setting TTL to '1' on
 > the bootp packet.
 > I used tcpdump on a host on the same segment, and here is the successful
 > packet:
 > 17:49:40.015931 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0x66c64f51 secs:5 [|bootp]
 > 
 > Unsuccessful packet:
 > 17:50:10.820071 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0x1ffffff [|bootp] [ttl 1]
 > 
 > Apparently nfs_bootdhcp.c sets "SO_DONTROUTE", which causes ip_output.c
 > to do this: (or am I missing something?)
 >         /*
 >          * If routing to interface only,
 >          * short circuit routing lookup.
 >          */
 >         if (flags & IP_ROUTETOIF) {
 >                 if ((ia = ifatoia(ifa_ifwithladdr(sintosa(dst)))) == 0) {
 >                         ipstat.ips_noroute++;
 >                         error = ENETUNREACH;
 >                         goto bad;
 >                 }
 >                 ifp = ia->ia_ifp;
 >                 mtu = ifp->if_mtu;
 >                 ip->ip_ttl = 1;
 >                 ^^^^^^^^^^^^^^
 > 
 > So, it looks like BOOTP/DHCP packets end up with a TTL of 1, which IMHO
 > is wrong.  
 > 
 > Any ideas on the correct fix?
 > 
 > -Andrew
 > -- 
 > -----------------------------------------------------------------
 > Andrew Gillham                            | NetBSD ist Affengeil.
 > gillham@whirlpool.com                     | Nachts ist es kaelter
 > I speak for myself, not for my employer.  | als draussen.
 > 
 > ----- End of forwarded message from Andrew Gillham -----
 > 
 > -- 
 > -----------------------------------------------------------------
 > Andrew Gillham                            | NetBSD ist Affengeil.
 > gillham@whirlpool.com                     | Nachts ist es kaelter
 > I speak for myself, not for my employer.  | als draussen.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>