lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] ARP ETHARP_TRY_HARD


From: Leon Woestenberg
Subject: Re: [lwip-users] ARP ETHARP_TRY_HARD
Date: Sun, 28 Nov 2004 18:48:26 +0100
User-agent: Mozilla Thunderbird 0.7.1 (Windows/20040626)

Hello Paul,

thanks for looking in the code, I enjoy having extra pairs of eyes checking my code!

Paul C wrote:

Leon,

I like the patches you have put in etharp.c but I still think that the
exit if !ETHARP_TRY_HARD is missing.
Could you explain why please?

I think the current code is correct in the find_entry(..., flags = 0) case.

find_entry will:
a) find candidate ARP entries for the given IP address
b) select the least-cache-destructive entry
c) see if it may alter that entry

Steps a and b are non-modifying, and are marked a and b in the source code comments of etharp.c
Step c ONLY recycles existing entries when an empty ARP entry is found:
Step c ALWAYS fills empty ARP entries. (I assume you do not want that to happen, am I correct??)

See etharp.c line 308

 /* allowed to recycle a entry? */
 if (flags & ETHARP_TRY_HARD) {
   /* recycle (no-op for an already empty entry) */
   arp_table[i].state = ETHARP_STATE_EMPTY;
 }

Yes, it will fill up the cache with any broadcast traffic, BUT only until the cache
is full. Once the cache is full, it will return ERR_MEM, see line 327:

 /* no entry available */
 } else {
   /* return failure */
   i = (s8_t)ERR_MEM;
 }

Only if ETHARP_TRY_HARD is specified, it will recycle cache entries.

At least this is exactly what I think should happen.

Please let me know where my thoughts go wrong, or what you expected
the algorithm to do?

Regards,

Leon Woestenberg.





reply via email to

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