linux/tools/testing/selftests/bpf
Daniel Borkmann 43bcf707cc bpf: fix _htons occurences in test_progs
Dave reported that on sparc test_progs generates buggy swapped
eth->h_proto protocol comparisons:

  10: (15) if r3 == 0xdd86 goto pc+9
   R0=imm2,min_value=2,max_value=2 R1=pkt(id=0,off=0,r=14) R2=pkt_end R3=inv
   R4=pkt(id=0,off=14,r=14) R5=inv56 R10=fp

This is due to the unconditional ...

  #define htons __builtin_bswap16
  #define ntohs __builtin_bswap16

... in test_progs that causes this. Make use of asm/byteorder.h
and use __constant_htons() where possible and only perform the
bswap16 when on little endian in non-constant case.

Fixes: 6882804c91 ("selftests/bpf: add a test for overlapping packet range checks")
Fixes: 3782161362 ("selftests/bpf: add l4 load balancer test based on sched_cls")
Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-04-28 15:48:15 -04:00
..
.gitignore bpf: Add test_tag to .gitignore 2017-02-10 15:56:08 -05:00
bpf_util.h bpf: fix _htons occurences in test_progs 2017-04-28 15:48:15 -04:00
config
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-04-06 08:24:51 -07:00
test_iptunnel_common.h selftests/bpf: add a test for basic XDP functionality 2017-04-01 12:45:57 -07:00
test_kmod.sh selftests: do not require bash to run bpf tests 2017-01-05 13:19:47 -07:00
test_l4lb.c bpf: fix _htons occurences in test_progs 2017-04-28 15:48:15 -04:00
test_lpm_map.c bpf: Remove bpf_sys.h from selftests 2017-02-10 15:56:08 -05:00
test_lru_map.c bpf: lru: Lower the PERCPU_NR_SCANS from 16 to 4 2017-04-17 13:55:52 -04:00
test_maps.c bpf: map_get_next_key to return first key on NULL 2017-04-25 11:57:45 -04:00
test_pkt_access.c bpf: fix _htons occurences in test_progs 2017-04-28 15:48:15 -04:00
test_progs.c bpf: fix _htons occurences in test_progs 2017-04-28 15:48:15 -04:00
test_tag.c bpf: Remove bpf_sys.h from selftests 2017-02-10 15:56:08 -05:00
test_verifier.c bpf: add various test cases to verifier selftests 2017-04-28 15:48:14 -04:00
test_xdp.c selftests/bpf: add a test for basic XDP functionality 2017-04-01 12:45:57 -07:00