Re: [lwip-users] Using BOOTP with lwIP

2017-08-10 Thread Amit Ashara
Thansk Simon. That did the trick.

Just an information to anyone looking for it, I put the following define in
my project lwipopts.h

#define LWIP_IP_ACCEPT_UDP_PORT(dst_port) ((dst_port) == PP_NTOHS(68))

#define LWIP_DHCP   0   // default is 0


On Wed, Aug 9, 2017 at 2:30 PM, goldsi...@gmx.de  wrote:

> Amit Ashara wrote:
>
>> I am trying to get BOOTP working with lwIP 1.4.1 stack. [..]However the
>> call back function for udp does not get invoked. After debugging the same,
>> the issue seems to be in ip.c file.
>>
>
> Of course that doesn't work out of the box. DHCP has a workaround, which
> is disabled for LWIP_DHCP==0. However, by defining LWIP_IP_ACCEPT_UDP_PORT
> correctly, you can get the same behaviour for your own application.
>
> Simon
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] Using BOOTP with lwIP

2017-08-09 Thread Amit Ashara
Hello All,

I am trying to get BOOTP working with lwIP 1.4.1 stack. I am able to
configure the device in STATIC IP address mode and send the BOOTP packet
and have the BOOTP server send the BOOTP response. However the call back
function for udp does not get invoked. After debugging the same, the issue
seems to be in ip.c file. In the function ip_input

  if ((netif_is_up(netif)) && (!ip_addr_isany(&(netif->ip_addr {
/* unicast to this interface address? */
if (ip_addr_cmp(_iphdr_dest, &(netif->ip_addr)) ||
/* or broadcast on this interface network address? */
ip_addr_isbroadcast(_iphdr_dest, netif)) {
  LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet accepted on interface
%c%c\n",
  netif->name[0], netif->name[1]));
  /* break out of for loop */
  break;
}
#if LWIP_AUTOIP
/* connections to link-local addresses must persist after changing
   the netif's address (RFC3927 ch. 1.9) */
if ((netif->autoip != NULL) &&
ip_addr_cmp(_iphdr_dest, &(netif->autoip->llipaddr))) {
  LWIP_DEBUGF(IP_DEBUG, ("ip_input: LLA packet accepted on
interface %c%c\n",
  netif->name[0], netif->name[1]));
  /* break out of for loop */
  break;
}
#endif /* LWIP_AUTOIP */

the check seems to fail at ip_addr_isany causing the netif pointer to be
NULL and hence later in the code the udp stack call is not occuring. Since
BOOTP requires the client to send the BOOTP request packet with IP address
0.0.0.0 the server responds to the IP address 0.0.0.0 which causes the
check to fail. Is there some way I can bypass the same to get the BOOTP
response to the application layer.

Furthermore: the same logic exists on lwip 2.0.2 so my assumption would be
that it would not be possible with 2.0.2. I do understand that DHCP has
superseded BOOTP, but legacy network still relies on the same.

Regards
Amit
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users