diff options
author | 2011-02-14 09:22:08 +0100 | |
---|---|---|
committer | 2011-02-14 09:22:08 +0100 | |
commit | 1b7d474304236d6b593dd15833e505e35590dba0 (patch) | |
tree | c654119ddda223ab89e1d476c613846114f7a2fb /src | |
parent | update configuration wrt to the broadcast address (diff) | |
download | lxc-1b7d474304236d6b593dd15833e505e35590dba0.tar.gz lxc-1b7d474304236d6b593dd15833e505e35590dba0.tar.bz2 lxc-1b7d474304236d6b593dd15833e505e35590dba0.zip |
Simplify broadcast computation
David Ward reported this computation could be written in a simpler
way.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lxc/confile.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 7c72752..1d30cba 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -423,8 +423,9 @@ static int config_network_ipv4(const char *key, char *value, * prefix and address */ if (!bcast) { - int mask = htonl(INADDR_BROADCAST << (32 - inetdev->prefix)); - inetdev->bcast.s_addr = (inetdev->addr.s_addr & mask) | ~mask; + inetdev->bcast.s_addr = inetdev->addr.s_addr; + inetdev->bcast.s_addr |= + htonl(INADDR_BROADCAST >> inetdev->prefix); } lxc_list_add(&netdev->ipv4, list); |