Avoid adding loopback interface (ip link add) when setting nat zone on loopback interface#1411
Merged
prsunny merged 2 commits intosonic-net:masterfrom Aug 20, 2020
Merged
Conversation
… loopback interface Signed-off-by: Akhilesh Samineni <[email protected]>
prsunny
reviewed
Aug 20, 2020
| if (is_lo) | ||
| { | ||
| addLoopbackIntf(alias); | ||
| if (m_loopbackIntfList.find(alias) == m_loopbackIntfList.end()) |
Collaborator
There was a problem hiding this comment.
so nat_zone handling is done only if not is_lo. Where is it applying nat_zone on loopback interface?
Contributor
Author
There was a problem hiding this comment.
Not pushing the nat_zone value to APPL_DB when it got applied for loopback interface. nat_zone for loopback interface gets handled in natmgr code for setting iptables mangle tables rules (https://github.com/Azure/sonic-swss/blob/master/cfgmgr/natmgr.cpp#L901)
Signed-off-by: Akhilesh Samineni <[email protected]>
prsunny
approved these changes
Aug 20, 2020
Contributor
Contributor
|
@arlakshm Cherry-pick has conflict. Please create PR for 201911. |
Contributor
|
@AkhileshSamineni could you double commit this change to 201911 |
Contributor
Author
Contributor
Author
EdenGri
pushed a commit
to EdenGri/sonic-swss
that referenced
this pull request
Feb 28, 2022
… naming mode "alias" sonic-net#1397 (sonic-net#1411) #### What I did Added fix for Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #### How I did it Added code to remove last few extra characters from string (-------…) using Slicing & Positive Indexing in python, to match the width to alias's name(not interface)
Janetxxx
pushed a commit
to Janetxxx/sonic-swss
that referenced
this pull request
Nov 10, 2025
…n loopback interface (sonic-net#1411) * Avoid adding loopback interface (ip link add) when nat zone is set on loopback interface Signed-off-by: Akhilesh Samineni <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue (#1311) :
Add Loopback interface to NAT zone 1
sudo config nat add interface Loopback0 -nat_zone 1
Seeing below error logs when NAT zone for Loopback changed to 1.
Apr 21 11:44:33.805637 cab18-3-dut INFO swss#supervisord: intfmgrd RTNETLINK answers: File exists
Apr 21 11:44:33.805637 cab18-3-dut ERR swss#intfmgrd: :- exec: /sbin/ip link add Loopback0 mtu 65536 type dummy && /sbin/ip link set Loopback0 up: Success
Apr 21 11:44:33.805637 cab18-3-dut ERR swss#intfmgrd: :- addLoopbackIntf: Command '/sbin/ip link add Loopback0 mtu 65536 type dummy && /sbin/ip link set Loopback0 up' failed with rc 512
Root cause for logs:
Whenever the ip address is assigned to Loopback1 using below command, "ip link" gets added for Loopback1 like shown below
config interface ip add Loopback1 20.20.20.20/32
82: Loopback1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 86:68:3c:f4:25:b7 brd ff:ff:ff:ff:ff:ff
Then when setting the nat zone for the Loopback1 interface to 1, it tries to add "ip link" for Loopback1 again and leads to syslog errors.
Note : These syslog errors for Loopback will seen for all fields like vrf_name, mac_addr, admin_status, proxy_arp, errors are not specific to nat_zone field. Fields are https://github.com/Azure/sonic-swss/blob/master/cfgmgr/intfmgr.cpp#L383
Fix:
Added a set container to hold the Loopback string whenever loopback interface is created and using it to avoid the "addLoopbackIntf" call for the fields setting like nat_zone.
Signed-off-by: Akhilesh Samineni [email protected]