Wed 25 Nov 2015 06:48:35 AM UTC, original submission:
hi,
My device's dhcp server does not work after upgrade from lwip-1.4.0rc1 to lwip-1.4.1.
In my case, the device is running as an AP and dhcp server.
So I use PC to connect this device and do some configuration.
After upgrading to lwip-1.4.1, the PC can associate the AP but fail to
get ip from the dhcp server.
I found the bad commit is:
commit 4849eb4c543ea4ddc9869ee51698d4760d107cb0
Author: Simon Goldschmidt <goldsimon@gmx.de>
Date: Fri Sep 9 22:25:59 2011 +0200
fixed bug #34072: UDP broadcast is received from wrong UDP pcb if udp port matches
Below is my run time variable status:
broadcast is true
ip_addr_isany(&pcb->local_ip) is false
ip_addr_netcmp(&pcb->local_ip, ip_current_dest_addr(), &inp->netmask) is false
&pcb->local_ip: 192 .168 .10 .1
ip_current_dest_addr(): 255 .255 .255 .255
&inp->netmask: 255 .255 .255 .0
It works if I did below changes:
diff --git a/src/core/udp.c b/src/core/udp.c
index 32c7d38..1c2733b 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -246,13 +246,13 @@ udp_input(struct pbuf p, struct netif inp)
ip_addr_ismulticast(¤t_iphdr_dest) ||
#endif /* LWIP_IGMP */
#if IP_SOF_BROADCAST_RECV
- (broadcast && ip_get_option(pcb, SOF_BROADCAST) &&
+ (broadcast && ip_get_option(pcb, SOF_BROADCAST) /*&&
(ip_addr_isany(&pcb->local_ip) ||
- ip_addr_netcmp(&pcb->local_ip, ip_current_dest_addr(), &inp->netmask)))) {
+ ip_addr_netcmp(&pcb->local_ip, ip_current_dest_addr(), &inp->netmask))*/)) {
#else /* IP_SOF_BROADCAST_RECV */
- (broadcast &&
+ (broadcast /*&&
(ip_addr_isany(&pcb->local_ip) ||
- ip_addr_netcmp(&pcb->local_ip, ip_current_dest_addr(), &inp->netmask)))) {
+ ip_addr_netcmp(&pcb->local_ip, ip_current_dest_addr(), &inp->netmask))*/)) {
#endif /* IP_SOF_BROADCAST_RECV */
local_match = 1;
if ((uncon_pcb == NULL) &&
|