Hi,

When using "tcpdump proto 128" the filter never matches.  Protocols
up to 127 work fine.  It is a sign extension bug in bpf.  m_data
is signed.

ok?

bluhm

Index: net/bpf.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/bpf.c,v
retrieving revision 1.162
diff -u -p -U4 -r1.162 bpf.c
--- net/bpf.c   4 May 2017 15:00:24 -0000       1.162
+++ net/bpf.c   24 May 2017 15:45:45 -0000
@@ -1823,8 +1823,9 @@ bpf_mbuf_ldh(const void *m0, u_int32_t k
 u_int32_t
 bpf_mbuf_ldb(const void *m0, u_int32_t k, int *err)
 {
        const struct mbuf *m = m0;
+       u_int8_t v;
 
        while (k >= m->m_len) {
                k -= m->m_len;
 
@@ -1833,11 +1834,12 @@ bpf_mbuf_ldb(const void *m0, u_int32_t k
                        *err = 1;
                        return (0);
                }
        }
+       v = m->m_data[k];
 
        *err = 0;
-       return (m->m_data[k]);
+       return v;
 }
 
 u_int
 bpf_mfilter(const struct bpf_insn *pc, const struct mbuf *m, u_int wirelen)

Reply via email to