af-packet: improve VLAN detection

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.
pull/832/head
Eric Leblond 12 years ago
parent 1fb7c0dddc
commit e871f7132b

@ -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;

Loading…
Cancel
Save