Hi,
   The code for the ping agent in apps/ping.cc is written for
"connected agents" it assumes that you connect the agents in the tcl file to
associate the address. But when you use broadcast address, you would not
connect the agents so one has to set the address fields of ip header.

What is required is to modify the recv funtion to set the ip header fields
of reply packet saddr,daddr, sport,dport.

hdr_ip* hdrip = (hdr_ip*)pkt->access(off_ip_);

Packet* pktret = allocpkt();
 hdr_ip* hdripret = (hdr_ip*)pktret->access(off_ip_);

hdripret->daddr=hdrip->saddr;
hdripret->daddr=hdrip->saddr;
// i add variable saddr in ping agent and set its value thru another command
to the address of the
// node before sending any packet
hdripret->saddr=saddr;
hdripret->sport=hdrip->dport;

add the rest of the code and then send the packet

regards
sanjay raghani

-----------------------------------------------------------------------------------
Hi,

I was messing around with the ping agent from Marc Greis' Tutorial, and
wanted to change the ping to a broadcast.  I added the IP header stuff as
I've seen elsewhere online,

hdr_ip *ip = hdr_ip::access(pkt);
        ip->daddr() = IP_BROADCAST;

and now I get this error:

-- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
        _o996: no target for slot -1
        _o996 type: Classifier/Port
content dump:
classifier _o996
        0 offset
        0 shift
        2147483647 mask
        2 slots
                slot 0: _o1111 (Agent/Ping)
                slot 255: _o983 (Agent/DSDV)

I can't find out how to fix it and I don't know anything about Classifiers.
 I realize that there was no port assigned to Ping, but how do I fix this?

My other question is, do I have to use an IP_Broadcast?  Can I just use a
MAC_BROADCAST?

Kathy

Reply via email to