Johannes Petzold

Berkeley Packet Filter

Discussion created by Johannes Petzold on Mar 19, 2012



I have some problem with filtering some packets using the setsockopt function.

Following Code doesn't work on an iMX6 platform:


struct sock_filter cams[] =

      BPF_STMT(BPF_RET + BPF_K, 0)


setsockopt(sockfd, SOL_SOCKET, SO_ATTACH_FILTER, &cams, sizeof(cams));



"Invalid argument" is returned as errno. Similiar Code can be found in libpcap where this seems to work. Any ideas?