Skip to content
Extraits de code Groupes Projets
Valider cbb3f70b rédigé par eddietwo's avatar eddietwo
Parcourir les fichiers

add warning on missing dest IP addr anno; doc updates (inspired by Tim Wilson...

add warning on missing dest IP addr anno; doc updates (inspired by Tim Wilson <timwilson@mediaone.net>
parent 50f19e20
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -173,16 +173,20 @@ ARPQuerier::expire_hook(Timer *, void *thunk)
void
ARPQuerier::send_query_for(const IPAddress &want_ip)
{
click_ether *e;
click_ether_arp *ea;
WritablePacket *q = Packet::make(sizeof(*e) + sizeof(*ea));
static bool zero_warned = false;
if (!want_ip && !zero_warned) {
click_chatter("%s: querying for 0.0.0.0; missing dest IP addr annotation?");
zero_warned = true;
}
WritablePacket *q = Packet::make(sizeof(click_ether) + sizeof(click_ether_arp));
if (q == 0) {
click_chatter("in arp querier: cannot make packet!");
assert(0);
}
memset(q->data(), '\0', q->length());
e = (click_ether *) q->data();
ea = (click_ether_arp *) (e + 1);
click_ether *e = (click_ether *) q->data();
click_ether_arp *ea = (click_ether_arp *) (e + 1);
memcpy(e->ether_dhost, "\xff\xff\xff\xff\xff\xff", 6);
memcpy(e->ether_shost, _my_en.data(), 6);
e->ether_type = htons(ETHERTYPE_ARP);
......
......@@ -2,45 +2,52 @@
#define ARPQUERIER_HH
/*
* =c
* ARPQuerier(I, E)
* ARPQuerier(NAME)
* =s Ethernet, encapsulation
* encapsulates IP packets in Ethernet headers found via ARP
* =d
* Handles most of the ARP protocol. Argument I should be
* this host's IP address, and E should be this host's
* Ethernet address.
*
* Expects ordinary IP packets on input 0, each with a destination
* address annotation. If an Ethernet address is already known
* for the destination, the IP packet is wrapped in an Ethernet
* header and sent to output 0. Otherwise the IP packet is saved and
* an ARP query is sent instead. If an ARP response arrives
* on input 1 for an IP address that we need, the mapping is
* recorded and the saved IP packet is sent.
*
* The ARP reply packets on input 1 should include the Ethernet header.
*
* If a host has multiple interfaces, it will need multiple
* instances of ARPQuerier.
*
* ARPQuerier may have one or two outputs. If it has two, then ARP queries
* are sent to the second output.
*
* In the one-argument form, NAME should be shorthand for
* both an IP and an Ethernet address; see AddressInfo(n).
*
* =e
* c :: Classifier(12/0806 20/0001, 12/0800, ...);
* a :: ARPQuerier(18.26.4.24, 00:00:C0:AE:67:EF);
* c[0] -> a[1];
* c[1] -> ... -> a[0];
* a[0] -> ... -> ToDevice(eth0);
*
* =a
* ARPResponder, ARPFaker, AddressInfo
*/
=c
ARPQuerier(I, E)
ARPQuerier(NAME)
=s Ethernet, encapsulation
encapsulates IP packets in Ethernet headers found via ARP
=d
Handles most of the ARP protocol. Argument I should be
this host's IP address, and E should be this host's
Ethernet address.
(In the one-argument form, NAME should be shorthand for
both an IP and an Ethernet address; see AddressInfo(n).)
Packets arriving on input 0 should be IP packets, and must have their
destination address annotations set.
If an Ethernet address is already known
for the destination, the IP packet is wrapped in an Ethernet
header and sent to output 0. Otherwise the IP packet is saved and
an ARP query is sent instead. If an ARP response arrives
on input 1 for an IP address that we need, the mapping is
recorded and the saved IP packet is sent.
The ARP reply packets on input 1 should include the Ethernet header.
If a host has multiple interfaces, it will need multiple
instances of ARPQuerier.
ARPQuerier may have one or two outputs. If it has two, then ARP queries
are sent to the second output.
=e
c :: Classifier(12/0806 20/0001, 12/0800, ...);
a :: ARPQuerier(18.26.4.24, 00:00:C0:AE:67:EF);
c[0] -> a[1];
c[1] -> ... -> a[0];
a[0] -> ... -> ToDevice(eth0);
=a
ARPResponder, ARPFaker, AddressInfo
*/
#include <click/element.hh>
#include <click/etheraddress.hh>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter