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

Set NetNsId to -1 when attr is not specified #705

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

Devatoria
Copy link
Contributor

This attribute is not specified on interfaces not tied to a specific network namespace and so it is not present in the netlink message. When it is the case, LinkDeserialize does not deserialize anything in the base.NetNsId field and the default value of base.NetNsId is 0. However, 0 is also a valid value for an existing netns id. Because of this, there is no way to know if the netns was not specified or if it is currently the existing netns with the id 0.

This PR defaults the netns id to -1 so there is no more confusion (which is also the default value returned by your netns library when returning a non existing NsHandle).

@aboch
Copy link
Collaborator

aboch commented Oct 21, 2021

LGTM

@Devatoria
Copy link
Contributor Author

Thanks for the review, what is the next step to see it merged please?

@vishvananda vishvananda merged commit fc5a223 into vishvananda:master Nov 1, 2021
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.

3 participants