Skip to content

Commit

Permalink
[vs] Make default port admin state to false (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Apr 15, 2020
1 parent f972073 commit 0b43cab
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions vslib/src/SwitchStateBaseHostif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,6 @@ bool SwitchStateBase::hostif_create_tap_veth_forwarding(

SWSS_LOG_NOTICE("interface index = %d, %s\n", sock_address.sll_ifindex, vethname.c_str());

if (ifup(vethname.c_str(), port_id, true, true))
{
SWSS_LOG_ERROR("ifup failed on %s", vethname.c_str());

close(packet_socket);

return false;
}

if (promisc(vethname.c_str()))
{
SWSS_LOG_ERROR("promisc failed on %s", vethname.c_str());
Expand Down Expand Up @@ -658,6 +649,25 @@ sai_status_t SwitchStateBase::vs_create_hostif_tap_interface(

vs_set_dev_mtu(vname.c_str(), mtu);

attr.id = SAI_PORT_ATTR_ADMIN_STATE;

status = get(SAI_OBJECT_TYPE_PORT, obj_id, 1, &attr);

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("failed to get admin state for port %s",
sai_serialize_object_id(obj_id).c_str());

return false;
}

if (ifup(vname.c_str(), obj_id, attr.value.booldata, false))
{
SWSS_LOG_ERROR("ifup failed on %s", vname.c_str());

return false;
}

if (!hostif_create_tap_veth_forwarding(name, tapfd, obj_id))
{
SWSS_LOG_ERROR("forwarding rule on %s was not added", name.c_str());
Expand Down

0 comments on commit 0b43cab

Please sign in to comment.