summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorKishore Aramalla <karamalla@vmware.com>2020-02-10 11:38:27 -0800
committerKishore Aramalla <karamalla@vmware.com>2020-02-11 12:36:50 -0800
commitc6ec0c745a77024c0b5690127ebd961493daed3d (patch)
tree3861a7eb9a4902b7b4551d6b7f526dafe323578a /lib/prefix.c
parentf94ed830df98218447f00b97f856de811bfcc4a2 (diff)
bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNI
A route where ESI, GW IP, MAC and Label are all zero at the same time SHOULD be treat-as-withdraw. Invalid MAC addresses are broadcast or multicast MAC addresses. The route MUST be treat-as-withdraw in case of an invalid MAC address. As FRR support Ethernet NVO Tunnels only. Route will be withdrawn when ESI, GW IP and MAC are zero or Invalid MAC Test cases: 1) ET-5 route with valid RMAC extended community 2) ET-5 route no RMAC extended community 3) ET-5 route with Multicast MAC in RMAC extended community 4) ET-5 route with Broadcast MAC in RMAC extended community Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 199ff3267b..030ffe3471 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -56,6 +56,25 @@ int is_zero_mac(const struct ethaddr *mac)
return 1;
}
+bool is_bcast_mac(const struct ethaddr *mac)
+{
+ int i = 0;
+
+ for (i = 0; i < ETH_ALEN; i++)
+ if (mac->octet[i] != 0xFF)
+ return false;
+
+ return true;
+}
+
+bool is_mcast_mac(const struct ethaddr *mac)
+{
+ if ((mac->octet[0] & 0x01) == 0x01)
+ return true;
+
+ return false;
+}
+
unsigned int prefix_bit(const uint8_t *prefix, const uint16_t prefixlen)
{
unsigned int offset = prefixlen / 8;