-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pcap-linux.c - if kernel filter cannot be set, BPF filter setup will fail with "Machine is not on the network" #549
Comments
Presumably either this is an old version of the kernel code, where somebody incorrectly typed |
It means "there was no filter on the socket"; as the goal of this routine is to remove whatever filter is on the socket, it means that the goal has been achieved by virtue of there not having been a filter there in the first place, so just return 0, meaning "success". See GitHub issue #549.
You're right, I was looking at some old kernel sources, but I can confirm errno is ENONET in 2.6.x. So you might want to ignore ENOENT and ENONET. |
Amazingly, that was from an old version of the kernel code, where somebody incorrectly typed In change c62ae94 I've changed it to ignore |
Probably fixed in the process of moving the filter-detach code to |
If we can't set a kernel filter and there is no existing kernel filter, attempting to detach the filter with SO_DETACH_FILTER will return ENONET, based on this code from net/core/sock.c:
in libpcap/pcap-linux.c @ 2727:
This will cause reset_kernel_filter to return -1 and setting the BPF to fail. The failure when running tcpdump is:
ENONET should be ignored when resetting a possibly nonexistant kernel filter:
The text was updated successfully, but these errors were encountered: