title: EtherType filtering in VLAN Tagged (802.1Q) frames on RAW Ethernet Socket
body: <p>Filtering on custom ethernet type e.g. etherType = 0x0603 with socket(AF_PACKET, SOCK_RAW, htons(etherType)).</p>
  <p>and binding on interface with</p>
  <pre><code>  struct sockaddr_ll sockAddr{PF_PACKET,
                                htons(0x0603),
                                static_cast&lt;int&gt;(if_nametoindex(&quot;eth2&quot;)),
                                0,
                                PACKET_HOST,
                                ETH_ALEN,
                                0,
                                0,
                                0x01,
                                0x01,
                                0x00,
                                0x00,
                                0x00,
                                0x80};
  </code></pre>
  <p>works fine for untagged frames</p>
  <p>destMac | srcMAC | EtherType</p>
  <p>For tagged frames</p>
  <p>destMac | srcMAC | Q802.1Q header (TPID / PCP/DEI/VID) | EtherType</p>
  <p>filtering on EtherType 0x0603 does not work anymore because filtering looks up in TPID field with 0x8100 in Q802.1Q header.</p>
  <p>Is there any easy way to configure socket for looking up in EtherType field instead of TPID field of tagged frames?</p>
  <p>I know there is a socket option SO_ATTACH_FILTER to attach BPF (Berkeley Packet Filter) micro code for deep packet filtering. But if possible I want to prevent using this option.</p>