2003-09-29 Paul Jakma <paul@dishone.st>
* zebra/connected.c: revert the 'generic PtP' patch as it causes
far too many problems. People who use FreeSWAN should investigate
native linux ipsec.
* zebra/rt_netlink.c: ditto
* lib/if.c: ditto
* ripd/ripd.h: ditto
* ripd/ripd.c: ditto
* ripd/rip_interface.c: ditto
* ospfd/ospfd.c: ditto
* ospfd/ospf_snmp.c: ditto
* bgpd/bgp_nexthop.c: ditto
diff --git a/lib/if.c b/lib/if.c
index 68e6e4a..524869b 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -245,13 +245,11 @@
listnode node;
struct prefix addr;
struct prefix best;
- struct prefix peer;
listnode cnode;
struct interface *ifp;
struct prefix *p;
struct connected *c;
struct interface *match;
- int prefixlen;
/* Zero structures - get rid of rubbish from stack */
memset(&addr, 0, sizeof(addr));
@@ -270,24 +268,34 @@
for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
{
c = getdata (cnode);
- p = c->address;
- if (p->family == AF_INET)
+ if (if_is_pointopoint (ifp))
{
- prefixlen = p->prefixlen;
+ p = c->address;
- if (if_is_pointopoint (ifp) ||
- prefixlen >= IPV4_MAX_PREFIXLEN - 1)
+ if (p && p->family == AF_INET)
{
- peer = *c->destination;
- peer.prefixlen = prefixlen;
- p = &peer;
+#ifdef OLD_RIB /* PTP links are conventionally identified
+ by the address of the far end - MAG */
+ if (IPV4_ADDR_SAME (&p->u.prefix4, &src))
+ return ifp;
+#endif
+ p = c->destination;
+ if (p && IPV4_ADDR_SAME (&p->u.prefix4, &src))
+ return ifp;
}
+ }
+ else
+ {
+ p = c->address;
- if (prefix_match (p, &addr) && prefixlen > best.prefixlen)
+ if (p->family == AF_INET)
{
- best = *p;
- match = ifp;
+ if (prefix_match (p, &addr) && p->prefixlen > best.prefixlen)
+ {
+ best = *p;
+ match = ifp;
+ }
}
}
}