[Ns-developers] Possible Bug in 802.11 MAC!!!!

Zaheer   zahheer at hotmail.com
Tue Jul 19 02:26:19 PDT 2005


Hi,

While going through 802.11 MAC implementation in 
ns-allinone-2.28\ns-2.28\mac\mac-802_11.cc, I think there is a bug in 
function Mac802_11::recvDATA(Packet *p). Here is the suspected part of code:

if ((bss_id() == addr()) && ((u_int32_t)ETHER_ADDR(dh->dh_ra)!= 
MAC_BROADCAST)&& ((u_int32_t)ETHER_ADDR(dh->dh_3a) != addr())) {

     struct hdr_cmn *ch = HDR_CMN(p);
     u_int32_t dst = ETHER_ADDR(dh->dh_3a);
     u_int32_t src = ETHER_ADDR(dh->dh_ta);

    /* if it is a broadcast pkt then send a copy up my stack also */

    if (dst == MAC_BROADCAST) {
        uptarget_->recv(p->copy(), (Handler*) 0);
    }

    ch->next_hop() = dst;
    STORE4BYTE(&src, (dh->dh_3a));
    ch->addr_type() = NS_AF_ILINK;
    ch->direction() = hdr_cmn::DOWN;
}

In this code at first 'if' there is a check 
((u_int32_t)ETHER_ADDR(dh->dh_ra)!= MAC_BROADCAST) which mean destination of 
packet should not be MAC_Broadcast but  in side 'if' there is second if 
checking if "dst == MAC_BROADCAST". This do not make any sense!!!!!! Is this 
'dst' different than "dh->dh_ra"???? As i see "dst = ETHER_ADDR(dh->dh_ra);" 
line at the start of this function.

Please correct me if I am wrong. If I am correct than what is the right code 
for above mistake??

Thanks,

Zaheer




More information about the Ns-developers mailing list