bgpd: add nexthop length to AF macro

Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h
index 6e5350e..c8aef58 100644
--- a/bgpd/bgp_nexthop.h
+++ b/bgpd/bgp_nexthop.h
@@ -26,6 +26,15 @@
 #define BGP_SCAN_INTERVAL_DEFAULT   60
 #define BGP_IMPORT_INTERVAL_DEFAULT 15
 
+#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
 {