Limit size of IPv4 DHCP reply.
In other words, remove zero padding after end option (0xff).

Signed-off-by: Dmitry Ivanov <d...@ubnt.com>
---
 src/dhcpv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index a657e13..c8014ea 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -497,7 +497,7 @@ static void handle_dhcpv4(void *addr, void *data, size_t 
len,
                                inet_ntoa(dest.sin_addr));
        }
 
-       sendto(sock, &reply, sizeof(reply), MSG_DONTWAIT,
+       sendto(sock, &reply, cookie - (uint8_t*) &reply - 1, MSG_DONTWAIT,
                        (struct sockaddr*)&dest, sizeof(dest));
 }
 
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to