[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9qQ=E1L0XVe=i714AMdpMJQs3zPz=XVKW9Ck6TvGu_Hew@mail.gmail.com>
Date: Mon, 10 Feb 2020 22:59:57 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Florian Westphal <fw@...len.de>
Cc: Netdev <netdev@...r.kernel.org>, David Miller <davem@...emloft.net>
Subject: Re: [PATCH v2 net 1/5] icmp: introduce helper for NAT'd source
address in network device context
Hi Florian,
On Mon, Feb 10, 2020 at 10:33 PM Florian Westphal <fw@...len.de> wrote:
>
> Jason A. Donenfeld <Jason@...c4.com> wrote:
> > On Mon, Feb 10, 2020 at 3:15 PM Jason A. Donenfeld <Jason@...c4.com> wrote:
> > > + ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
> > > + }
> > > + icmp_send(skb_in, type, code, info);
> >
> > According to the comments in icmp_send, access to
> > ip_hdr(skb_in)->saddr requires first checking for `if
> > (skb_network_header(skb_in) < skb_in->head ||
> > (skb_network_header(skb_in) + sizeof(struct iphdr)) >
> > skb_tail_pointer(skb_in))` first to be safe.
>
> You will probably also need skb_ensure_writable() to handle cloned skbs.
>
> I also suggest to check "ct->status & IPS_NAT_MASK", nat is only done if
> those bits are set.
Thanks for the suggestions. I've made these changes and they're queued
up for a v3, currently staged in wireguard-linux.git's stable branch:
https://git.zx2c4.com/wireguard-linux/log/?h=stable
Jason
Powered by blists - more mailing lists