Skip to content

Conversation

@fairyto2
Copy link

This PR introduces support for parsing double VLAN (QinQ) Ethernet frames in the pkts-core library. The changes are primarily focused on enhancing the Ethernet framer and MAC packet implementation to correctly handle packets with stacked VLAN tags.

Key Changes:

  1. EthernetFramer.java

    • Modified the Ethernet frame parsing logic to detect and handle QinQ (double VLAN) frames.
    • When a Dot1Q VLAN tag is detected, the code now checks if there is an additional inner VLAN tag. If present, it reads 22 bytes as the header instead of the standard 18 bytes.
  2. MACPacketImpl.java

    • Refactored the VLAN tag parsing logic by replacing static offset lookups with a loop that can process up to two VLAN tags.
    • This allows proper traversal through multiple VLAN layers by incrementing the offset for each subsequent VLAN tag encountered.
  3. VLANTest.java

    • Added a new test class containing a unit test for validating QinQ packet processing.
    • The test uses a sample PCAP file (event_waf_152197.pcap) to read and process QinQ packets, ensuring correct parsing behavior.
  4. Resource File

    • Included a new PCAP test resource (event_waf_152197.pcap) containing QinQ-tagged packets for use in testing the updated framer logic.

This enhancement improves the library’s ability to work with complex VLAN-tagged traffic commonly found in service provider networks and other environments utilizing QinQ tunneling.

@fairyto2
Copy link
Author

fairyto2 commented May 21, 2025

@aboutsip @joschi @teerapap @jonbo372 @epall please review it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant