selftests/bpf: Fix v4_to_v6 in sk_lookup
I'm getting some garbage in bytes 8 and 9 when doing conversion from sockaddr_in to sockaddr_in6 (leftover from AF_INET?). Let's explicitly clear the higher bytes. Fixes: 0ab5539f8584 ("selftests/bpf: Tests for BPF_SK_LOOKUP attach point") Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://lore.kernel.org/bpf/20200807223846.4190917-1-sdf@google.com
This commit is contained in:
parent
0390c429db
commit
da7bdfdd23
@ -309,6 +309,7 @@ static void v4_to_v6(struct sockaddr_storage *ss)
|
|||||||
v6->sin6_addr.s6_addr[10] = 0xff;
|
v6->sin6_addr.s6_addr[10] = 0xff;
|
||||||
v6->sin6_addr.s6_addr[11] = 0xff;
|
v6->sin6_addr.s6_addr[11] = 0xff;
|
||||||
memcpy(&v6->sin6_addr.s6_addr[12], &v4.sin_addr.s_addr, 4);
|
memcpy(&v6->sin6_addr.s6_addr[12], &v4.sin_addr.s_addr, 4);
|
||||||
|
memset(&v6->sin6_addr.s6_addr[0], 0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int udp_recv_send(int server_fd)
|
static int udp_recv_send(int server_fd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user