summaryrefslogtreecommitdiff
path: root/lib/filter.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-08-09 20:30:34 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-08-09 20:30:34 +0200
commit3b0f6068a83da9aeb46e42c430afc7b9c8e79393 (patch)
tree6cb774bae659e22d5d9dd8487cbe8c4f891bea47 /lib/filter.c
parent0f6476ccc3dcd8d7bb3e254ef9e919f5163475fe (diff)
lib: some final MAC access-list fixes
- couldn't load back written configs because it was trying to parse "any" as MAC address - don't need special-casing in filter_match_zebra(), exact is going to be 0 for AF_ETHERNET anyway - some vty formatting was slightly different - is_zero_mac now static to prefix.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/filter.c')
-rw-r--r--lib/filter.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/lib/filter.c b/lib/filter.c
index 9b983d26f2..cb6f743c01 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -187,26 +187,16 @@ static int filter_match_zebra(struct filter *mfilter, struct prefix *p)
filter = &mfilter->u.zfilter;
- if (filter->prefix.family == AF_ETHERNET) {
- return prefix_match(&filter->prefix, p);
- }
-
- if (filter->prefix.family == AF_INET
- || filter->prefix.family == AF_INET6) {
-
- if (filter->prefix.family == p->family) {
- if (filter->exact) {
- if (filter->prefix.prefixlen == p->prefixlen)
- return prefix_match(&filter->prefix, p);
- else
- return 0;
- } else
+ if (filter->prefix.family == p->family) {
+ if (filter->exact) {
+ if (filter->prefix.prefixlen == p->prefixlen)
return prefix_match(&filter->prefix, p);
+ else
+ return 0;
} else
- return 0;
- }
-
- return 0;
+ return prefix_match(&filter->prefix, p);
+ } else
+ return 0;
}
/* Allocate new access list structure. */
@@ -1755,9 +1745,9 @@ static int filter_show(struct vty *vty, const char *name, afi_t afi)
: "Standard")
: "Zebra",
(afi == AFI_IP)
- ? ("")
- : ((afi == AFI_IP6) ? ("ipv6 ")
- : ("mac ")),
+ ? ("IP")
+ : ((afi == AFI_IP6) ? ("IPv6 ")
+ : ("MAC ")),
access->name);
write = 0;
}
@@ -1802,9 +1792,9 @@ static int filter_show(struct vty *vty, const char *name, afi_t afi)
: "Standard")
: "Zebra",
(afi == AFI_IP)
- ? ("")
- : ((afi == AFI_IP6) ? ("ipv6 ")
- : ("mac ")),
+ ? ("IP")
+ : ((afi == AFI_IP6) ? ("IPv6 ")
+ : ("MAC ")),
access->name);
write = 0;
}
@@ -1960,7 +1950,7 @@ void config_write_access_zebra(struct vty *vty, struct filter *mfilter)
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
p->prefixlen, filter->exact ? " exact-match" : "");
else if (p->family == AF_ETHERNET) {
- if (is_zero_mac(&(p->u.prefix_eth)))
+ if (p->prefixlen == 0)
vty_out(vty, " any");
else
vty_out(vty, " %s", prefix_mac2str(&(p->u.prefix_eth),