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

Calculate the broadcast address #248

Merged
merged 1 commit into from
Aug 8, 2017
Merged

Calculate the broadcast address #248

merged 1 commit into from
Aug 8, 2017

Conversation

tcely
Copy link
Contributor

@tcely tcely commented Jul 24, 2017

This is like "ip addr add 127.0.0.1/8 broadcast +" and prevents interfaces without broadcast addresses.

Configuring the IP and netmask, but not the broadcast address leaves many applications in a broken state on Linux interfaces.

@tcely
Copy link
Contributor Author

tcely commented Jul 24, 2017

Since the Travis CI build doesn't show the problem this might save someone else a bit of time.

docker run --rm -it -v $PWD:/code:Z codeclimate/codeclimate-gofmt gofmt -d ./*.go

@vishvananda
Copy link
Owner

Sorry I missed this. The code looks correct. Would you mind squashing into a single commit?

@SvenDowideit
Copy link

ping @tcely :)

This is like "ip addr add 127.0.0.1/8 broadcast +" and prevents interfaces without broadcast addresses.

Configuring the IP and netmask, but not the broadcast address leaves many applications in a broken state on Linux interfaces.
@tcely
Copy link
Contributor Author

tcely commented Aug 8, 2017

Squashed these commits as requested.

@vishvananda vishvananda merged commit f5a6f69 into vishvananda:master Aug 8, 2017
@tcely tcely deleted the patch-1 branch August 8, 2017 16:07
brandt added a commit to brandt/netlink that referenced this pull request Oct 30, 2019
Since [vishvananda#248](vishvananda#248), adding an address automatically sets the broadcast if the broadcast address was not specified. This is undesirable when adding an IP with a prefixlen of /31 or /32. (Additional details in the issues linked below.)

This changes the behavior so that the broadcast is only automatically set if the prefixlen is /30 or larger.

Issue reported in:

- vishvananda#329
- vishvananda#471

See also:

- [RFC 3021](http://tools.ietf.org/html/rfc3021)

Alternatives to this PR:

A. vishvananda#472 - Adds `AddrAddWithoutCalculatedBroadcast`.
B. jjastrze-ovh@9a85a61 - Breaking change to make auto-setting the broadcast address an opt-in feature.
C. <no existing PR> - Suppress sending of the broadcast to netlink when `addr` has a broadcast set to `0.0.0.0`.
brandt added a commit to brandt/netlink that referenced this pull request Oct 30, 2019
Since [vishvananda#248](vishvananda#248), adding an address automatically sets the broadcast if the broadcast address was not specified. This is undesirable when adding an IP with a prefixlen of /31 or /32. (Additional details in the issues linked below.)

This changes the behavior so that the broadcast is only automatically set if the prefixlen is /30 or larger.

Issue reported in:

- vishvananda#329
- vishvananda#471

See also:

- [RFC 3021](http://tools.ietf.org/html/rfc3021)

Alternatives to this PR:

A. vishvananda#472 - Adds `AddrAddWithoutCalculatedBroadcast`.
B. jjastrze-ovh@9a85a61 - Breaking change to make auto-setting the broadcast address an opt-in feature.
C. already works - Suppress setting the broadcast when addr's broadcast address is set to `0.0.0.0`. (This works today, but I'm not sure the behavior can be relied upon as a public API.)
vishvananda pushed a commit that referenced this pull request Nov 13, 2019
Since [#248](#248), adding an address automatically sets the broadcast if the broadcast address was not specified. This is undesirable when adding an IP with a prefixlen of /31 or /32. (Additional details in the issues linked below.)

This changes the behavior so that the broadcast is only automatically set if the prefixlen is /30 or larger.

Issue reported in:

- #329
- #471

See also:

- [RFC 3021](http://tools.ietf.org/html/rfc3021)

Alternatives to this PR:

A. #472 - Adds `AddrAddWithoutCalculatedBroadcast`.
B. jjastrze-ovh@9a85a61 - Breaking change to make auto-setting the broadcast address an opt-in feature.
C. already works - Suppress setting the broadcast when addr's broadcast address is set to `0.0.0.0`. (This works today, but I'm not sure the behavior can be relied upon as a public API.)
gkodali-zededa pushed a commit to gkodali-zededa/netlink that referenced this pull request May 21, 2021
Since [vishvananda#248](vishvananda#248), adding an address automatically sets the broadcast if the broadcast address was not specified. This is undesirable when adding an IP with a prefixlen of /31 or /32. (Additional details in the issues linked below.)

This changes the behavior so that the broadcast is only automatically set if the prefixlen is /30 or larger.

Issue reported in:

- vishvananda#329
- vishvananda#471

See also:

- [RFC 3021](http://tools.ietf.org/html/rfc3021)

Alternatives to this PR:

A. vishvananda#472 - Adds `AddrAddWithoutCalculatedBroadcast`.
B. jjastrze-ovh@9a85a61 - Breaking change to make auto-setting the broadcast address an opt-in feature.
C. already works - Suppress setting the broadcast when addr's broadcast address is set to `0.0.0.0`. (This works today, but I'm not sure the behavior can be relied upon as a public API.)
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.

None yet

3 participants