]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: improve VLAN detection
authorEric Leblond <eric@regit.org>
Thu, 6 Feb 2014 12:54:10 +0000 (13:54 +0100)
committerEric Leblond <eric@regit.org>
Fri, 7 Feb 2014 12:32:48 +0000 (13:32 +0100)
Since commit in kernel
  commit a3bcc23e890a6d49d6763d9eb073d711de2e0469
  Author: Ben Greear <greearb@candelatech.com>
  Date:   Wed Jun 1 06:49:10 2011 +0000

      af-packet: Add flag to distinguish VID 0 from no-vlan.
a flag is set to indicate VLAN has been set in packet header.

As suggested in commit message, using a test of the flag followed
by a check on vci value ensure backward compatibility of the test.

src/source-af-packet.c

index 0a3c5f00ed515ec3e9445881df6e9c741dd30cbb..5f31b429877cff608711b266506d1567843a2b65 100644 (file)
@@ -790,7 +790,8 @@ int AFPReadFromRing(AFPThreadVars *ptv)
         }
 
         /* get vlan id from header */
-        if ((!ptv->vlan_disabled) &&  h.h2->tp_vlan_tci) {
+        if ((!ptv->vlan_disabled) &&
+            (h.h2->tp_status & TP_STATUS_VLAN_VALID || h.h2->tp_vlan_tci)) {
             p->vlan_id[0] = h.h2->tp_vlan_tci;
             p->vlan_idx = 1;
             p->vlanh[0] = NULL;