[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Broadcasting to all neighbors
Have a look to arp.cc for the arprequest() function. It seems you should
add:
cmnhdr->iface() = iface_literal::ANY_IFACE;
>From packet.h:
ANY_IFACE= -2 /*
* hashnode with iif == ANY_IFACE_
* matches any pkt iface (imported from TCL);
* this value should be different from
* hdr_cmn::UNKN_IFACE (packet.h)
*/
I believe you should also write:
cmnhdr -> direction() = hdr_cmn::DOWN;
On Fri, 02 Jun 2000, Jeff Boleng wrote:
> Date: Fri, 02 Jun 2000 15:29:50 -0600
> To: [email protected]
> From: Jeff Boleng <[email protected]>
> Subject: [ns] Broadcasting to all neighbors
>
> I hate to ask a naive question, but how do you broadcast to
> all a node's neighbors? I am writing a layer 3 agent, and
> trying to send a packet to an explicit port on all the
> neighboring nodes. Here is my current code snippet:
>
> ...// this is all in the command function for my agent
>
> Packet* pkt = allocpkt();
> hdr_cmn* cmnhdr = (hdr_cmn*)pkt->access(off_cmn_);
> hdr_ip* iphdr = (hdr_ip*)pkt->access(off_ip_);
>
> ...// setting up all my new header information
>
> cmnhdr->next_nop_ = -1; // according to the docs, this is
> broadcast
> iphdr->daddr() = IP_BROADCAST;
> iphdr->dport() = 254; // this is the port number all my
> agents run on
>
> ...// just some things I do to track queue lengths, etc.
>
> send(pkt, 0);
>
>
> This doesn't work. I get the following error from the
> classifier object's classify() method:
>
> _o11: no target for slot -1
>
> This is the address classifier saying that it doesn't have
> anything on that slot in the hash table.
>
> I could take the brute force and ignorance approach and get
> the list of neighbors and send duplicate packets addressed
> to each of them, but this is ugly and defeats the purpose of
> having layers like IP provide services like broadcast.
>
> Thanks for any help I can get.
>
> Jeff Boleng
> [email protected]
>
--
Lucas Barri�re
[email protected]
http://aemiaif.lip6.fr/etudiants/lucas
UNIX is user-friendly. it's just selective about who its friends are.