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

Re: [ns] Broadcasting to all neighbors



You have to set the classifier so that it duplicates packets with bcast adress 
of -1 to it's slots. Actually you have to set a target fot this slot, this could 
be another classifier that would do the broadcast.

How about using a "BcastAddressClassifier" (classifier-addr.h, .cc)?

Then again the brute force approach might be simpler if you don't need a 
"generic" way of doing it...

Or then, again, somebody might have a better solution. Posting...

>X-Authentication-Warning: mash.CS.Berkeley.EDU: majrdomo set sender to 
[email protected] using -f
>Date: Fri, 02 Jun 2000 15:29:50 -0600
>From: Jeff Boleng <[email protected]>
>X-Accept-Language: en
>MIME-Version: 1.0
>To: [email protected]
>Subject: [ns] Broadcasting to all neighbors
>Content-Transfer-Encoding: 7bit
>
>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]

Tarik