I'm having difficulty with bpfc when using the mod and xor instructions. These instructions compile fine, but trying to load them gives the error message:
Cannot attach filter to socket!
Here's a simple example (which doesn't do anything useful) to demonstrate the issue:
ldh [12]
mod #8
jeq #0,Keep,Drop
Keep: ret #0xffffffff ; Return full packet
Drop: ret #0 ; Discard packet
which produces:
{ 0x28, 0, 0, 0x0000000c },
{ 0x94, 0, 0, 0x00000008 },
{ 0x15, 0, 1, 0x00000000 },
{ 0x6, 0, 0, 0xffffffff },
{ 0x6, 0, 0, 0x00000000 },
When run with 'netsniff-ng -i <ethN> -f <bpfc output file>, it produces the error above. Other operation instructions work fine, although I haven't tried them all.
Thanks,
John