mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-04-29 00:01:36 +00:00
fix for issue 4026: set broadcast to 0.0.0.0 for /31 and /32
Signed-off-by: Marc E. Fiuczynski <mfiuczyn@akamai.com>
This commit is contained in:
parent
f5420c9d3f
commit
26de6cbc8d
@ -899,13 +899,19 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
|
|||||||
|
|
||||||
/* If no broadcast address, compute one from the prefix and address. */
|
/* If no broadcast address, compute one from the prefix and address. */
|
||||||
if (!bcast) {
|
if (!bcast) {
|
||||||
unsigned int shift = LAST_BIT_PER_TYPE(inetdev->prefix);
|
/* 0<=inetdev->prefix<=32 */
|
||||||
|
switch (inetdev->prefix) {
|
||||||
|
case 32: /* single IPv4 network */
|
||||||
|
; /* fall thru */
|
||||||
|
case 31: /* RFC 3021 point to point network */
|
||||||
|
inetdev->bcast.s_addr = INADDR_ANY;
|
||||||
|
break;
|
||||||
|
|
||||||
inetdev->bcast.s_addr = inetdev->addr.s_addr;
|
default:
|
||||||
if (inetdev->prefix < shift)
|
inetdev->bcast.s_addr |= htonl(INADDR_BROADCAST >> inetdev->prefix);
|
||||||
shift = inetdev->prefix;
|
break;
|
||||||
inetdev->bcast.s_addr |= htonl(INADDR_BROADCAST >> shift);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(&inetdev->head, &netdev->ipv4_addresses);
|
list_add_tail(&inetdev->head, &netdev->ipv4_addresses);
|
||||||
move_ptr(inetdev);
|
move_ptr(inetdev);
|
||||||
|
Loading…
Reference in New Issue
Block a user