summaryrefslogtreecommitdiff
path: root/lib/plist.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-01-07 09:33:28 -0500
committervivek <vivek@cumulusnetworks.com>2016-06-06 14:20:24 -0700
commite978e1de98b4464f960f27ef3fda1c45769bfb0c (patch)
treed95250a1bd866131395f53ac2b048f7a8ca893e7 /lib/plist.c
parentff75b6c05bb9ca1b9c4c48f2231fd4cbfd393b17 (diff)
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> (cherry picked from commit f3cfc46450cccc5ac035a5a97c5a1a5484205705) Conflicts: bgpd/bgp_open.c bgpd/bgp_open.h bgpd/bgp_routemap.c
Diffstat (limited to 'lib/plist.c')
-rw-r--r--lib/plist.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/plist.c b/lib/plist.c
index 12c71791ce..a1289801c4 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -922,8 +922,9 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name,
}
/* "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);
@@ -939,10 +940,8 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name,
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);
@@ -958,8 +957,8 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name,
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))