-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[proxy_arp] Implement proxy ARP feature #1285
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
931c8e7
[proxy_arp] Implement proxy ARP feature
33a8ef0
[proxy_arp] Implement proxy ARP feature
05f28d7
[proxy_arp] Implement proxy ARP feature
2d6354f
[proxy_arp] Implement proxy ARP feature
f649457
[proxy_arp] Implement proxy ARP feature
3c47041
[proxy_arp] Implement proxy ARP feature
e0ac724
[proxy_arp] Implement proxy ARP feature
dfcdabd
[proxy_arp] Implement proxy ARP feature
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,6 +272,33 @@ void IntfMgr::removeSubIntfState(const string &alias) | |
} | ||
} | ||
|
||
bool IntfMgr::setIntfProxyArp(const string &alias, const string &vrf_name, const string &proxy_arp) | ||
{ | ||
stringstream cmd; | ||
string res; | ||
string proxy_arp_pvlan; | ||
|
||
if (proxy_arp == "enabled") | ||
{ | ||
proxy_arp_pvlan = "1"; | ||
} | ||
else if (proxy_arp == "disabled") | ||
{ | ||
proxy_arp_pvlan = "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"; | ||
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()); | ||
return true; | ||
} | ||
|
||
bool IntfMgr::isIntfStateOk(const string &alias) | ||
{ | ||
vector<FieldValueTuple> temp; | ||
|
@@ -346,6 +373,8 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys, | |
string mtu = ""; | ||
string adminStatus = ""; | ||
string nat_zone = ""; | ||
string proxy_arp = ""; | ||
|
||
for (auto idx : data) | ||
{ | ||
const auto &field = fvField(idx); | ||
|
@@ -363,6 +392,10 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys, | |
{ | ||
adminStatus = value; | ||
} | ||
else if (field == "proxy_arp") | ||
{ | ||
proxy_arp = value; | ||
} | ||
|
||
if (field == "nat_zone") | ||
{ | ||
|
@@ -420,7 +453,23 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys, | |
FieldValueTuple fvTuple("mac_addr", MacAddress().to_string()); | ||
data.push_back(fvTuple); | ||
} | ||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this extra line |
||
if (!proxy_arp.empty()) | ||
{ | ||
if (!setIntfProxyArp(alias, vrf_name, proxy_arp)) | ||
{ | ||
SWSS_LOG_ERROR("Failed to set proxy ARP to \"%s\" state for the \"%s\" interface", proxy_arp.c_str(), alias.c_str()); | ||
return false; | ||
} | ||
|
||
if (!alias.compare(0, strlen(VLAN_PREFIX), VLAN_PREFIX)) | ||
{ | ||
FieldValueTuple fvTuple("proxy_arp", proxy_arp); | ||
data.push_back(fvTuple); | ||
} | ||
} | ||
|
||
if (!subIntfAlias.empty()) | ||
{ | ||
if (m_subIntfList.find(subIntfAlias) == m_subIntfList.end()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please remove this parameter as it is not used?