summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-10 15:35:47 -0200
committerRenato Westphal <renato@opensourcerouting.org>2016-11-25 11:46:06 -0200
commitb10ce841035275844cfe494d471865c8a1d4dda6 (patch)
tree9a546e1091ffefe8e0cc07192daf888771aa7045 /lib/if.c
parent6aec4b41760e6ba54fc52b09f6d3ecfe173f6ee6 (diff)
ripd: fix the "neighbor" command.
We can't use if_lookup_prefix() in rip_update_process() because this function uses prefix_cmp() internally to try matching an interface address to a static neighbor's address. Since prefix_cmp() tries to match exact prefixes, if_lookup_prefix() was always returning NULL. What we really need here is to use prefix_match(), which checks if one prefix includes the other (e.g. one /24 interface including a /32 static neighbor's address). The fix then is to replace the call to if_lookup_prefix() and use if_lookup_address() instead, which uses prefix_match() internally. Fixes IxANVL RIP test 17.1 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/if.c b/lib/if.c
index 6ae8500291..b52358fa87 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -393,7 +393,7 @@ if_lookup_exact_address (void *src, int family)
}
/* Lookup interface by IPv4 address. */
-struct interface *
+struct connected *
if_lookup_address_vrf (void *matchaddr, int family, vrf_id_t vrf_id)
{
struct listnode *node;
@@ -402,7 +402,7 @@ if_lookup_address_vrf (void *matchaddr, int family, vrf_id_t vrf_id)
struct listnode *cnode;
struct interface *ifp;
struct connected *c;
- struct interface *match;
+ struct connected *match;
if (family == AF_INET)
{
@@ -428,14 +428,14 @@ if_lookup_address_vrf (void *matchaddr, int family, vrf_id_t vrf_id)
(c->address->prefixlen > bestlen))
{
bestlen = c->address->prefixlen;
- match = ifp;
+ match = c;
}
}
}
return match;
}
-struct interface *
+struct connected *
if_lookup_address (void *matchaddr, int family)
{
return if_lookup_address_vrf (matchaddr, family, VRF_DEFAULT);