How to receive the vlan header/l2 header using a ICMPv6 socket

116 Views Asked by At

In my ND daemon, i am using rbos_socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); to receive ICMPv6 header for receiving NS and other ND messages (l3 messages). With this option kernel will strip the l2 header (with VLAN information). which option should I use to avoid this stripping?

My intent is to receive ICMPv6 message with VLAN information.

Already tried using the following: 1) rbos_socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); 2) rbos_socket(AF_INET6, SOCK_RAW, PROTO_ND)

My expectation is to receive ICMPv6 message with l2 information (specifically VLAN header).

1

There are 1 best solutions below

0
On

You cannot get the first VLAN tag like this. It does get stripped from the packet, but it is available out-of-band in the tp_vlan_tci and tp_vlan_tpid members, see linux/if_packet.h (assuming this is on Linux).