Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 May 1995 08:16:57 +0800 (WST)
From:      Peter Wemm <peter@haywire.dialix.com>
To:        hackers@FreeBSD.org
Subject:   Re: The sledge-hammer approach seems to work.. :-) (ppp routing etc)
Message-ID:  <Pine.SV4.3.91.950520074933.25016A-100000@haywire.DIALix.COM>
In-Reply-To: <199505192250.PAA06133@ref.tfs.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, this is what seems to do the trick...
The patch is to net/if.c:ifa_ifwithnet(), the last sup to -current being 
about 30 hours ago.

*** if.c.dist	Fri Feb 24 23:19:07 1995
--- if.c	Sat May 20 07:44:24 1995
***************
*** 240,246 ****
--- 240,255 ----
  		if (ifa->ifa_addr->sa_family != af || ifa->ifa_netmask == 0)
  			next: continue;
  		cp = addr_data;
+ #define FIX1
+ #ifdef FIX1
+ 		if (ifp->if_flags & IFF_POINTOPOINT) {
+ 			cp2 = ifa->ifa_dstaddr->sa_data;
+ 		} else {
+ 			cp2 = ifa->ifa_addr->sa_data;
+ 		}
+ #else
  		cp2 = ifa->ifa_addr->sa_data;
+ #endif /* FIX1 */
  		cp3 = ifa->ifa_netmask->sa_data;
  		cplim = ifa->ifa_netmask->sa_len + (char *)ifa->ifa_netmask;
  		while (cp3 < cplim)

I've had a look at all the places that ifa_ifwithnet() is called, and I 
dont _think_ it's going to have any side effects other than good ones.

Note that the original code is applying the netmask to the local address 
instead of the remote address, which is definately wrong...

My limited understanding makes me suspect that when the interface is 
being looked up for the broadcast transmission, this is falsely matching 
on the local end of ppp/slip links.

I'd be interested to know if it fixes anybody else's problems with 
ppp/ethernet conflicts.

Also, note that there are other places in the interface selection and
ifaddr selection code that do similar (IMHO)incorrect things, which will
probably cause adding aliases to P2P links to do strange things as well.
(I'm thinking of ifaof_ifpforaddr() in if.c in particular)

As to why SO_REUSEADDR has any effect, I am none the wiser at this 
stage.

Cheers,
-Peter




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.91.950520074933.25016A-100000>