Skip to content
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

[IntfMgrd] Retry adding ipv6 prefix by setting disabled_ipv6 flag #2267

Merged
merged 9 commits into from
May 16, 2022

Conversation

vivekrnv
Copy link
Contributor

Signed-off-by: Vivek Reddy Karri vkarri@nvidia.com

What I did

intfmgrd sets the flag by itself and retries setting the ip address if the ipv6 assignment fails for the first time

Why I did it

There might be a race condition b/w intfmgrd and Mellanox SDK where the SDK created Linux Netdev iface but still doesn't yet set disable_ipv6 flag to 0. If intfmgrd tries to assign ip to the iface, the attempt fails.

How I verified it

Ut's

vkarri@7f13d1e426de:/sonic/src/sonic-swss/tests/mock_tests$ ./tests_intfmgrd 
Running main() from /usr/src/gtest/src/gtest_main.cc
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from IntfMgrTest
[ RUN      ] IntfMgrTest.testSettingIpv6Flag
[       OK ] IntfMgrTest.testSettingIpv6Flag (1 ms)
[ RUN      ] IntfMgrTest.testNoSettingIpv6Flag
[       OK ] IntfMgrTest.testNoSettingIpv6Flag (0 ms)
[----------] 2 tests from IntfMgrTest (1 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[  PASSED  ] 2 tests.

Verified on the switch:

root@r-leopard-simx-69:/home/admin# cat /proc/sys/net/ipv6/conf/Ethernet0/disable_ipv6
0
root@r-leopard-simx-69:/home/admin# sysctl -w net.ipv6.conf.Ethernet0.disable_ipv6=1
net.ipv6.conf.Ethernet0.disable_ipv6 = 1
root@r-leopard-simx-69:/home/admin# config interface ip add Ethernet0 2001:0db8:0:f101::1/64
root@r-leopard-simx-69:/home/admin# sysctl net.ipv6.conf.Ethernet0.disable_ipv6
net.ipv6.conf.Ethernet0.disable_ipv6 = 0
root@r-leopard-simx-69:/home/admin# ifconfig Ethernet0
Ethernet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9100
        inet6 fe80::1e34:daff:fe1d:4200  prefixlen 64  scopeid 0x20<link>
        inet6 2001:db8:0:f101::1  prefixlen 64  scopeid 0x0<global>
        ether 1c:34:da:1d:42:00  txqueuelen 1000  (Ethernet)
        RX packets 18  bytes 3366 (3.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22  bytes 4604 (4.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In Syslog:

May  5 08:31:56.889599 r-leopard-simx-69 INFO swss#/supervisord: intfmgrd RTNETLINK answers: Permission denied
May  5 08:31:56.901305 r-leopard-simx-69 INFO swss#intfmgrd: :- enableIpv6Flag: disable_ipv6 flag to 0 for iface: Ethernet0, cmd: sysctl -w net.ipv6.conf.\"Ethernet0\".disable_ipv6=0, ret = 0

Details if related

vivekrnv added 8 commits May 4, 2022 08:36
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
@prsunny
Copy link
Collaborator

prsunny commented May 13, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

int ret = swss::exec(cmd.str(), res);
if (ret)
int failed = swss::exec(cmd.str(), res);
if (failed && !ipPrefix.isV4() && opCmd == "add")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use the previous "ret" variable and add the remaining check within the failed case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled

@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-swss

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
@prsunny prsunny merged commit 54e1847 into sonic-net:master May 16, 2022
judyjoseph pushed a commit that referenced this pull request May 25, 2022
)

*intfmgrd sets the flag by itself and retries setting the ip address if the ipv6 assignment fails for the first time
*There might be a race condition b/w intfmgrd and Mellanox SDK where the SDK created Linux Netdev iface but still doesn't yet set disable_ipv6 flag to 0. If intfmgrd tries to assign ip to the iface, the attempt fails.
@vivekrnv vivekrnv deleted the ipv6_sai_race branch June 10, 2022 21:00
preetham-singh pushed a commit to preetham-singh/sonic-swss that referenced this pull request Aug 6, 2022
…nic-net#2267)

*intfmgrd sets the flag by itself and retries setting the ip address if the ipv6 assignment fails for the first time
*There might be a race condition b/w intfmgrd and Mellanox SDK where the SDK created Linux Netdev iface but still doesn't yet set disable_ipv6 flag to 0. If intfmgrd tries to assign ip to the iface, the attempt fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants