if(rt->rt_flags == RTF_UP) {
assert(rt->rt_hops != INFINITY2);
// attack can be done : drop all /selective packets
// Modify [or]injectflase packets
//Here, only dropping packets are considered
if((ch->ptype()!=PT_AODV) && (malicious==1000))
{
if(t < CURRENT_TIME)
{
t=t+2;
drop(p, DROP_RTR_NO_ROUTE);
}
else
forward(rt, p, 0.8);
}
else
forward(rt, p, NO_DELAY);
}
else {
Packet *rerr = Packet::alloc();
structhdr_aodv_error *re = HDR_AODV_ERROR(rerr);
assert (rt->rt_flags == RTF_DOWN);
re->DestCount = 0;
re->unreachable_dst[re->DestCount] = rt->rt_dst;
re->unreachable_dst_seqno[re->DestCount] = rt->rt_seqno;
re->DestCount += 1;
fprintf(stderr, “%s: sending RERR…\n”, __FUNCTION__);
if(malicious==1000) drop(p, DROP_RTR_NO_ROUTE);
else
sendError(rerr, false);
drop(p, DROP_RTR_NO_ROUTE);
|