summaryrefslogtreecommitdiff
path: root/zebra/if_netlink.c
diff options
context:
space:
mode:
authorSharath Ramamurthy <sramamurthy@nvidia.com>2021-07-27 13:17:52 +0530
committerStephen Worley <sworley@nvidia.com>2023-02-13 18:12:04 -0500
commit784d88aa14c115411ed21f6ac518ab1a8f9d27b7 (patch)
tree86c103be00f0442b205027ca2cc2f852275eac94 /zebra/if_netlink.c
parent8d30ff3b5ef815ad5cab092f2ce6dc28ab5e3421 (diff)
zebra: multiple vlan aware bridge datastructure changes and vxlan device iftype derivation from netlink
This change set introduces data structure changes required for multiple vlan aware bridge functionality. A new structure zebra_l2_bridge_if encapsulates the vlan to access_bd association of the bridge. A vlan_table hash_table is used to record each instance of the vlan to access_bd of the bridge via zebra_l2_bridge_vlan structure. vxlan iftype derivation: netlink attribute IFLA_VXLAN_COLLECT_METADATA is used to derive the iftype of the vxlan device. If the attribute is present, then the vxlan interface is treated as single vxlan device, otherwise it would default to traditional vxlan device. zebra_vxlan_check_readd_vtep, zebra_vxlan_dp_network_mac_add/del is modified to be vni aware. mac_fdb_read_for_bridge - is modified to be (vlan, bridge) aware Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
Diffstat (limited to 'zebra/if_netlink.c')
-rw-r--r--zebra/if_netlink.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 6df8a4067c..3b4e048aff 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -544,7 +544,7 @@ static int netlink_extract_bridge_info(struct rtattr *link_data,
memset(bridge_info, 0, sizeof(*bridge_info));
netlink_parse_rtattr_nested(attr, IFLA_BR_MAX, link_data);
if (attr[IFLA_BR_VLAN_FILTERING])
- bridge_info->vlan_aware =
+ bridge_info->bridge.vlan_aware =
*(uint8_t *)RTA_DATA(attr[IFLA_BR_VLAN_FILTERING]);
return 0;
}
@@ -612,6 +612,7 @@ static int netlink_extract_gre_info(struct rtattr *link_data,
static int netlink_extract_vxlan_info(struct rtattr *link_data,
struct zebra_l2info_vxlan *vxl_info)
{
+ uint8_t svd = 0;
struct rtattr *attr[IFLA_VXLAN_MAX + 1];
vni_t vni_in_msg;
struct in_addr vtep_ip_in_msg;
@@ -619,15 +620,31 @@ static int netlink_extract_vxlan_info(struct rtattr *link_data,
memset(vxl_info, 0, sizeof(*vxl_info));
netlink_parse_rtattr_nested(attr, IFLA_VXLAN_MAX, link_data);
- if (!attr[IFLA_VXLAN_ID]) {
+ if (attr[IFLA_VXLAN_COLLECT_METADATA]) {
+ svd = *(uint8_t *)RTA_DATA(attr[IFLA_VXLAN_COLLECT_METADATA]);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "IFLA_VXLAN_ID missing from VXLAN IF message");
- return -1;
+ "IFLA_VXLAN_COLLECT_METADATA=%u in VXLAN IF message",
+ svd);
+ }
+
+ if (!svd) {
+ /* in case of svd we will not get vni info directly from the
+ * device */
+ if (!attr[IFLA_VXLAN_ID]) {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug(
+ "IFLA_VXLAN_ID missing from VXLAN IF message");
+ return -1;
+ }
+
+ vxl_info->vni_info.iftype = ZEBRA_VXLAN_IF_VNI;
+ vni_in_msg = *(vni_t *)RTA_DATA(attr[IFLA_VXLAN_ID]);
+ vxl_info->vni_info.vni.vni = vni_in_msg;
+ } else {
+ vxl_info->vni_info.iftype = ZEBRA_VXLAN_IF_SVD;
}
- vni_in_msg = *(vni_t *)RTA_DATA(attr[IFLA_VXLAN_ID]);
- vxl_info->vni_info.vni.vni = vni_in_msg;
if (!attr[IFLA_VXLAN_LOCAL]) {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
@@ -639,8 +656,10 @@ static int netlink_extract_vxlan_info(struct rtattr *link_data,
}
if (attr[IFLA_VXLAN_GROUP]) {
- vxl_info->vni_info.vni.mcast_grp =
- *(struct in_addr *)RTA_DATA(attr[IFLA_VXLAN_GROUP]);
+ if (!svd)
+ vxl_info->vni_info.vni.mcast_grp =
+ *(struct in_addr *)RTA_DATA(
+ attr[IFLA_VXLAN_GROUP]);
}
if (!attr[IFLA_VXLAN_LINK]) {