From c4e2274e058a82bf1ff9da29fe84cb66b1fc3442 Mon Sep 17 00:00:00 2001 From: Showier Drastic <168159404+showier-drastic@users.noreply.github.com> Date: Thu, 4 Jul 2024 10:50:34 +0800 Subject: [PATCH] feat(lwip/apps): only hand out DNS in DHCP if explicitly specified --- components/lwip/apps/dhcpserver/dhcpserver.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/components/lwip/apps/dhcpserver/dhcpserver.c b/components/lwip/apps/dhcpserver/dhcpserver.c index e6abfd743c..60e6e15cd4 100644 --- a/components/lwip/apps/dhcpserver/dhcpserver.c +++ b/components/lwip/apps/dhcpserver/dhcpserver.c @@ -454,18 +454,13 @@ static u8_t *add_offer_options(dhcps_t *dhcps, u8_t *optptr) } } - *optptr++ = DHCP_OPTION_DNS_SERVER; - *optptr++ = 4; if (dhcps_dns_enabled(dhcps->dhcps_dns)) { + *optptr++ = DHCP_OPTION_DNS_SERVER; + *optptr++ = 4; *optptr++ = ip4_addr1(&dhcps->dns_server); *optptr++ = ip4_addr2(&dhcps->dns_server); *optptr++ = ip4_addr3(&dhcps->dns_server); *optptr++ = ip4_addr4(&dhcps->dns_server); - }else { - *optptr++ = ip4_addr1(&ipadd); - *optptr++ = ip4_addr2(&ipadd); - *optptr++ = ip4_addr3(&ipadd); - *optptr++ = ip4_addr4(&ipadd); } ip4_addr_t broadcast_addr = { .addr = (ipadd.addr & dhcps->dhcps_mask.addr) | ~dhcps->dhcps_mask.addr };