[Click] How to ping response?

Egi, Norbert n.egi at lancaster.ac.uk
Mon Mar 12 15:06:58 EST 2007


Hi,
 
I thought that it will be a very simple task, but with the available click elements I can't create a simple ICMP ping responder. My problem is that I don't know how to make Click remember the ethernet header before I strip it and how to put it back later. The only way I managed to get the ICMPPingResponder element to work was to remove the ETH header of the ping request message (with Strip(14)) and send the resulting packet through the CheckIPHeader element which filled up the annotations of the packet that is required by the ICMPPingResponder. After the ICMPPingResponder I put the ETH header back (with EtherEncap) and send the packet out on the interface where it arrived. This works quite well, but I don't think that I should use the EtherEncap element with fixed destination ETH address at all as under normal circumstances the source ETH address of the ping request (which will be the destination ETH address of the ping reply) can be different. I was thinking to ARP request for the MAC address, but because the machine that sent the ping request isn't on the same network it didn't work (the ARP request went out, but of course no response came to it).
 
I guess there should be a solution for this otherwise there wouldn't be an ICMPPingResponder element.
 
Could anyone tell me how a decently working ping responder looks like?
 
This is the script I'm using:
 
c :: Classifier(12/0806 20/0001,12/0806 20/0002,12/0800,-);
out :: Queue(200) -> ToDevice(eth25);
arpq :: ARPQuerier(10.10.10.2, 00:15:17:15:5D:74);
PollDevice(eth25) -> c;
 
c[2] -> Strip(14) -> CheckIPHeader() -> Print(IP) -> icmppr :: ICMPPingResponder();

icmppr[0] -> EtherEncap(0x0800,00:15:17:15:5D:74,00:14:4F:40:75:AE) -> out;
//icmppr[0] -> GetIPAddress(16) -> [0]arpq;
icmppr[1] -> Discard;
 
c[0] -> arpr :: ARPResponder(10.10.10.2 00:15:17:15:5D:74);
arpr -> out;
arpq -> out;
c[1] -> [1]arpq;
Idle -> [0]arpq; //commented if using the line: "icmppr[0] -> GetIPAddress(16) -> [0]arpq;"
c[3] -> Discard;

Many thanks,
Norbert



More information about the click mailing list