from scapy.all import Ether, Dot1Q, IP, ICMP, Raw, sendp
def send_vlan_icmp(
iface: str,
dst_mac: str,
src_mac: str,
vlan_id: int,
src_ip: str,
dst_ip: str,
) -> None:
pkt = (
Ether(src=src_mac, dst=dst_mac)
/ Dot1Q(vlan=vlan_id)
/ Dot1Q(vlan=vlan_id + 1)
/ IP(src=src_ip, dst=dst_ip)
/ ICMP()
/ Raw(load=b"multiple VLAN headers test")
)
sendp(pkt, iface=iface, verbose=False)
return pkt
if __name__ == "__main__":
pkt = send_vlan_icmp(
# iface="VMware Network Adapter VMnet8",
# use YOUR OWN network
iface="Ethernet 3",
dst_mac="ff:ff:ff:ff:ff:ff",
src_mac="00:11:22:33:44:55",
vlan_id=4,
src_ip="192.168.10.2",
dst_ip="192.168.10.1",
)
Describe the bug
When capturing a packet with multiple VLAN tags, the outermost VLAN tag is dropped.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
all vlan tags are expected to be captured
Screenshots

packet captured by wireshark
packet captured by canoe
Diagnostic information