summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2011-06-28 00:58:12 +0000
committerdelphij <delphij@FreeBSD.org>2011-06-28 00:58:12 +0000
commit009e9866663d9661d3a075015e162cad604b684c (patch)
treeed028cbac21e61b6c8b189daa8b545e54b072f95 /contrib/libpcap
parent612e8bfe92f4c6a722f8acef3c978f054264d0a7 (diff)
downloadFreeBSD-src-009e9866663d9661d3a075015e162cad604b684c.zip
FreeBSD-src-009e9866663d9661d3a075015e162cad604b684c.tar.gz
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
Diffstat (limited to 'contrib/libpcap')
-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 db12bb2..f172384 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:
OpenPOWER on IntegriCloud