Skip to content

Add rudimentary support for 802.1Q / 802.1ad VLAN tags#3213

Open
nnposter wants to merge 1 commit intonmap:masterfrom
nnposter:packet-vlan
Open

Add rudimentary support for 802.1Q / 802.1ad VLAN tags#3213
nnposter wants to merge 1 commit intonmap:masterfrom
nnposter:packet-vlan

Conversation

@nnposter
Copy link

The PR implements the following changes:

  • NSock nse_readpcap() includes VLAN tags in *l2_data, as opposed to *l3_data. Parsers can now assume that IP headers start at *l3_data even for tagged Ethernet frames.
  • Libnetutil read_reply_pcap() skips over VLAN tags when calculating the offset of the next protocol.
  • NSE packet.Frame:new() parses VLAN tags and capture the result in list frame.vlans. Each element is a table containing the expected fields: TPID, CPC, DEI, and VID (all in lowercase).
  • NSE packet.Frame:build_ether_frame() takes an an optional parameter in the form of the list above to build 802.1Q / 802.1ad headers. Incomplete VLAN specifications use the following defaults:
    • TPID is set to C-TAG for the inner-most VLAN, S-TAG otherwise.
    • TCI fields CPC, DEI, and VID are all set to 0.

@nnposter
Copy link
Author

This PR will be merged in after May 1st unless concerns are raised.
@dmiller-nmap Please let me know if you want more time to review.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant