[Click] arpquerier.{hh|cc}
Eddie Kohler
kohler at cs.ucla.edu
Thu May 26 21:49:10 EDT 2005
Hi David,
It sounds like you're looking at an old version of the code! I'd
suggest you download the anonymous CVS version of Click and have a
look at the new, even brain-break-ier ARPQuerier.
> Hi,
> I need to understand perfectly how the arpquerier element works.
> I know there is an "ARPEntry* _map[256]" to save ip-eth
> translations and packets not even translateds...
> I know there is a lock to protect access to the map...
> I know there is a timeout to check, poll, ... old map entries...
> And in short, I know how it works well.
>
> However, I have two specific doubts in relation to its implementation:
> 1. Why is the _lock variable necessary?
> I know that it is necessary to acquire and release write/read
> permission before write/read the map, but it is necessary?
> Each instance of arpquerier has its own map, so, there is no
> interference between different instances of arpquerier.
> So, is it to protect the case in that click runs in multithreading
> and the two elements that can call the push function (the two input
> ports) make it at the same time?
Exactly.
> 2. In "ARPQuerier::handle_ip(Packet* p)" function, more or less,
> there are three cases:
> a) the destination ip address of packet p is in the map and the
> corresponding ARPEntry is ok (has the correct translation).
> b) the destination ip address of packet p is in the map but the
> corresponding ARPEntry is not ok.
> c) the destination ip address of packet p is not in the map.
> In case c), handle_ip will make a new ARPEntry and will send the
> corresponding ARPRequest with send_query_for(...).
> In case b), handle_ip will add the packet to the corresponding
> ARPEntry and will send a send_query_for(...).
> And in case a), there are two possibilities depending on the
> polling flag of the corresponding ARPEntry:
> a.1) polling==0 => handle_ip will add the ethernet header to the
> packet and will send the packet.
> a.2) polling==1 => handle_ip will add the ethernet header to the
> packet, will send the packet and moreover will send the
> corresponding ARPRequest with send_query_for(...).
>
> Is the case a.2) that I don't understand:
> Why if polling==1, handle_ip will send a send_query_for(...)? The
> map has the translation, why ask for it?
Because entries expire (after 30 seconds). We need a new response to
keep the mapping refreshed.
> I know that the expire_hook function (scheduled by a Timer) is the
> responsible of set polling=1 when an ARPEntry is "old".
> But why polling and not deleting?
> Or, is like a margin of security? Is to avoid lose ARPEntries when
> the corresponding node is even in the network? Is it necessary?
Not perhaps necessary, but useful for the reason you specify (to
avoid losing entries).
Eddie
>
> Do you understand me?
> Thank you very very much!
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
More information about the click
mailing list