lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] what this error is for????


From: David Empson
Subject: Re: [lwip-users] what this error is for????
Date: Mon, 16 Jun 2008 14:56:17 +1200

According to debug.h, LWIP_ERROR is supposed to be defined as follows, unless you have your own definition:
 
#define LWIP_ERROR(m,e,h) do { if (!(e)) { LWIP_PLATFORM_ASSERT(m); h;}} while (0)
 
In other words, LWIP_ERROR does an assertion if the _expression_ in the second parameter is FALSE.
 
In this specific case, the test is confirming that netif is not equal to NULL, which is required for the operation of etharp_ip_input(). If netif is NULL, it prints the error message and returns. If netif is not NULL, the code continues as normal.
 
There have been some changes in this area since LWIP 1.2.0. In that version, LWIP_ERROR() had one parameter and simply printed an error message, and the corresponding code in etharp.c used LWIP_ASSERT().
 
Perhaps you have your own implementation of LWIP_ERROR which has the test condition reversed? Make sure it is testing for the second parameter not being true.
 
Alternatively, perhaps you have occasions where this function is being called with netif equal to NULL, which will trigger that LWIP_ERROR.
 
Personally, I think this notation is confusing. If I hadn't looked at the header files, I'd assume something called "LWIP_ERROR" means "It is an error if the following condition is true". It actually means the opposite. In my opinion, this should be using the term ASSERT in some way, rather than ERROR.
 
----- Original Message -----
Sent: Monday, June 16, 2008 2:31 AM
Subject: [lwip-users] what this error is for????


hi all,
 
AM using the lwip1.3 in my project.... when i receive the frame from the network interface... the error pops up at belows line..
 
void etharp_ip_input(struct netif *netif, struct pbuf *p)
{
  struct ethip_hdr *hdr;
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
 /* Only insert an entry if the source IP address of the
     incoming IP packet comes from a host on the local network. */
  hdr = p->payload;
  /* source is not on the local network? */
  if (!ip_addr_netcmp(&(hdr->ip.src), &(netif->ip_addr), &(netif->netmask))) {
    /* do nothing */
    return;
  }
 
 
what this error is for?? my understanding is, when i initialize the netif struct, netif is not going to be NULL at any time... and in my project i have initialized the netif, even though this error occurs.....
 
and if i comment it out, the packet is forwarded to the ip layer without any problem....
 
thank you in advance.

--

Regards,
Kirankumar K B
 


_______________________________________________
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]