Thread (12 messages) 12 messages, 3 authors, 2021-05-06

Re: [PATCH 1/1] ip.7: Add "special and reserved addresses" section

From: Seth David Schoen <hidden>
Date: 2021-03-22 17:59:20

Florian Weimer writes:
* Seth David Schoen:
quoted
+On any locally-attached IP subnet, the lowest-numbered address and
+highest-numbered address (e.g., the .0 and .255 addresses on a subnet
+with netmask 255.255.255.0) are both designated as broadcast addresses.
+These cannot usefully be assigned to an interface, and can only be
+addressed with a socket on which the
+.B SO_BROADCAST
+option has been explicitly enabled.
I think the broadcast address is actually settable to some degree, and
/31 subnets do not have them.  I wouldn't be surprised if kernel
behavior also depended on the network device.
Thanks!  We're somewhat familiar with that because we are currently proposing
to change this behavior. :-)

Both things you noted are true: you can change broadcast addresses with
ifconfig or ip (e.g. ip addr add x/y broadcast z dev d), and /31 subnets
indeed don't have them.  This is defined at

https://github.com/torvalds/linux/blob/master/net/ipv4/fib_frontend.c#L1125

I'm not familiar with a way in which it depends on the network device
other than the /31 issue.  At least, this particular logic isn't
affected by other aspects of the network device type.

Could you suggest a way that these details could usefully be described
here?  The ability to change the broadcast address is very little-used,
so I'm not sure many readers would benefit from details about it here,
but I also wouldn't want to mislead them about that.  Maybe just
changing it to "are both designated, by default, as broadcast
addresses"?

Conceivably it could say something like


On any locally-attached IP subnet that contains more than two IP
addresses, the lowest-numbered address and highest-numbered address
(e.g., the .0 and .255 addresses on a subnet with netmask 255.255.255.0)
are both designated as broadcast addresses by default. These cannot
usefully be assigned to an interface, and can only be addressed with a
socket on which the
.B SO_BROADCAST
option has been explicitly enabled.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help