From: Christian Mehlis Date: Mon, 18 Aug 2014 11:36:18 +0000 (+0200) Subject: dhcpv4: send NAK to broacast address X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=commitdiff_plain;h=1476c281d2a310831b5bf1cf130f170891104a51 dhcpv4: send NAK to broacast address --- 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