summaryrefslogtreecommitdiffstats
path: root/lib/if.c
diff options
context:
space:
mode:
authorpaul <paul>2003-09-29 19:54:53 +0000
committerpaul <paul>2003-09-29 19:54:53 +0000
commit31a476c7e9014aa81dc0d50b4100431ab111bf3f (patch)
tree3f7fd8ed9010917cb3e93389d4e1d5a9649c5741 /lib/if.c
parentf3e05cda2a35abe1bcd9e3ad33083f4c78c0235a (diff)
downloadquagga-31a476c7e9014aa81dc0d50b4100431ab111bf3f.tar.bz2
quagga-31a476c7e9014aa81dc0d50b4100431ab111bf3f.tar.xz
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
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/if.c b/lib/if.c
index 68e6e4a0..524869b9 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -245,13 +245,11 @@ if_lookup_address (struct in_addr src)
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 @@ if_lookup_address (struct in_addr src)
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;
+ }
}
}
}