if (!n || !p)
return 0;
+ /* check if we are matching on any mac */
+ if (is_zero_mac(&(n->u.prefix_eth)))
+ return 1;
+
if (memcmp(&(n->u.prefix), p, sizeof(struct ethaddr)) == 0)
return 1;
"Specify packets to forward\n"
"MAC address to match. e.g. 00:01:00:01:00:01\n")
{
- return filter_set_zebra(vty, argv[2]->arg, argv[3]->arg, AFI_L2VPN,
+ return filter_set_zebra(vty, argv[3]->arg, argv[4]->arg, AFI_L2VPN,
"00:00:00:00:00:00", 0, 0);
}
vty_out(vty, " %s/%d%s",
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
p->prefixlen, filter->exact ? " exact-match" : "");
- else
- vty_out(vty, " %s",
- prefix_mac2str(&(p->u.prefix_eth), buf, sizeof(buf)));
+ else if (p->family == AF_ETHERNET) {
+ if (is_zero_mac(&(p->u.prefix_eth)))
+ vty_out(vty, " any");
+ else
+ vty_out(vty, " %s", prefix_mac2str(&(p->u.prefix_eth),
+ buf, sizeof(buf)));
+ }
vty_out(vty, "\n");
}
#define MASKBIT(offset) ((0xff << (PNBBY - (offset))) & 0xff)
+int is_zero_mac(struct ethaddr *mac)
+{
+ int i = 0;
+
+ for (i = 0; i < ETH_ALEN; i++) {
+ if (mac->octet[i])
+ return 0;
+ }
+
+ return 1;
+}
+
unsigned int prefix_bit(const u_char *prefix, const u_char prefixlen)
{
unsigned int offset = prefixlen / 8;
#endif /*s6_addr32*/
/* Prototypes. */
+extern int is_zero_mac(struct ethaddr *mac);
extern int str2family(const char *);
extern int afi2family(afi_t);
extern afi_t family2afi(int);