]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: add nexthop length to AF macro
authorLou Berger <lberger@labn.net>
Tue, 12 Jan 2016 18:41:51 +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>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 3e841d3b49bdb475ce793eee5d82e5137dff57d3)

bgpd/bgp_nexthop.h

index ff18e7dc430b5820cc9ab47c03d4089e5c1225fe..a2d5ffdcc70efcd81f00dbfc93b02ea0d424931d 100644 (file)
@@ -25,6 +25,15 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "queue.h"
 #include "prefix.h"
 
+#define NEXTHOP_FAMILY(nexthop_len) ( \
+  ((nexthop_len) ==  4 ||             \
+   (nexthop_len) == 12 ? AF_INET :    \
+  ((nexthop_len) == 16 ||             \
+   (nexthop_len) == 24 ||             \
+   (nexthop_len) == 48 ? AF_INET6 :   \
+  AF_UNSPEC))                         \
+)
+
 /* BGP nexthop cache value structure. */
 struct bgp_nexthop_cache
 {