lib, bgpd: Fixup afi_t to be an enum and cleanup zebra.h
This code change does two things:
1) Removes ZEBRA_AFI_XXX #defines since they were redundant information
2) Switches afi_t to an enumerated type so that the compiler
can do a bit more compile time checking.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/lib/plist.c b/lib/plist.c
index f9e626d..699c9b1 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -698,8 +698,9 @@
}
/* "any" is special token for matching any IPv4 addresses. */
- if (afi == AFI_IP)
+ switch (afi)
{
+ case AFI_IP:
if (strncmp ("any", prefix, strlen (prefix)) == 0)
{
ret = str2prefix_ipv4 ("0.0.0.0/0", (struct prefix_ipv4 *) &p);
@@ -715,10 +716,8 @@
vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
- }
-#ifdef HAVE_IPV6
- else if (afi == AFI_IP6)
- {
+ break;
+ case AFI_IP6:
if (strncmp ("any", prefix, strlen (prefix)) == 0)
{
ret = str2prefix_ipv6 ("::/0", (struct prefix_ipv6 *) &p);
@@ -734,8 +733,8 @@
vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
+ break;
}
-#endif /* HAVE_IPV6 */
/* ge and le check. */
if (genum && (genum <= p.prefixlen))