Signed-off-by: Lou Berger <[email protected]>
---
 lib/prefix.c | 16 ++++++++++++++++
 lib/prefix.h |  1 +
 lib/zebra.h  |  3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/prefix.c b/lib/prefix.c
index 936e9fc..3e4ca16 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -223,6 +223,22 @@ family2afi (int family)
   return 0;
 }
 
+const char *
+safi2str(safi_t safi)
+{
+  switch (safi) {
+    case SAFI_UNICAST:
+       return "unicast";
+    case SAFI_MULTICAST:
+       return "multicast";
+    case SAFI_ENCAP:
+       return "encap";
+    case SAFI_MPLS_VPN:
+       return "vpn";
+  }
+  return NULL;
+}
+
 /* If n includes p prefix then return 1 else return 0. */
 int
 prefix_match (const struct prefix *n, const struct prefix *p)
diff --git a/lib/prefix.h b/lib/prefix.h
index a517d79..4a31750 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -173,6 +173,7 @@ union prefix46constptr
 extern int str2family(const char *);
 extern int afi2family (afi_t);
 extern afi_t family2afi (int);
+extern const char *safi2str(safi_t safi);
 
 /* Check bit of the prefix. */
 extern unsigned int prefix_bit (const u_char *prefix, const u_char prefixlen);
diff --git a/lib/zebra.h b/lib/zebra.h
index a607437..9662010 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -492,7 +492,8 @@ extern const char *zserv_command_string (unsigned int 
command);
 #define SAFI_MULTICAST            2
 #define SAFI_RESERVED_3           3
 #define SAFI_MPLS_VPN             4
-#define SAFI_MAX                  5
+#define SAFI_ENCAP               7 /* per IANA */
+#define SAFI_MAX                  8
 
 /* Filter direction.  */
 #define FILTER_IN                 0
-- 
2.1.3


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

Reply via email to