net/lwip: fix DHCP packet handling problem on lwIP
authorJin-Seong Kim <jseong82.kim@samsung.com>
Mon, 27 Mar 2017 07:32:14 +0000 (16:32 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:02 +0000 (12:02 +0900)
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 <jseong82.kim@samsung.com>
os/net/lwip/src/core/ipv4/ip.c

index 7288ea5..9a968ff 100644 (file)
 #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 */
 
 /**