I'll take this one, since Aaron seems to be AFK. :)

On Apr 13, 2012, at 10:15 AM, Weiyang Mo wrote:
>  if ord(srcaddr[0]) & 1    #To avoid multicast
>  
> Asuuming the srcaddr is a multicast mac.
> For a multicast MAC it starts with 01:00:5e. What ord(srcaddr[0]) represents? 
> is srcaddr[0] equal to char '0'? Then what does "ord(0)=48 & 1" mean?

No.  srcaddr isn't hex.  It's 6 bytes of raw values.  e.g., it starts with 
"\x01\x00\x5e".
srcaddr[0] is the first character.  ord(srcaddr[0]) is 1.  (And 1 & 1 is also 
1.)

I'll note that this code is prettier in POX -- "srcaddr.is_multicast". :)


Hope that helps.

-- Murphy

Reply via email to