summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Mehlis <christian@m3hlis.de>2014-08-18 13:36:18 +0200
committerChristian Mehlis <christian@m3hlis.de>2014-08-18 13:36:18 +0200
commit1476c281d2a310831b5bf1cf130f170891104a51 (patch)
treeef4615d00af30e8c39379c40200887d077d63d34 /src
parente439847d68d550108e88f49a02f6c39a8813b48d (diff)
downloadodhcpd-1476c281d2a310831b5bf1cf130f170891104a51.tar.gz
dhcpv4: send NAK to broacast address
Diffstat (limited to 'src')
-rw-r--r--src/dhcpv4.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index 5883847..ebddb22 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -458,6 +458,13 @@ static void handle_dhcpv4(void *addr, void *data, size_t len,
*/
dest.sin_addr.s_addr = INADDR_BROADCAST;
dest.sin_port = htons(DHCPV4_CLIENT_PORT);
+ } else if (!req->ciaddr.s_addr && msg == DHCPV4_MSG_NAK) {
+ /*
+ * client has no previous configuration -> no IP, so we need to reply
+ * with a broadcast packet
+ */
+ dest.sin_addr.s_addr = INADDR_BROADCAST;
+ dest.sin_port = htons(DHCPV4_CLIENT_PORT);
} else {
/*
* send reply to the newly (in this proccess) allocated IP