If an interface is not a loopback and it's prefixlen == 32
assume that it is unnumbered.

Signed-off-by: Donald Sharp <[email protected]>
---
 lib/if.h          |  1 +
 zebra/connected.c | 10 +++++++++-
 zebra/interface.c |  3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/if.h b/lib/if.h
index ee25519..515c6fc 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -172,6 +172,7 @@ struct connected
   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 25d49db..77e94d1 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -78,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. */
diff --git a/zebra/interface.c b/zebra/interface.c
index 967bd6c..810ad18 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -632,6 +632,9 @@ connected_dump_vty (struct vty *vty, struct connected 
*connected)
   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);
 
-- 
1.9.1


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to