Skip to content

Commit

Permalink
[intfmgr]: Set proxy_arp kernel param (#2334)
Browse files Browse the repository at this point in the history
*[intfmgr]: Set proxy_arp kernel param
Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
  • Loading branch information
theasianpianist authored Jun 16, 2022
1 parent 9da86f3 commit 59f77ea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,23 +566,29 @@ bool IntfMgr::setIntfProxyArp(const string &alias, const string &proxy_arp)
{
stringstream cmd;
string res;
string proxy_arp_pvlan;
string proxy_arp_status;

if (proxy_arp == "enabled")
{
proxy_arp_pvlan = "1";
proxy_arp_status = "1";
}
else if (proxy_arp == "disabled")
{
proxy_arp_pvlan = "0";
proxy_arp_status = "0";
}
else
{
SWSS_LOG_ERROR("Proxy ARP state is invalid: \"%s\"", proxy_arp.c_str());
return false;
}

cmd << ECHO_CMD << " " << proxy_arp_pvlan << " > /proc/sys/net/ipv4/conf/" << alias << "/proxy_arp_pvlan";
cmd << ECHO_CMD << " " << proxy_arp_status << " > /proc/sys/net/ipv4/conf/" << alias << "/proxy_arp_pvlan";
EXEC_WITH_ERROR_THROW(cmd.str(), res);

cmd.clear();
cmd.str(std::string());

cmd << ECHO_CMD << " " << proxy_arp_status << " > /proc/sys/net/ipv4/conf/" << alias << "/proxy_arp";
EXEC_WITH_ERROR_THROW(cmd.str(), res);

SWSS_LOG_INFO("Proxy ARP set to \"%s\" on interface \"%s\"", proxy_arp.c_str(), alias.c_str());
Expand Down

0 comments on commit 59f77ea

Please sign in to comment.