lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] lwip 1.3.0-stable, handling input in ethernetif_input()


From: B B
Subject: RE: [lwip-users] lwip 1.3.0-stable, handling input in ethernetif_input()
Date: Thu, 20 Nov 2008 09:56:40 +0100



Hi again,
 

I just noticed a function called ethernet_input(). Weird, haven't noticed that before.
Anyways, the contents of that function answers my first question.
 
But:
 
Has there been made crucial updates to the lwip core files, since the lwip 1.3.0 stable version was released ?
If yes, does these changes affect me ?
 
best regards,
Martin






From: address@hidden
To: address@hidden
Subject: [lwip-users] lwip 1.3.0-stable, handling input in ethernetif_input()
Date: Thu, 20 Nov 2008 08:54:00 +0100

Hi list,
 
I am using lwip 1.3.0-stable, I am using the Netconn API.
Through lwip i run a webserver and a server client.
In lwip i use the following:
 
- TCP
- DHCP
- ARP
- UDP (DHCP)
 
I have through the last two days, reviewed my port files, ethernetif.c and
sys_arch.c. Which led to small changes in the code, which resulted in greater
stability. However, i have seen two different implementations of ethernetif_input(),
where the input is handled differently (see below), but both seem to work.
 
So my questions are:

1. Are both implementations of the ethernetif_input(), valid ? (see code below)
2. Has there been made crucial updates to the lwip core files, since the lwip 1.3.0 stable version was released ?
2.a If yes, does these changes affect me ?

1. (ETHARP_TRUST_IP_MAC is defined in lwipopts.h)
static void
ethernetif_input( void * pvParameters )
{
....
switch( htons( ethhdr->type ) )
 {
  // IP packet?
 case ETHTYPE_IP:
  // pass to network layer
  if (xNetIf->input( p, xNetIf ) != ERR_OK)
  {
   pbuf_free( p );
   p = NULL;
  }  
  break;
 
 case ETHTYPE_ARP:
  
#if ETHARP_TRUST_IP_MAC
  // update ARP table
   etharp_ip_input( xNetIf, p );
#endif
  // pass p to ARP module
   etharp_arp_input( xNetIf, ethernetif->ethaddr, p );
   break;
 
  default:
   pbuf_free( p );
   p = NULL;
   break;
 }
}
 
2.
static void
ethernetif_input( void * pvParameters )
{
....
 switch( htons( ethhdr->type ) )
  {
   // IP packet?
   case ETHTYPE_IP:
    // update ARP table
    etharp_ip_input( xNetIf, p );
  
    // skip Ethernet header
    pbuf_header( p, (s16_t)-sizeof(struct eth_hdr) );
  
    // pass to network layer
    if (xNetIf->input( p, xNetIf ) != ERR_OK)
    {
     pbuf_free( p );
     p = NULL;
    }  
    break;
  
   case ETHTYPE_ARP:
    // pass p to ARP module
    etharp_arp_input( xNetIf, ethernetif->ethaddr, p );
    break;
  
   default:
    pbuf_free( p );
    p = NULL;
    break;
  }
}
 
best regards,
Martin








Connect to the next generation of MSN Messenger  Get it now!


Connect to the next generation of MSN Messenger  Get it now!

reply via email to

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