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

Mathieu Lacage Mathieu.Lacage at sophia.inria.fr
Tue Jul 19 03:13:32 PDT 2005


I think you should try to read the code a little harder before posting.

> 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);
>     }

[snip]

> 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);" 

as shown in the code you pasted here, dst is redefined in the inner
block to:

  u_int32_t dst = ETHER_ADDR(dh->dh_3a);

> line at the start of this function.

Redefining a variable with the same name in an inner block of a function
is very bad style and should be avoided but it is not a bug.

Mathieu
-- 



More information about the Ns-developers mailing list