[arch-projects] [PATCH] [initscripts] network: Add missing broadcast address
Without this broadcast address is not set. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- network | 4 ++-- rc.conf | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/network b/network index b8c900d..06131a2 100755 --- a/network +++ b/network @@ -26,13 +26,13 @@ network_up() { ip link set dev $interface up || return 1 if [[ $address ]]; then - for var in netmask gateway; do + for var in netmask broadcast gateway; do if [[ -z ${!var} ]]; then printf "${C_FAIL}Error: static address defined without $var!\n" return 1 fi done - ip addr add $address/$netmask dev $interface || return 1 + ip addr add $address/$netmask broadcast $broadcast dev $interface || return 1 ip route add default via $gateway || return 1 else dhcpcd $DHCPCD_ARGS $interface || return 1 diff --git a/rc.conf b/rc.conf index b9c468a..36fd4c7 100644 --- a/rc.conf +++ b/rc.conf @@ -65,12 +65,14 @@ HOSTNAME="myhost" # - interface: name of device (required) # - address: IP address (leave blank for DHCP) # - netmask: subnet mask (ignored for DHCP) +# - broadcast: broadcast address (ignored for DHCP) # - gateway: default route (ignored for DHCP) # # Static IP example # interface=eth0 # address=192.168.0.2 # netmask=255.255.255.0 +# broadcast=192.168.0.255 # gateway=192.168.0.1 # # DHCP example @@ -82,6 +84,7 @@ HOSTNAME="myhost" interface= address= netmask= +broadcast= gateway= # Setting this to "yes" will skip network shutdown. -- 1.7.5.2
Am 09.06.2011 06:04, schrieb Gerardo Exequiel Pozzi:
Without this broadcast address is not set.
The broadcast address is uniquely defined by the network(or IP) and netmask. The user should not need to explicitly specify this.
On 06/09/2011 11:04 AM, Thomas Bächler wrote:
Am 09.06.2011 06:04, schrieb Gerardo Exequiel Pozzi:
Without this broadcast address is not set.
The broadcast address is uniquely defined by the network(or IP) and netmask. The user should not need to explicitly specify this.
somebody on the forums has broadcast of 0.0.0.0 because the support is missing. https://bbs.archlinux.org/viewtopic.php?id=120510 -- Ionuț
Am 09.06.2011 10:21, schrieb Ionut Biru:
On 06/09/2011 11:04 AM, Thomas Bächler wrote:
Am 09.06.2011 06:04, schrieb Gerardo Exequiel Pozzi:
Without this broadcast address is not set.
The broadcast address is uniquely defined by the network(or IP) and netmask. The user should not need to explicitly specify this.
somebody on the forums has broadcast of 0.0.0.0 because the support is missing.
Well, yes, but that is no reason to force the user to put it in their configuration file, when this is uniquely defined (at least in all setups I've encountered so far).
--- network | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/network b/network index b8c900d..1114fd0 100755 --- a/network +++ b/network @@ -32,7 +32,7 @@ network_up() { return 1 fi done - ip addr add $address/$netmask dev $interface || return 1 + ip addr add $address/$netmask broadcast + dev $interface || return 1 ip route add default via $gateway || return 1 else dhcpcd $DHCPCD_ARGS $interface || return 1 -- 1.7.5.4
On Thu, Jun 9, 2011 at 10:04 AM, Thomas Bächler <thomas@archlinux.org> wrote:
Am 09.06.2011 06:04, schrieb Gerardo Exequiel Pozzi:
Without this broadcast address is not set.
The broadcast address is uniquely defined by the network(or IP) and netmask. The user should not need to explicitly specify this.
It's true in most cases. But it's strictly false. Broadcast address is not something which can be calculated automaticaly in complex setup. But i agree, let it empty should do the default expected behaviour. Regards, -- Sébastien Luttringer www.seblu.net
Am 09.06.2011 17:02, schrieb Seblu:
On Thu, Jun 9, 2011 at 10:04 AM, Thomas Bächler <thomas@archlinux.org> wrote:
Am 09.06.2011 06:04, schrieb Gerardo Exequiel Pozzi:
Without this broadcast address is not set.
The broadcast address is uniquely defined by the network(or IP) and netmask. The user should not need to explicitly specify this.
It's true in most cases. But it's strictly false. Broadcast address is not something which can be calculated automaticaly in complex setup. But i agree, let it empty should do the default expected behaviour.
Correct. We can still optionally configure it, but the default should be what I do in my patch. We could combine Eric's and my patch. Right now, netcfg doesn't have a way to configure the broadcast either, and just computes it automatically. Do you have a use case where the broadcast is not the last address in the subnet? I haven't seen this.
On Thu, Jun 9, 2011 at 6:35 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Correct. We can still optionally configure it, but the default should be what I do in my patch. We could combine Eric's and my patch.
By Eric, do you mean Gerardo? Anyone want to resubmit a combination?
Right now, netcfg doesn't have a way to configure the broadcast either, and just computes it automatically.
Do you have a use case where the broadcast is not the last address in the subnet? I haven't seen this.
I'll let Dave asses whether or not this (setting a non-standard broadcast) is something we actually want to support -t
On Thu, Jun 09, 2011 at 06:58:41PM +0200, Tom Gundersen wrote:
On Thu, Jun 9, 2011 at 6:35 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Correct. We can still optionally configure it, but the default should be what I do in my patch. We could combine Eric's and my patch.
By Eric, do you mean Gerardo? Anyone want to resubmit a combination?
Right now, netcfg doesn't have a way to configure the broadcast either, and just computes it automatically.
Do you have a use case where the broadcast is not the last address in the subnet? I haven't seen this.
I'll let Dave asses whether or not this (setting a non-standard broadcast) is something we actually want to support
-t
I think it's within the realm of things we could support. I wasn't aware of any situation where the broadcast couldn't be calculated automatically, so I skipped over it. Since this isn't the case, I think it's important that we support it. It's a simple enough change. dave
On Thu, Jun 9, 2011 at 9:07 PM, Dave Reisner <d@falconindy.com> wrote:
I think it's within the realm of things we could support. I wasn't aware of any situation where the broadcast couldn't be calculated automatically, so I skipped over it. Since this isn't the case, I think it's important that we support it. It's a simple enough change.
Makes sense. So we set the broadcast if it is set in rc.conf, and fall back on Thomas' patch otherwise. -t
Am 09.06.2011 21:07, schrieb Dave Reisner:
I wasn't aware of any situation where the broadcast couldn't be calculated automatically, so I skipped over it. Since this isn't the case, I think it's important that we support it. It's a simple enough change.
The problem is worse: If you do not add a broadcast (or the magical 'broadcast +' flag), then 'ip' will not set a broadcast address at all!
Am 09.06.2011 18:58, schrieb Tom Gundersen:
On Thu, Jun 9, 2011 at 6:35 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Correct. We can still optionally configure it, but the default should be what I do in my patch. We could combine Eric's and my patch.
By Eric, do you mean Gerardo? Anyone want to resubmit a combination?
Yes, Gerardo, of course. I somehow confused the submitter.
Right now, netcfg doesn't have a way to configure the broadcast either, and just computes it automatically.
Do you have a use case where the broadcast is not the last address in the subnet? I haven't seen this.
I'll let Dave asses whether or not this (setting a non-standard broadcast) is something we actually want to support
We should add an analogous patch to netcfg, so we ensure netcfg doesn't have less features than initscripts (right now, netcfg always uses 'broadcast +').
participants (6)
-
Dave Reisner
-
Gerardo Exequiel Pozzi
-
Ionut Biru
-
Seblu
-
Thomas Bächler
-
Tom Gundersen