Subject: Re: SO_DONTROUTE clashes with arpresolve(9)
To: None <tech-net@netbsd.org>
From: David Young <dyoung@ojctech.com>
List: tech-net
Date: 11/21/2002 00:47:24
On Tue, Nov 19, 2002 at 09:39:18PM -0600, David Young wrote:
> 
> arpresolve(9) negates the effect I expect from SO_DONTROUTE when I try
> to send a packet to a host with a non-local route. E.g.,
> 

Is this an acceptable solution?

1 Add a new mbuf flag, M_DONTROUTE.

2 In ip_output, set flag M_DONTROUTE on every mbuf sent with option
  IP_ROUTETOIF.

3 In arplookup, if its mbuf argument is flagged M_DONTROUTE, the
  nexthop route is an IPv4 gateway, and RTF_LLINFO is not set, then
  set the route's RTF_LLINFO flag.  Create a special llinfo_arp with a
  sockaddr at its end. Attach the llinfo_arp to the route, and return
  the llinfo_arp.

4 In arplookup, if the mbuf is flagged M_DONTROUTE, and its nexthop
  is an IPv4 route with both RTF_GATEWAY and RTF_LLINFO set, then return
  the llinfo_arp attached to it.

5 In arpresolve, if both flags RTF_GATEWAY and RTF_LLINFO are set,
  then examine the sockaddr in rt_llinfo instead of the sockaddr
  rt_gateway for ARP info.

Because Token Ring users have heretofore not been affected by this bug,
I guess, I will not address Token Ring in my fix. Ok?

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Engineering from the Right Brain
                        Urbana, IL * (217) 278-3933