@@ -643,6 +643,7 @@ bool VxlanMgr::doVxlanTunnelMapDeleteTask(const KeyOpFieldsValuesTuple & t)
643
643
vxlan_dev_name = map_entry.vxlan_dev_name ;
644
644
vlan = map_entry.vlan ;
645
645
vni_id = map_entry.vni_id ;
646
+ downVxlanNetdevice (vxlan_dev_name);
646
647
deleteVxlanNetdevice (vxlan_dev_name);
647
648
648
649
m_vxlanTunnelMapCache.erase (vxlanTunnelMapName);
@@ -906,11 +907,11 @@ void VxlanMgr::createAppDBTunnelMapTable(const KeyOpFieldsValuesTuple & t)
906
907
std::replace (vxlanTunnelMapName.begin (), vxlanTunnelMapName.end (), config_db_key_delimiter, delimiter);
907
908
908
909
/* Case 1: Entry exist - Erase from cache & return
909
- * Case 2: Entry does not exist - Write to AppDB
910
+ * Case 2: Entry does not exist - Write to AppDB
910
911
* Case 3: Entry exist but modified - Not taken care. Will address later
911
912
*/
912
913
if (m_in_reconcile)
913
- {
914
+ {
914
915
auto it = find (m_appVxlanTunnelMapKeysRecon.begin (), m_appVxlanTunnelMapKeysRecon.end (), vxlanTunnelMapName);
915
916
if (it != m_appVxlanTunnelMapKeysRecon.end ())
916
917
{
@@ -939,28 +940,28 @@ void VxlanMgr::delAppDBTunnelMapTable(std::string vxlanTunnelMapName)
939
940
m_appVxlanTunnelMapTable.del (vxlanTunnelMapName);
940
941
}
941
942
942
- int VxlanMgr::createVxlanNetdevice (std::string vxlanTunnelName, std::string vni_id,
943
- std::string src_ip, std::string dst_ip,
943
+ int VxlanMgr::createVxlanNetdevice (std::string vxlanTunnelName, std::string vni_id,
944
+ std::string src_ip, std::string dst_ip,
944
945
std::string vlan_id)
945
946
{
946
947
std::string res, cmds;
947
- std::string link_add_cmd, link_set_master_cmd, link_up_cmd;
948
+ std::string link_add_cmd, link_set_master_cmd, link_up_cmd;
948
949
std::string bridge_add_cmd, bridge_untagged_add_cmd, bridge_del_vid_cmd;
949
950
std::string vxlan_dev_name;
950
951
951
- vxlan_dev_name = std::string (" " ) + std::string (vxlanTunnelName) + " -" +
952
+ vxlan_dev_name = std::string (" " ) + std::string (vxlanTunnelName) + " -" +
952
953
std::string (vlan_id);
953
954
954
955
SWSS_LOG_INFO (" Kernel tnl_name: %s vni_id: %s src_ip: %s dst_ip:%s vlan_id: %s" ,
955
- vxlanTunnelName.c_str (), vni_id.c_str (), src_ip.c_str (), dst_ip.c_str (),
956
+ vxlanTunnelName.c_str (), vni_id.c_str (), src_ip.c_str (), dst_ip.c_str (),
956
957
vlan_id.c_str ());
957
958
958
959
// Case 1: Entry exist - Erase from cache & return
959
960
// Case 2: Entry does not exist - Create netDevice in Kernel
960
961
// Case 3: Entry exist but modified - Not taken care. Will address later
961
-
962
+
962
963
if (m_in_reconcile)
963
- {
964
+ {
964
965
auto it = m_vxlanNetDevices.find (vxlan_dev_name);
965
966
if (it != m_vxlanNetDevices.end ())
966
967
{
@@ -1024,6 +1025,15 @@ int VxlanMgr::createVxlanNetdevice(std::string vxlanTunnelName, std::string vni_
1024
1025
return swss::exec (cmds,res);
1025
1026
}
1026
1027
1028
+ int VxlanMgr::downVxlanNetdevice (std::string vxlan_dev_name)
1029
+ {
1030
+ int ret = 0 ;
1031
+ std::string res;
1032
+ const std::string cmd = std::string (" " ) + IP_CMD + " link set dev " + vxlan_dev_name + " down" ;
1033
+ exec (cmd, res);
1034
+ return ret;
1035
+ }
1036
+
1027
1037
int VxlanMgr::deleteVxlanNetdevice (std::string vxlan_dev_name)
1028
1038
{
1029
1039
std::string res;
@@ -1188,6 +1198,7 @@ void VxlanMgr::clearAllVxlanDevices()
1188
1198
if (netdev_type.compare (VXLAN))
1189
1199
{
1190
1200
info.m_vxlan = netdev_name;
1201
+ downVxlanNetdevice (netdev_name);
1191
1202
cmdDeleteVxlan (info, res);
1192
1203
}
1193
1204
else if (netdev_type.compare (VXLAN_IF))
0 commit comments