lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] question about compile minimal under Fedora 2


From: Jim Gibbons
Subject: Re: [lwip-users] question about compile minimal under Fedora 2
Date: Tue, 14 Jun 2005 08:51:06 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

I was hoping that you would get a more expert opinion than mine, but I haven't seen any, so I guess mine will have to serve.

It looks to me as though your model for the use of lwIP relates to an older version of lwIP.  etharp_ip_input used to return NULL always.  etharp_arp_input used to return a pbuf if it needed to have an arp output packet transmitted. 

In 1.1.0, someone modified etharp, so that it would return void from etharp_ip_input and etharp_arp_input.  etharp_ip_input probably should have been that way all along.  etharp_arp_input was perfectly capable of calling the output function itself, since it had a netif.  It all makes more sense the way it is now, but it does make some old code implementations obsolete.

Dyan Chiang wrote:
I port lwip to Fedora 2(kernel 2.6). And just when I start to compiler the /minimal porject
gcc version is 3.3.3 and the make program exit with the following error:
minitapif.c:271:error: void value not ignored as it ought to be
minitapif.c:276:error: void value not ignored as it ought to be
 
and I check the minitapif.c file I find that on the line 271 and 276 is the "mintapif_input()" function as here(I mark it with red color).
it call void etharp_ip_input() and void etharp_arp_input()
static void
mintapif_input(struct netif *netif)
{
  struct mintapif *mintapif;
  struct eth_hdr *ethhdr;
  struct pbuf *p, *q;
 

  mintapif = netif->state;
 
  p = low_level_input(mintapif);
 
  if (p != NULL) {
 
#ifdef LINK_STATS
    lwip_stats.link.recv++;
#endif /* LINK_STATS */
 
    ethhdr = p->payload;
 
    q = NULL;
    switch (htons(ethhdr->type)) {
    case ETHTYPE_IP:
      q = etharp_ip_input(netif, p);
      pbuf_header(p, -14);
      netif->input(p, netif);
      break;
    case ETHTYPE_ARP:
      q = etharp_arp_input(netif, mintapif->ethaddr, p);
      break;
    default:
      pbuf_free(p);
      break;
    }
    if (q != NULL) {
      low_level_output(netif, q);
      pbuf_free(q);
    }
 
  }
}
 
And I go to the lwip-1.0.0/src/netif/etharp.c and lwip-1.0.0/src/include/netif/etharp.h
find the
void etharp_ip_input(struct netif *netif, struct pbuf *p);
void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
         struct pbuf *p);
change to the following:
struct pbuf *  etharp_ip_input(struct netif *netif, struct pbuf *p);
struct pbuf *  etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
         struct pbuf *p);
 
and I compiler again. Now compiling is success. 
I have some question to ask:
 
1. Is it OK if I do such changes?
2. Why it is declare as void and in minitapif.c call it again with return. What is it aim try to accomplish?
 
 
Thank you very much.
Please forgive me my ungreatefully asking question.
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

--
Jim Gibbons
address@hidden
Gibbons and Associates, Inc.
TEL: (408) 984-1441
900 Lafayette, Suite 704, Santa Clara, CA
FAX: (408) 247-6395



reply via email to

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