Redo fix for incorrect vlan parsing of rx emuldev frames
The previous fix in 6977278654
was incorrect and incomplete since it
won't handle the case when emulated devices have PRIO and/or CFI/DEI
set.
This is the correct fix where Prio and CFI/DEI are no longer part of the
device key.
This commit is contained in:
parent
f0dd0c307b
commit
176fc7dd15
@ -33,7 +33,8 @@ const int kIp6HdrLen = 40;
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* 1. Device Key is (VLANS + MAC) - is assumed to be unique for a device
|
||||
* 1. Device Key is (VLANS [without prio/cfi] + MAC)
|
||||
* - is assumed to be unique for a device
|
||||
* 2. Device clients/users (viz. DeviceManager) should take care when
|
||||
* setting params that change the key, if the key is used elsewhere
|
||||
* (e.g. in a hash)
|
||||
@ -67,7 +68,7 @@ void Device::setVlan(int index, quint16 vlan, quint16 tpid)
|
||||
vlan_[index] = (tpid << 16) | vlan;
|
||||
|
||||
ofs = index * sizeof(quint16);
|
||||
key_[ofs] = vlan >> 8;
|
||||
key_[ofs] = (vlan >> 8) & 0x0f; // Vlan prio/cfi should not be part of key
|
||||
key_[ofs+1] = vlan & 0xff;
|
||||
|
||||
if (index >= numVlanTags_)
|
||||
|
@ -265,10 +265,11 @@ _eth_type:
|
||||
|
||||
if (tpidList_.contains(ethType)) {
|
||||
offset += 2;
|
||||
vlan = qFromBigEndian<quint16>(pktData + offset) & 0x0FFF;
|
||||
vlan = qFromBigEndian<quint16>(pktData + offset);
|
||||
dk.setVlan(idx++, vlan);
|
||||
offset += 2;
|
||||
qDebug("%s: idx: %d vlan %d", __FUNCTION__, idx, vlan);
|
||||
qDebug("%s: idx: %d vlan: 0x%04x/%d", __FUNCTION__,
|
||||
idx, vlan, vlan & 0x0fff);
|
||||
goto _eth_type;
|
||||
}
|
||||
|
||||
@ -383,7 +384,8 @@ _eth_type:
|
||||
vlan = qFromBigEndian<quint16>(pktData + offset);
|
||||
dk.setVlan(idx++, vlan);
|
||||
offset += 2;
|
||||
qDebug("%s: idx: %d vlan %d", __FUNCTION__, idx, vlan);
|
||||
qDebug("%s: idx: %d vlan: 0x%04x/%d", __FUNCTION__,
|
||||
idx, vlan, vlan & 0x0fff);
|
||||
goto _eth_type;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user