]> The Tcpdump Group git mirrors - libpcap/blobdiff - gencode.c
Fix the "|" and "&" operators of the "byte" primitive.
[libpcap] / gencode.c
index 520277ba7e43e1a38f5d68857a046cdacf1aa9db..40614b93dc34f6c886e546855ebba94a9977dda5 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -8147,8 +8147,11 @@ gen_byteop(compiler_state_t *cstate, int op, int idx, bpf_u_int32 val)
                break;
        }
        s->s.k = val;
+       // Load the required byte first.
+       struct slist *s0 = gen_load_a(cstate, OR_LINKHDR, idx, BPF_B);
+       sappend(s0, s);
        b = new_block(cstate, JMP(BPF_JEQ));
-       b->stmts = s;
+       b->stmts = s0;
        gen_not(b);
 
        return b;