diff options
author | Gabor Tatarka <gabor.tatarka@ericsson.com> | 2013-12-02 22:05:57 +0400 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2013-12-02 22:14:46 +0400 |
commit | cd84bc9743d7595dee1ea4bc40bd236a619d6539 (patch) | |
tree | c16d5128af61f51247b8d8c89fdd9879dc5314c7 /pcap-linux.c | |
parent | 70c1201dca9b655af01f7718e4d1280ba0d5f600 (diff) |
fix TPACKET_V3 initialization (GH #329)
libpcap would fail to initialize on Linux when compiled against kernel
headers with TPACKET_V3 support but running on kernel without:
"can't get TPACKET_V3 header len on packet socket: Invalid argument"
Fix init_tpacket() to respect EINVAL because that is what the kernel
returns for unsupported TPACKET versions.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index 6c0723ab..8800c963 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -3471,7 +3471,7 @@ init_tpacket(pcap_t *handle, int version, const char *version_str) /* Probe whether kernel supports the specified TPACKET version */ if (getsockopt(handle->fd, SOL_PACKET, PACKET_HDRLEN, &val, &len) < 0) { - if (errno == ENOPROTOOPT) + if (errno == ENOPROTOOPT || errno == EINVAL) return 1; /* no */ /* Failed to even find out; this is a fatal error. */ |