Subject: Re: Interface specification in route(8)
To: Lucio de Re <lucio@proxima.alt.za>
From: Massa.Hatanaka <hatanaka@open.nm.fujitsu.co.jp>
List: tech-net
Date: 02/23/1999 09:27:07
Lucio de Re wrote:
> Destination Gateway Flags Refs Use Mtu Interface
> default 192.168.30.17 UGS 0 0 - ppp0
I think the following:
route_output() net/rtsock.c
rtrequest(,0.0.0.0,192.168.30.17,,,) net/route.c
ifa_ifwithroute(RTF_GATEWAY,0.0.0.0,192.168.30.17) net/route.c
ifa_ifwithdstaddr(192.168.30.17) = 0 net/if.c
ifa_ifwithnet(192.168.30.17) net/if.c
Maybe, ifa_ifwithnet() returns ifa with ppp0.
For example, ifa_ifwithnet() in FreeBSD does not match the address
using netmask. Therefore, the ifa_ifwithnet() will find "ne1".
It has an exact match only for point-to-point interface:
=== FreeBSD ifa_ifwithnet() ===
for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) {
for (ifa = ifp->if_addrhead.tqh_first; ifa;
ifa = ifa->ifa_link.tqe_next) {
register char *cp, *cp2, *cp3;
if (ifa->ifa_addr->sa_family != af)
next: continue;
! if (ifp->if_flags & IFF_POINTOPOINT) {
! /*
! * This is a bit broken as it doesn't
! * take into account that the remote end may
! * be a single node in the network we are
! * looking for.
! * The trouble is that we don't know the
! * netmask for the remote end.
! */
! if (ifa->ifa_dstaddr != 0
! && equal(addr, ifa->ifa_dstaddr))
! return (ifa);
! } else {
....
! }
}
}
return (ifa_maybe);
P.S.
Ignatios Souvatzis:
> There is your problem.
>
> Our (or any BSD) kernel doesn't support multiple equal routes in-kernel, as
> far as I understand. You want to remove the ppp0 route to make it find the ne1
> one.
This is an UNNUMBERED (point-to-point) interface.
===
Massa. Hatanaka Fujitsu Limited, Japan
E-Mail: hatanaka@open.nm.fujitsu.co.jp