Skip to content

Fix parsing of pcaps with nested VLAN tags (q-in-q) - #564

Open
rsmck wants to merge 2 commits into
irontec:masterfrom
rsmck:rh/fix-qinq-vlans
Open

Fix parsing of pcaps with nested VLAN tags (q-in-q)#564
rsmck wants to merge 2 commits into
irontec:masterfrom
rsmck:rh/fix-qinq-vlans

Conversation

@rsmck

@rsmck rsmck commented Aug 24, 2026

Copy link
Copy Markdown

Currently sngrep will fail to parse pcap files where multiple 802.1Q tags are present, e.g. the below sample pcap will decode with just 7 packets as it skips any with two tags and also corrupts some of the others I assume when parsing so it ends up missing more than just the packets with two tags.

This fix adds new capture_packet_skip_vlan which loops through and skips all the VLAN tags if present.

Have tested with multiple pcaps following this change and no negative impact to any other pcaps, but the test that contained the multiple tags is now decoded correctly.

tshark -r /tmp/sample.pcap -T fields -e frame.number -e frame.protocols
1 eth:ethertype:vlan:ethertype:ip:udp:sip:sdp
2 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
3 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip:sdp
4 eth:ethertype:vlan:ethertype:ip:udp:sip
5 eth:ethertype:vlan:ethertype:ip:udp:sip
6 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
7 eth:ethertype:vlan:ethertype:ip:udp:sip:sdp
8 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip:sdp
9 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
10 eth:ethertype:vlan:ethertype:ip:udp:sip
11 eth:ethertype:vlan:ethertype:ip:udp:sip
12 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
13 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
14 eth:ethertype:vlan:ethertype:ip:udp:sip:sdp
15 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip:sdp
16 eth:ethertype:vlan:ethertype:ip:udp:sip
17 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
18 eth:ethertype:vlan:ethertype:vlan:ethertype:ip:udp:sip
19 eth:ethertype:vlan:ethertype:ip:udp:sip
20 eth:ethertype:vlan:ethertype:ip:udp:sip

@Kaian

Kaian commented Aug 26, 2026

Copy link
Copy Markdown
Member

Hi!

Can you provide a sample pcap file to test this change?

Thanks!

@rsmck

rsmck commented Aug 28, 2026

Copy link
Copy Markdown
Author

Unfortunately not, as the only time I've seen it are in pcaps provided to me by a third party and they contain personal data. I could perhaps attempt to construct one based on these but replacing URIs and IDs with anonymised data, but that would take some time.

From a regression test point of view, however, can we not confirm this doesn't affect opening any other pcaps which you'll presumably have many of? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants