diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 17:58:13 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 17:58:13 -0700 |
| commit | 525c183906c47c491611f294db218d53a561a3b9 (patch) | |
| tree | be3eae87696fd7713622a0df97a591d37686282d /lib/if.c | |
| parent | c8a1cb5c9db0490cd6d426999f3d1cb2df143e45 (diff) | |
Unnumbered interface support.
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -315,6 +315,36 @@ if_lookup_address (struct in_addr src) return match; } +/* Lookup anchor interface by IPv4 address. */ +struct connected * +if_anchor_lookup_by_address (struct in_addr src) +{ + struct listnode *node; + struct listnode *cnode; + struct interface *ifp; + struct prefix *p; + struct connected *c; + + for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) + { + for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c)) + { + if (CHECK_FLAG(c->flags, ZEBRA_IFA_UNNUMBERED) || + !CHECK_FLAG(c->conf, ZEBRA_IFC_REAL)) + continue; + + p = c->address; + + if (p && p->family == AF_INET) + { + if (IPV4_ADDR_SAME (&p->u.prefix4, &src)) + return c; + } + } + } + return NULL; +} + /* Lookup interface by prefix */ struct interface * if_lookup_prefix (struct prefix *prefix) |
