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

misuse of 'err' to check nil #537

Conversation

youngifif
Copy link

In ConfigureInterface(),the defer closure misuse outter 'err' to check nil ,not 'cerr' inside the closure.

…k nil ,not 'cerr' inside the closure.

Signed-off-by: youngifif <[email protected]>
@youngifif youngifif force-pushed the fix_ConfigureInterface_defer_err_misuse branch from 40a5970 to 961a741 Compare June 3, 2024 08:24
pmazzini
pmazzini previously approved these changes Jun 3, 2024
@pmazzini
Copy link
Collaborator

pmazzini commented Jun 3, 2024

Integration tests look to be constantly failing now.

@youngifif
Copy link
Author

youngifif commented Jun 3, 2024

Integration tests look to be constantly failing now.

I think the testCase in TestConfigureInterface is not correct.

I use Debian12 official iproute2 tools to input command as follow:
sudo ip addr add 10.20.30.40 dev eth0
sudo ip addr add 10.20.30.40 dev eth0

then i got:
RTNETLINK answers: File exists
apparently netlink doesn't allow add the same address to one dev multiple times.

Inside TestConfigureInterface(), the func ConfigureInterface(ifname string, netconf *NetConf)
calls rt.AddrAdd(iface, &addr.IPNet) with same addr and same iface. So, the last call expects
a error of 'file exits'.

@youngifif youngifif closed this Jun 3, 2024
@youngifif
Copy link
Author

I was misleading by cerr, the original one is correct.
I gonna issue a new issue PR about test case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants