lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwIP 1.3.1 : src IP chk drops DHCP (discover) packets


From: Mandeep Sandhu
Subject: Re: [lwip-users] lwIP 1.3.1 : src IP chk drops DHCP (discover) packets
Date: Thu, 3 Sep 2009 19:03:52 +0530

On Thu, Sep 3, 2009 at 5:59 PM, Kieran Mansley<address@hidden> wrote:
> On Thu, 2009-09-03 at 13:33 +0530, Mandeep Sandhu wrote:
>> We are handling the case of DHCP client packets in a special manner
>> and exempting
>> them from the src IP check. Can't extend the check for DHCP server port as 
>> well?
>>
>> Or is there any other way to work around this?
>>
>> This same app works fine with lwIP 1.1.1 which currently ships with ecos 3.0.
>
> I would like to understand what changed between 1.1.1 and 1.3.1 to stop
> this working.  Any ideas?

Here's the new bit in ip_input in 1.3.1 (not there in 1.1.1)

<snip>
...
#if LWIP_DHCP
  if (check_ip_src)
#endif /* LWIP_DHCP */
  {  if ((ip_addr_isbroadcast(&(iphdr->src), inp)) ||
         (ip_addr_ismulticast(&(iphdr->src)))) {
      /* packet source is not valid */
      LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE | 1, ("ip_input: packet
source is not valid.\n"));
      /* free (drop) packet pbufs */
      pbuf_free(p);
      IP_STATS_INC(ip.drop);
      snmp_inc_ipinaddrerrors();
      snmp_inc_ipindiscards();
      return ERR_OK;
    }
  }
...
</snip>

check_ip_src is set to 1 initially and reset only if netif is NULL and
UDP dest port is
DHCP_CLIENT_PORT.

Otherwise, it checks if the src IP is bcast or not. If it is, it drops
the packet. Why was this
added?

In my case it always finds a netif since the dest IP is
255.255.255.255, so check_ip_src
is always set.

I have the DHCP feature enable as my second interface needs to be configured
via DHCP. The first interface (et0) is statically configured with an
IP addr and my
DHCP server listens on this interface.

Another question while going through the code:

In ip_addr_isbroadcast(), why is not seeing if the NETIF_FLAG_BROADCAST is set
for the passed interface. I see that it simply returns 1 if the ip
addr passed is either
bcast or 0.0.0.0 w/o considering if the interface allows bcast or not!

Shouldn't we do that check _before_ we check the IP addr?

Thanks,
-mandeep

>
> Kieran
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]