aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2011-06-28 00:58:12 +0000
committerXin LI <delphij@FreeBSD.org>2011-06-28 00:58:12 +0000
commitc62908a982ccfb82c24246d237b56bc66a237927 (patch)
treeed028cbac21e61b6c8b189daa8b545e54b072f95 /contrib
parent7d12b6e1725a2d5c319fbff63d93f0d37944204f (diff)
downloadsrc-c62908a982ccfb82c24246d237b56bc66a237927.tar.gz
src-c62908a982ccfb82c24246d237b56bc66a237927.zip
Incorporate vendor commit ecdc5c0a7f7591a7cd4a:
In userland, sign extend the offset for JA instructions. We currently use that to implement "ip6 protochain", and "pc" might be wider than "pc->k", in which case we need to arrange that "pc->k" be sign-extended, by casting it to bpf_int32. PR: kern/157188 Submitted by: plosher MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=223616
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libpcap/bpf/net/bpf_filter.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/libpcap/bpf/net/bpf_filter.c b/contrib/libpcap/bpf/net/bpf_filter.c
index db12bb2bad9e..f172384fa8c8 100644
--- a/contrib/libpcap/bpf/net/bpf_filter.c
+++ b/contrib/libpcap/bpf/net/bpf_filter.c
@@ -405,7 +405,18 @@ bpf_filter(pc, p, wirelen, buflen)
continue;
case BPF_JMP|BPF_JA:
+#if defined(KERNEL) || defined(_KERNEL)
+ /*
+ * No backward jumps allowed.
+ */
pc += pc->k;
+#else
+ /*
+ * XXX - we currently implement "ip6 protochain"
+ * with backward jumps, so sign-extend pc->k.
+ */
+ pc += (bpf_int32)pc->k;
+#endif
continue;
case BPF_JMP|BPF_JGT|BPF_K: