OSDN Git Service

selftests/bpf: Fix kfree_skb on s390x
authorIlya Leoshkevich <iii@linux.ibm.com>
Sat, 28 Jan 2023 00:06:25 +0000 (01:06 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 28 Jan 2023 20:30:08 +0000 (12:30 -0800)
h_proto is big-endian; use htons() in order to make comparison work on
both little- and big-endian machines.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20230128000650.1516334-7-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/kfree_skb.c

index 7357937..c079915 100644 (file)
@@ -36,7 +36,7 @@ static void on_sample(void *ctx, int cpu, void *data, __u32 size)
                  "cb32_0 %x != %x\n",
                  meta->cb32_0, cb.cb32[0]))
                return;
-       if (CHECK(pkt_v6->eth.h_proto != 0xdd86, "check_eth",
+       if (CHECK(pkt_v6->eth.h_proto != htons(ETH_P_IPV6), "check_eth",
                  "h_proto %x\n", pkt_v6->eth.h_proto))
                return;
        if (CHECK(pkt_v6->iph.nexthdr != 6, "check_ip",