lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH3MdRUPRiHMs7d23NAxuT0trgXY4gPYvrXH4XdW1eYqSBXwrQ@mail.gmail.com>
Date:   Mon, 22 Apr 2019 16:35:32 -0700
From:   Y Song <ys114321@...il.com>
To:     Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc:     netdev <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        alan.maguire@...cle.com, Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH bpf-next 1/2] bpf: update skb->protocol in bpf_skb_net_grow

On Mon, Apr 22, 2019 at 7:58 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> From: Willem de Bruijn <willemb@...gle.com>
>
> Some tunnels, like sit, change the network protocol of packet.
> If so, update skb->protocol to match the new type.
>
> Signed-off-by: Willem de Bruijn <willemb@...gle.com>

Acked-by: Yonghong Song <yhs@...com>

> ---
>  net/core/filter.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 1833926a63fc1..bd4d498fabfa4 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3047,6 +3047,14 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 off, u32 len_diff,
>
>                         skb_set_transport_header(skb, mac_len + nh_len);
>                 }
> +
> +               /* Match skb->protocol to new outer l3 protocol */
> +               if (skb->protocol == htons(ETH_P_IP) &&
> +                   flags & BPF_F_ADJ_ROOM_ENCAP_L3_IPV6)
> +                       skb->protocol = htons(ETH_P_IPV6);
> +               else if (skb->protocol == htons(ETH_P_IPV6) &&
> +                        flags & BPF_F_ADJ_ROOM_ENCAP_L3_IPV4)
> +                       skb->protocol = htons(ETH_P_IP);
>         }
>
>         if (skb_is_gso(skb)) {
> --
> 2.21.0.593.g511ec345e18-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ