I am running the bcc example /http_filter/http-parse-simple.c, in which a comment explains:
/*
eBPF program.
Filter IP and TCP packets, having payload not empty
and containing "HTTP", "GET", "POST" ... as first bytes of payload
if the program is loaded as PROG_TYPE_SOCKET_FILTER
and attached to a socket
return 0 -> DROP the packet
return -1 -> KEEP the packet and return it to user space (userspace
can read it from the socket_fd )
*/
And when I ran this example, I saw when I run a UDP packet(such as dig) or icmp packet(ping), the user programmer indeed does not receive the packet.
But the ping or dig program does not drop.
In my understanding, these Non-TCP packet should be drop(I expect that ping or dig will fail), but it is not.
So what is the reason?
And is there anyway else to drop skb_buff use ebpf/bcc?