Hi,

I'm writing a routing protocol and have been racking my brains on what could
possibly be happening to these packets. Everything else seems to be working
ok, but when i send these particular packets (ORP_RREP), the receiver does
not seem to be receiving them. I put printf statements upon every receipt of
a packet and the receiver just doesn't seem to be receiving it. The sender
is sending out correctly i'm pretty sure. I checked the interfaces and
routing tables and it seems to be all on track... it just seems that these
packets are "getting sent", but then completely "disppearing". My question
is: what are things in NS2 that would make a packet get "lost". For example,
when i was coding earlier, i forgot to do ch->direction() = hdr_cmn::DOWN()
so the packets weren't really getting delivered even though it was
technically "scheduling". Is there anything else i can check for?

My send function looks like this. Thanks

void
ORP::send_orp_rrep(Packet *rreq_p)
{
 Packet *p = Packet::alloc();
 struct hdr_orp_rreq_pkt *rq  = HDR_ORP_RREQ_PKT(rreq_p);
 struct hdr_cmn *ch     = HDR_CMN(p);
 struct hdr_ip *ih     = HDR_IP(p);
 struct hdr_orp_rrep_pkt *rh  = HDR_ORP_RREP_PKT(p);

 // lookup the route back to the source of RREQ:
 orp_rt_entry *rt = rtable_.rt_lookup(rq->rq_src);
 // make sure we got something:
 assert(rt);

 // Fill out the RREP packet
 // ch->uid() = 0;
 rh->rp_type = ORPTYPE_RREP;
 //rh->rp_flags = 0x00;
 rh->rp_hop_count = rt->rt_hops + 1; // number of hops until destination
(incremented by 1 everytime forwarded)
 rh->rp_dst = rq->rq_dst; // this is to the FINAL destination
 // rh->rp_dst_seqno = rq->rq_dst_seqno;
 rh->rp_dst_seqno = seq_num();
 rh->rp_src = ra_addr();  // this is the source of rendezvous node
 rh->rp_timestamp = CURRENT_TIME; // the time request was sent

 // ch->uid() = 0;
 ch->ptype() = PT_ORP;
 ch->size() = IP_HDR_LEN + rh->size();
 ch->iface() = -2;
 ch->error() = 0;
 ch->addr_type() = NS_AF_NONE;
 ch->next_hop() = rt->rt_nexthop;
 ch->direction() = hdr_cmn::DOWN;
 ch->prev_hop_ = ra_addr();          // ORP hack

 ih->saddr() = ra_addr(); // I'm the original source of pkt
 ih->daddr() = rq->rq_src; // sending it back to the source of RREQ
 ih->sport() = RT_PORT;
 ih->dport() = RT_PORT;
 ih->ttl_ = NETWORK_DIAMETER;

 // send it out!
 Scheduler::instance().schedule(rt->rt_interface, p, 0.0001*Random::uniform
());
 printf("Sending ORP RREP from %d to %d at %.2f (Requesting Node: %d)\n",
ra_addr(), rt->rt_nexthop, Scheduler::instance().clock(), rq->rq_src);
 Packet::free(p);
}
*
*

Reply via email to