On (10/16/07 16:37), Erik Nordmark wrote:
> I have some vague recollection that routing daemons sometimes delete the
> interface routes (that are created as a result of an ipif; the kernel
> doesn't prevent this), and that as a result we needed to be able to
> recreate those interface routes with a route add command. But I think that
> was for non-point2point interfaces. In any case, I just tested and I can't
> add such a route.
I was able to start with a tunnel:
ip.tun0: flags=11008d1<UP,POINTOPOINT,RUNNING, ...>
inet tunnel src ..
tunnel hop limit 60
inet 10.20.10.162 --> 10.20.10.180 netmask fffff
and add
# route add 10.20.10.162 10.20.10.180 -iface
:
# netstat -rnf inet
10.20.10.162 10.20.10.162 UH 1 0 ip.tun0
10.20.10.180 10.20.10.162 UH 1 1 ip.tun0
this seems to be "harmless" for pinging the local end point itself
because (I suspect) we lookup the ire_cache entry for 10.20.10.162
first and so never hit the interface route added by "route add".
>> Along the same lines, are there any subtle reasons why
>> ipif_lookup_addr{_v6} look at the IPIF_UNNUMBERED flag at all?
>> That code could be vastly simplified by just checking for
>> IPIF_POINTOPOINT.
>
> For the unnumbered case we should never compare with ipif_lcl_addr since
> that is by definition assigned to some other ipif, and we want to match
> that ipif.
>
> In any case, there is only one line to check UNNUMBERED, so that isn't the
> root cause of the complexity of the function.
Some background: I ran into this question when I was trying to
coalesce the various duplicated calls of the form:
if (IPIF_CAN_LOOKUP(..)) {
:
} else if IPIF_CAN_WAIT(..) {
:
}
(See CR 6606222)
I was hoping (in the case of ipif_lookup_addr* functions) to eliminate
the 2 loops (first with ptp set to FALSE, second with ptp set to TRUE)
into one loop that tests
if (((ipif->ipif_flags & IPIF_POINTOPOINT) &&
(ipif->ipif_pp_dst_addr == addr)) ||
(!(ipif->ipif_flags & IPIF_POINTOPOINT) &&
(ipif->ipif_lcl_addr == addr)) {
/* return ipif if possible */
}
Would that break something? From cscope examination, it seemed to me
that UNNUMBERED only gets set if POINTOPOINT is set.
--Sowmini
_______________________________________________
networking-discuss mailing list
[email protected]