From 9e57ba2420cab8aa55abe7bdb6fced1abf6785ef Mon Sep 17 00:00:00 2001 From: "Sudharsan D.G" Date: Thu, 2 Jul 2020 11:33:51 -0700 Subject: [PATCH] Fixing hostif For Genetlink host interfaces (#633) Co-authored-by: dgsudharsan --- vslib/src/SwitchStateBaseHostif.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/vslib/src/SwitchStateBaseHostif.cpp b/vslib/src/SwitchStateBaseHostif.cpp index f3fa2519b431..bc654f8f5da2 100644 --- a/vslib/src/SwitchStateBaseHostif.cpp +++ b/vslib/src/SwitchStateBaseHostif.cpp @@ -722,10 +722,31 @@ sai_status_t SwitchStateBase::vs_remove_hostif_tap_interface( sai_attribute_t attr; - attr.id = SAI_HOSTIF_ATTR_NAME; + attr.id = SAI_HOSTIF_ATTR_TYPE; sai_status_t status = get(SAI_OBJECT_TYPE_HOSTIF, hostif_id, 1, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("failed to get attr type for hostif %s", + sai_serialize_object_id(hostif_id).c_str()); + return status; + } + + + /* The genetlink host interface is created to associate trap group to genetlink family and multicast group + * created by driver. It does not create any netdev interface. Hence skipping tap interface deletion + */ + if (attr.value.s32 == SAI_HOSTIF_TYPE_GENETLINK) + { + SWSS_LOG_DEBUG("Skipping tap delete for hostif type genetlink"); + return SAI_STATUS_SUCCESS; + } + + attr.id = SAI_HOSTIF_ATTR_NAME; + + status = get(SAI_OBJECT_TYPE_HOSTIF, hostif_id, 1, &attr); + if (status != SAI_STATUS_SUCCESS) { SWSS_LOG_ERROR("failed to get attr name for hostif %s",