Date: Tue, 28 Jun 2011 00:58:12 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223616 - head/contrib/libpcap/bpf/net Message-ID: <201106280058.p5S0wC9I021417@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Tue Jun 28 00:58:12 2011 New Revision: 223616 URL: http://svn.freebsd.org/changeset/base/223616 Log: 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 Modified: head/contrib/libpcap/bpf/net/bpf_filter.c Modified: head/contrib/libpcap/bpf/net/bpf_filter.c ============================================================================== --- head/contrib/libpcap/bpf/net/bpf_filter.c Tue Jun 28 00:01:55 2011 (r223615) +++ head/contrib/libpcap/bpf/net/bpf_filter.c Tue Jun 28 00:58:12 2011 (r223616) @@ -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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106280058.p5S0wC9I021417>