X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/c1731e7a143a1337317dab2f3137d6ea1d698f15..c3e4329535c3de5b66c418d79f34ac9ea8eae1e2:/pcap-linux.c diff --git a/pcap-linux.c b/pcap-linux.c index a72aecdc..245c4859 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -3223,9 +3223,17 @@ create_ring(pcap_t *handle, int *status) #ifdef PACKET_RESERVE len = sizeof(tp_reserve); if (getsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE, &tp_reserve, &len) < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno)); - *status = PCAP_ERROR; - return -1; + if (errno != ENOPROTOOPT) { + /* + * ENOPROTOOPT means "kernel doesn't support + * PACKET_RESERVE", in which case we fall back + * as best we can. + */ + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno)); + *status = PCAP_ERROR; + return -1; + } + tp_reserve = 0; /* older kernel, reserve not supported */ } #else tp_reserve = 0; /* older kernel, reserve not supported */