<html>
<head>
<base href="https://bugzilla.netfilter.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - xt_bpf completely broken with kernel 4.3"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1048#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - xt_bpf completely broken with kernel 4.3"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1048">bug 1048</a>
from <span class="vcard"><a class="email" href="mailto:daniel@iogearbox.net" title="Daniel Borkmann <daniel@iogearbox.net>"> <span class="fn">Daniel Borkmann</span></a>
</span></b>
<pre>(In reply to blaffablaffa from <a href="show_bug.cgi?id=1048#c2">comment #2</a>)
<span class="quote">> It turns out that the problem is indeed the different 0 offset that xt_bpf
> and tcpdump use. In particular, it appears that offset 0 in tcpdump is at
> the very beginning of the packet (ethernet header included) whereas xt_bpf
> uses the beginning of the IP header. I've spoken with the author of the
> module, and he is probably going to just point this out more clearly in the
> man pages.</span >
Right, what you can also try to do is to add SKF_LL_OFF or SKF_NET_OFF offset
to you load offsets in the K constant. It would require to use something like
bpf_asm to write your filters by hand.
F.e. if you look at bpf_internal_load_pointer_neg_helper() helper function in
the kernel, they check for SKF_NET_OFF/SKF_LL_OFF and then use K relative to
skb_network_header(skb) or skb_mac_header(skb), respectively. This should
resolve your use-case.
The problem is that with libpcap, the filters are generated for tcpdump
specifically, and tcpdump doesn't need to care about SKF_NET_OFF/SKF_LL_OFF as
it sees raw packet starting with Ethernet header. So, reusing libpcap is a bit
suboptimal, but perhaps the nfbpf_compile tool could be changed into rewriting
the offsets so it would work with iptables in all cases.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>