summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-server.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-06-21 14:39:36 +0200
committerTom Gundersen <teg@jklm.no>2014-06-21 15:02:30 +0200
commitd6bd972d061af306ede2affd2c9340a1660f7996 (patch)
tree49c9db76722dab8dfa2998c5fa46c90ada819f9c /src/libsystemd-network/sd-dhcp-server.c
parentda92ca5eb506d513033e0c7a85daf25a7e1c9d0e (diff)
sd-dhcp-server: fix broadcast of DHCP packets
The destination IP address should be INADDR_BROADCAST, but was accidentally left as INADDR_ANY.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-server.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index e4236e8f7d..55a8fbe005 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -340,9 +340,12 @@ int dhcp_server_send_packet(sd_dhcp_server *server,
} else if (req->message->ciaddr && type != DHCP_NAK)
destination = req->message->ciaddr;
- if (destination || requested_broadcast(req) || type == DHCP_NAK)
+ if (destination != INADDR_ANY)
return dhcp_server_send_udp(server, destination, &packet->dhcp,
sizeof(DHCPMessage) + optoffset);
+ else if (requested_broadcast(req) || type == DHCP_NAK)
+ return dhcp_server_send_udp(server, INADDR_BROADCAST, &packet->dhcp,
+ sizeof(DHCPMessage) + optoffset);
else
/* we cannot send UDP packet to specific MAC address when the address is
not yet configured, so must fall back to raw packets */