From 622e6d8238489b04219af34e0377b050a17a4d4c Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 31 Jan 2015 20:51:21 +0800 Subject: [PATCH] [lwIP] Add Router and DNS server information in DHCP server. --- components/net/lwip_dhcpd/dhcp_server.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/net/lwip_dhcpd/dhcp_server.c b/components/net/lwip_dhcpd/dhcp_server.c index d77448c89..47547a598 100644 --- a/components/net/lwip_dhcpd/dhcp_server.c +++ b/components/net/lwip_dhcpd/dhcp_server.c @@ -318,6 +318,24 @@ static void dhcpd_thread_entry(void *parameter) *dhcp_opt++ = 0xFF; *dhcp_opt++ = 0x00; +#ifdef DHCPD_USING_ROUTER + // DHCP_OPTION_ROUTER + *dhcp_opt++ = DHCP_OPTION_ROUTER; + *dhcp_opt++ = 4; + *dhcp_opt++ = DHCPD_SERVER_IPADDR0; + *dhcp_opt++ = DHCPD_SERVER_IPADDR1; + *dhcp_opt++ = DHCPD_SERVER_IPADDR2; + *dhcp_opt++ = 1; +#endif + + // DHCP_OPTION_DNS_SERVER, use the default DNS server address in lwIP + *dhcp_opt++ = DHCP_OPTION_DNS_SERVER; + *dhcp_opt++ = 4; + *dhcp_opt++ = 208; + *dhcp_opt++ = 67; + *dhcp_opt++ = 222; + *dhcp_opt++ = 222; + // DHCP_OPTION_LEASE_TIME *dhcp_opt++ = DHCP_OPTION_LEASE_TIME; *dhcp_opt++ = 4;