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

disable broadcast if broadcast is set to net.IPv4zero #1037

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WeidiDeng
Copy link

Another go at fixing 329.

According to comment, broadcast address auto-calculation is now a feature, and there is no intention to revert that. However, sometimes users do not want broadcast to be enabled.

Currently this can be done by setting Broadcast to net.IPv4zero. But that's not a public api of the netlink. And in my test, it will cause an error to be generated in the kernel log like attribute type 4 has an invalid length..

I think we can use this as a special value to disable broadcast since it already works. But now we explicitly set it to nil when interacting with netlink.

This is an alternative to introducing a new function or extending the Addr struct.

@WeidiDeng
Copy link
Author

@aboch Do you have time to take a look at this change? What's your opinion?

addr_linux.go Show resolved Hide resolved
@aboch
Copy link
Collaborator

aboch commented Dec 30, 2024

Thank you @WeidiDeng.
Deviating from iproute2 behavior is not good. We have chosen semantic versioning for this package to be able to introduce API breaking changes.

Let's do the right change, let's make the behavior of the addr add/del methods in line with iproute2 behavior.
Then we can release a 2.0 version,
WDYT?

@WeidiDeng
Copy link
Author

I think it's OK.

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