summaryrefslogtreecommitdiffstats
path: root/lib/if.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2014-03-18 17:04:25 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2014-03-18 17:04:25 +0100
commite708ed69aa0b993527f48b1f31b645c00750927f (patch)
tree8f33d73b2a85b51c042318d58a1750eeb8019616 /lib/if.c
parenta11e012e8661629d665e992e765741a5eaa7d017 (diff)
parent424cc3bd48da0f417c9056c5c2ade697a3386cd4 (diff)
downloadquagga-e708ed69aa0b993527f48b1f31b645c00750927f.tar.bz2
quagga-e708ed69aa0b993527f48b1f31b645c00750927f.tar.xz
Merge volatile/cumulus_ospf6d
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index e26aa046..6348403b 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -304,6 +304,30 @@ if_lookup_address (struct in_addr src)
return match;
}
+/* Lookup interface by prefix */
+struct interface *
+if_lookup_prefix (struct prefix *prefix)
+{
+ struct listnode *node;
+ struct prefix addr;
+ int bestlen = 0;
+ struct listnode *cnode;
+ struct interface *ifp;
+ struct connected *c;
+
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ {
+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
+ {
+ if (prefix_cmp(c->address, prefix) == 0)
+ {
+ return ifp;
+ }
+ }
+ }
+ return NULL;
+}
+
/* Get interface by name if given name interface doesn't exist create
one. */
struct interface *