lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] etharp oddity


From: Leon Woestenberg
Subject: Re: [lwip-devel] etharp oddity
Date: Wed, 21 Jul 2004 01:18:01 +0200
User-agent: Mozilla Thunderbird 0.7.1 (Windows/20040626)

Tony,

Mountifield, Tony wrote:

Looking at etharp.c, in the function etharp_output(), unicast packets get 
passed onto etharp_query(), with either their own IP address or that of the 
default gateway. etharp_query() causes an ARP request to *always* be sent, for 
*every* packet, before it even checks the ARP table! This doesn't seem right.

I found that the bug was introduced due to the dual functionality in etharp_query(): it both sends out ARP requests as well as queues packets on the entry. Thanks
for reporting.

I have changed the behaviour as follows. Note that calling etharp_query() with a NULL packet, will still send out an ARP request, even when already stable. This
is to forcefully check against a known IP address.

See CVS HEAD for the change. JavaDoc copy below.

Regards, Leon.

/**
* Send an ARP request for the given IP address and/or queue a packet.
*
* If the IP address was not yet in the cache, a pending ARP cache entry
* is added and an ARP request is sent for the given address. The packet
* is queued on this entry.
*
* If the IP address was already pending in the cache, a new ARP request
* is sent for the given address. The packet is queued on this entry.
*
* If the IP address was already stable in the cache, and a packet is
* given, it is directly sent and no ARP request is sent out.
*
* If the IP address was already stable in the cache, and no packet is
* given, an ARP request is sent out.
*
* @param netif The lwIP network interface on which ipaddr
* must be queried for.
* @param ipaddr The IP address to be resolved.
* @param q If non-NULL, a pbuf that must be delivered to the IP address.
* q is not freed by this function.
*
* @return
* - ERR_BUF Could not make room for Ethernet header.
* - ERR_MEM Hardware address unknown, and no more ARP entries available
*   to query for address or queue the packet.
* - ERR_MEM Could not queue packet due to memory shortage.
* - ERR_RTE No route to destination (no gateway to external networks).
* - ERR_ARG Non-unicast address given, those will not appear in ARP cache.
*
*/





reply via email to

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