How do I capture the full packet that is actually going out of the vir_device_1, i.e. after the ndo_start_xmit() device call?
Either by writing your own code to directly use a PF_PACKET/SOCK_RAW socket (you say "SLL header", so this is presumably Linux), or by:
- making sure you've assigned a special
ARPHRD_
value for your virtual interface;
- using one of the
DLT_USER
n values for your special set of headers, or asking tcpdump-workers@lists.tcpdump.org for an official DLT_
value to be assigned for them;
- modifying libpcap to map that
ARPHRD_
value to the DLT_
value you're using;
- modifying tcpdump to handle that
DLT_
value;
- if necessary, modifying other programs that would capture on that interface or read capture files as written by tcpdump on that interface to handle that value as well.
Note that the DLT_USER
n values are specifically reserved for private use, and no official versions of libpcap, tcpdump, or Wireshark will ever assign them for their own use (i.e., if you use a DLT_USER
n value, don't bother contributing patches to assign that value to your type of headers, as they won't be accepted; other people may already be using it for their own special headers, and that must continue to be supported), so you'll have to maintain the modified versions of libpcap, tcpdump, etc. yourself if you use one of those values rather than getting an official value assigned.