zebra: Add check to notice when an interface is unnumbered
If an interface is not a loopback and it's prefixlen == 32
assume that it is unnumbered.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/lib/if.h b/lib/if.h
index 9796a4d..862f7d4 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -282,6 +282,7 @@
u_char flags;
#define ZEBRA_IFA_SECONDARY (1 << 0)
#define ZEBRA_IFA_PEER (1 << 1)
+#define ZEBRA_IFA_UNNUMBERED (1 << 2)
/* N.B. the ZEBRA_IFA_PEER flag should be set if and only if
a peer address has been configured. If this flag is set,
the destination field must contain the peer address.
diff --git a/zebra/connected.c b/zebra/connected.c
index 84b0d1c..1980007 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -77,7 +77,15 @@
{
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. */
diff --git a/zebra/interface.c b/zebra/interface.c
index 7559795..5e89db9 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -736,6 +736,9 @@
if (CHECK_FLAG (connected->flags, ZEBRA_IFA_SECONDARY))
vty_out (vty, " secondary");
+ if (CHECK_FLAG (connected->flags, ZEBRA_IFA_UNNUMBERED))
+ vty_out (vty, " unnumbered");
+
if (connected->label)
vty_out (vty, " %s", connected->label);