From 781551ff139974b0cc8f1741149d674b7a0277ab Mon Sep 17 00:00:00 2001 From: Jin-Seong Kim Date: Mon, 27 Mar 2017 16:32:14 +0900 Subject: [PATCH] net/lwip: fix DHCP packet handling problem on lwIP This commit is to fix dhcp packet handling problem on lwIP stack - to pass dhcp packets regardless of destination address, IP_ACCEPT_LINK_LAYER_ADDRESSING is needed - dhcp packets are addressed using link layer addressing (such as Ethernet MAC) so we must not filter on IP Change-Id: If67298aed453876adf7792bf67de75face0903e6 Signed-off-by: Jin-Seong Kim --- os/net/lwip/src/core/ipv4/ip.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/os/net/lwip/src/core/ipv4/ip.c b/os/net/lwip/src/core/ipv4/ip.c index 7288ea5..9a968ff 100644 --- a/os/net/lwip/src/core/ipv4/ip.c +++ b/os/net/lwip/src/core/ipv4/ip.c @@ -107,7 +107,18 @@ #endif /* LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT) */ #else /* LWIP_DHCP */ +/* + * To handle DHCP packets on netutils applications, + * enable IP_ACCEPT_LINK_LAYER_ADDRESSING configurations for either NETUTILS DHCPC or NETUTILS DHCPD + */ +#if defined (CONFIG_NETUTILS_DHCPC) || defined (CONFIG_NETUTILS_DHCPD) +#define IP_ACCEPT_LINK_LAYER_ADDRESSING 1 +#define DHCP_CLIENT_PORT 68 +#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) ((port) == PP_NTOHS(DHCP_CLIENT_PORT)) +#else #define IP_ACCEPT_LINK_LAYER_ADDRESSING 0 +#endif /* defined (CONFIG_NETUTILS_DHCPC) || defined (CONFIG_NETUTILS_DHCPS) */ + #endif /* LWIP_DHCP */ /** -- 2.7.4