diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-08 18:39:48 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-08 18:39:48 +0200 |
commit | f6a589a59ea88c895d35a595c3d0580495dbc548 (patch) | |
tree | d68e4204289fc63eeca82254e4a8f4a0ddba2287 /libbpf/bpf_impl.c | |
parent | e9ac14979a70d0b36684fb4bac031daa7dcb9a6a (diff) | |
download | hurd-f6a589a59ea88c895d35a595c3d0580495dbc548.tar.gz hurd-f6a589a59ea88c895d35a595c3d0580495dbc548.tar.bz2 hurd-f6a589a59ea88c895d35a595c3d0580495dbc548.zip |
libbpf: Fix long / int confusion
In network terms, long is 32bit, i.e. an int for us.
Diffstat (limited to 'libbpf/bpf_impl.c')
-rw-r--r-- | libbpf/bpf_impl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libbpf/bpf_impl.c b/libbpf/bpf_impl.c index 6eb9dda3..acd53409 100644 --- a/libbpf/bpf_impl.c +++ b/libbpf/bpf_impl.c @@ -66,7 +66,7 @@ bpf_do_filter(net_rcv_port_t infp, char *p, unsigned int wirelen, bpf_insn_t pc, pc_end; unsigned int buflen; - unsigned long A, X; + unsigned int A, X; int k; unsigned int mem[BPF_MEMWORDS]; @@ -114,9 +114,9 @@ bpf_do_filter(net_rcv_port_t infp, char *p, unsigned int wirelen, k = pc->k; load_word: - if ((u_int)k + sizeof(long) <= hlen) + if ((u_int)k + sizeof(int) <= hlen) data = header; - else if ((u_int)k + sizeof(long) <= buflen) { + else if ((u_int)k + sizeof(int) <= buflen) { k -= hlen; data = p; } else @@ -127,7 +127,7 @@ load_word: A = EXTRACT_LONG(&data[k]); else #endif - A = ntohl(*(long *)(data + k)); + A = ntohl(*(int *)(data + k)); continue; case BPF_LD|BPF_H|BPF_ABS: |