• Joe Stringer's avatar
    bpf: Fix IPv6 dport byte-order in bpf_sk_lookup · 5ef0ae84
    Joe Stringer authored
    Commit 6acc9b43 ("bpf: Add helper to retrieve socket in BPF")
    mistakenly passed the destination port in network byte-order to the IPv6
    TCP/UDP socket lookup functions, which meant that BPF writers would need
    to either manually swap the byte-order of this field or otherwise IPv6
    sockets could not be located via this helper.
    
    Fix the issue by swapping the byte-order appropriately in the helper.
    This also makes the API more consistent with the IPv4 version.
    
    Fixes: 6acc9b43 ("bpf: Add helper to retrieve socket in BPF")
    Signed-off-by: default avatarJoe Stringer <joe@wand.net.nz>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    5ef0ae84
filter.c 198 KB