]> The Tcpdump Group git mirrors - libpcap/commit
Make prepare_tpacket_socket() a bit more of a straightforward gauntlet.
authorGuy Harris <[email protected]>
Thu, 26 Feb 2015 00:16:57 +0000 (16:16 -0800)
committerGuy Harris <[email protected]>
Thu, 26 Feb 2015 00:16:57 +0000 (16:16 -0800)
commit7beef37c555bff4003c8532195841b663fcab6d7
tree9d30964d33f6b173266bcc6de0054fe59f1af71c
parentc4bcc6d8bff8047291a7d491a1f005575d16074c
Make prepare_tpacket_socket() a bit more of a straightforward gauntlet.

Try TPACKET_V3 first, if it's defined and if immediate mode was not
requested; return if that succeeds or if it fails for a reason other
than "the kernel doesn't support TPACKET_V3".  Then try TPACKET_V2, if
it's defined; return if that succeeds or fails for a reson other than
"the kernel doesn't support TPACKET_V2".  Then go with TPACKET_V1 or
TPACKET_V1_64.

Don't set handlep->tp_version to TPACKET_V1 and handlep->tp_hdrlen to
sizeof(struct tpacket_hdr) until after we've found out that the kernel
supports neither TPACKET_V2 nor TPACKET_V3; init_tpacket() sets them if
it succeeds.
pcap-linux.c