Search code examples
clinuxraw-sockets

How to filter Packets in RAW socket in LINUX


RAW Socket: How to filter packets in RAW Socket ? I was trying to capture UDP packets in a server Program but its receiving all the packets. Is there any function or command to filter the packets in linux.


Solution

  • Use LSF/BPF (see https://www.kernel.org/doc/Documentation/networking/filter.txt an http://www.freebsd.org/cgi/man.cgi?query=bpf&sektion=4) or for a higher-level interface, pcap