]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add SAFI_ENCAP type, safi2str prefix utility
authorLou Berger <lberger@labn.net>
Tue, 12 Jan 2016 18:41:50 +0000 (13:41 -0500)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 15:33:33 +0000 (15:33 +0000)
Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 2daf7f3a8d69213f35b16a04dbe300957481a811)

lib/prefix.c
lib/prefix.h
lib/zebra.h

index 1614cd560360461af8a2d1a4077a8d004c2368ca..d0cd8946907e3ee4e10205a2a24af734f1b8ca16 100644 (file)
@@ -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)
index 73ae0f25a7bb2d10615b7dfa6c994d98c29d61be..ebdd80b8fd3127de16150da1193d833bf5532d01 100644 (file)
@@ -170,6 +170,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);
index 77870462e5a74f7d79804cfd458ec88a0e29d2c1..9a2b5441fcd907670e15916d77bd5796efa5c356 100644 (file)
@@ -536,7 +536,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