Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote: > Update bitfield definitions to match according to the way they are > expressed in RFC and IEEE specifications. [..] > len = round_up(expr->len, BITS_PER_BYTE); > > Then, we substract the offset bits and the bitfield length. > > shift = len - (offset + expr->len); > > From the delinearize, payload_expr_trim() needs to obtain the real > offset through: > > off = round_up(mask->len, BITS_PER_BYTE) - > mpz_fls(mask->value, mask->len); > > For vlan id (offset 12), this gets the position of the last bit set in > the mask (ie. 12), then we substract the length we fetch in bytes (16), > so we obtain the real bitfield offset (4). > > Then, we add that to the original payload offset that was expressed in > bytes: > > payload_offset += off; > > Note that payload_expr_trim() now also adjusts the payload expression to > its real length and offset. > > Reported-by: Patrick McHardy <kaber@xxxxxxxxx>> > Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> > --- > This aims to fix what we have, I'm willing to give another pass to this. vlan type ip vlan id 4094 ip version 4 counter packets 567 bytes 37720 vlan type ip vlan id 4094 vlan pcp 0 vlan cfi 0 counter packets 567 bytes 37720 vlan type ip vlan id 4094 vlan pcp 1 vlan cfi 1 counter packets 0 bytes 0 vlan type ip vlan id 4094 vlan pcp 1 vlan cfi 0 counter packets 0 bytes 0 vlan type ip vlan id 4094 vlan pcp 0 vlan cfi 1 counter packets 0 bytes 0 tpcdump says: 'length 194: vlan 4094, p 0, ethertype IPv4', i.e. this looks correct. Thanks Pablo! -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html