disable broadcast if broadcast is set to net.IPv4zero #1037
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.
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
tonet.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 likeattribute 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.