diff options
Diffstat (limited to 'zebra/connected.c')
-rw-r--r-- | zebra/connected.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/zebra/connected.c b/zebra/connected.c index 84b0d1cb..f2f523fa 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -30,6 +30,7 @@ #include "table.h" #include "log.h" #include "memory.h" +#include "vty.h" #include "zebra/zserv.h" #include "zebra/redistribute.h" @@ -77,7 +78,15 @@ connected_announce (struct interface *ifp, struct connected *ifc) { if (!ifc) return; - + + if (!if_is_loopback(ifp) && ifc->address->family == AF_INET) + { + if (ifc->address->prefixlen == 32) + SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED); + else + UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED); + } + listnode_add (ifp->connected, ifc); /* Update interface address information to protocol daemon. */ @@ -209,6 +218,9 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, struct prefix_ipv4 *p; struct connected *ifc; + if (ipv4_martian(addr)) + return; + /* Make connected structure. */ ifc = connected_new (); ifc->ifp = ifp; @@ -370,6 +382,9 @@ connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr, struct prefix_ipv6 *p; struct connected *ifc; + if (ipv6_martian(addr)) + return; + /* Make connected structure. */ ifc = connected_new (); ifc->ifp = ifp; @@ -464,4 +479,20 @@ connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address, rib_update (ifp->vrf_id); } + +int +connected_is_unnumbered (struct interface *ifp) +{ + struct connected *connected; + struct listnode *node; + + for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, connected)) + { + if (CHECK_FLAG (connected->conf, ZEBRA_IFC_REAL) && + connected->address->family == AF_INET) + return CHECK_FLAG(connected->flags, ZEBRA_IFA_UNNUMBERED); + } + return 0; +} + #endif /* HAVE_IPV6 */ |