Fix identification of SNAP packets.
authorJustin Pettit <jpettit@nicira.com>
Fri, 13 Jun 2008 03:07:11 +0000 (20:07 -0700)
committerJustin Pettit <jpettit@nicira.com>
Fri, 13 Jun 2008 03:07:11 +0000 (20:07 -0700)
The result of the memcmp that checks whether the OUI is all zeroes was the reverse of what it should have been.  This checkin also removes the masking of the least signficant bit from SAP checks, since it's not need for checking SNAP.

Thanks to Masa and Brandon for catching this.

datapath/snap.h

index 446b5f22dba25caffab578fbbdfbc8a34d19803e..0d39a62209d993dc35cdfc44bc6667074c9e1e54 100644 (file)
@@ -19,9 +19,9 @@ static inline int snap_get_ethertype(struct sk_buff *skb, uint16_t *ethertype)
 {
        struct snap_hdr *sh = (struct snap_hdr *)(skb->data 
                                + sizeof(struct ethhdr));
-       if (((sh->dsap & 0xFE) != LLC_SAP_SNAP) 
-                               || ((sh->ssap & 0xFE) != LLC_SAP_SNAP)
-                               || (!memcmp(sh->oui, "\0\0\0", SNAP_OUI_LEN)))
+       if ((sh->dsap  != LLC_SAP_SNAP) 
+                               || (sh->ssap != LLC_SAP_SNAP)
+                               || (memcmp(sh->oui, "\0\0\0", SNAP_OUI_LEN)))
                return -EINVAL;
 
        *ethertype = sh->ethertype;