summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm.c
diff options
context:
space:
mode:
authorAmeya Dharkar <adharkar@vmware.com>2019-05-16 17:29:08 -0700
committerAmeya Dharkar <adharkar@vmware.com>2019-06-17 12:05:38 -0700
commit9da60d0a19b1a838865e37e6554481dc851c1bcb (patch)
tree4d5560f35499c1396839040fa4dead6da3c82d26 /zebra/zebra_fpm.c
parentfbe748e59fdff41a0ae8a07c42041bcfecb39f92 (diff)
Zebra: Build nelink message for RMAC updates
- Function "zfpm_netlink_encode_mac()" builds a netlink message for RMAC updates. - To build a netlink message for RMAC updates, we use "ndmsg" in rtlink. - FPM Message structure is: FPM header -> nlmsg header -> ndmsg fields -> ndmsg attributes - Netlink message will look like: {'ndm_type': 0, 'family': 7, '__pad': (), 'header': {'flags': 1281, 'length':64, 'type': 28, 'pid': 0, 'sequence_number': 0}, 'state': 2, 'flags': 22, 'attrs': [('NDA_LLADDR', 'b2:66:eb:b9:5b:d3'), ('NDA_DST', '10.100.0.2'), ('NDA_MASTER', 11), ('NDA_VNI', 1000)], 'ifindex': 18} - Message details: nlmsghdr.nlmsg_type = RTM_NEWNEIGH(28) or RTM_DELNEIGH(29) nlmsghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE for "add" , "NLM_F_REQUEST" for delete. ndmsg.ndm_family = AF_BRIDGE ndmsg.ndm_ifindex = vxlan_if (ifindex) ndmsg.ndm_state = NUD_REACHABLE ndmsg.ndm_flags |= NTF_SELF | NTF_MASTER | NTF_EXT_LEARNED Attribute "NDA_LLADDR" for MAC address Attribute "NDA_DST" for remote vtep ip Attribute "NDA_MASTER" for bridge interface ifindex. Attribute "NDA_VNI" for VNI id. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
Diffstat (limited to 'zebra/zebra_fpm.c')
-rw-r--r--zebra/zebra_fpm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 83d0dba61f..3e74db8111 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1052,6 +1052,11 @@ static inline int zfpm_encode_mac(struct fpm_mac_info_t *mac, char *in_buf,
case ZFPM_MSG_FORMAT_NONE:
break;
case ZFPM_MSG_FORMAT_NETLINK:
+#ifdef HAVE_NETLINK
+ len = zfpm_netlink_encode_mac(mac, in_buf, in_buf_len);
+ assert(fpm_msg_align(len) == len);
+ *msg_type = FPM_MSG_TYPE_NETLINK;
+#endif /* HAVE_NETLINK */
break;
case ZFPM_MSG_FORMAT_PROTOBUF:
break;
@@ -1100,7 +1105,7 @@ static int zfpm_build_mac_updates(void)
data = fpm_msg_data(hdr);
data_len = zfpm_encode_mac(mac, (char *)data, buf_end - data,
&msg_type);
- /* assert(data_len); */
+ assert(data_len);
hdr->msg_type = msg_type;
msg_len = fpm_data_len_to_msg_len(data_len);