From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Tom Herbert <tom@herbertland.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net 2/2] udp: restrict offloads to one namespace
Date: Wed, 16 Dec 2015 17:43:34 +0100 [thread overview]
Message-ID: <567194B6.3030301@stressinduktion.org> (raw)
In-Reply-To: <CALx6S36ap9-uWPcxskYRahUoH_H+Y99=qzPDc97g_eEyndL3tg@mail.gmail.com>
On 15.12.2015 23:39, Tom Herbert wrote:
> On Tue, Dec 15, 2015 at 12:46 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
>> On 15.12.2015 21:26, Tom Herbert wrote:
>>> On Tue, Dec 15, 2015 at 12:01 PM, Hannes Frederic Sowa
>>> <hannes@stressinduktion.org> wrote:
>>>> udp tunnel offloads tend to aggregate datagrams based on inner
>>>> headers. gro engine gets notified by tunnel implementations about
>>>> possible offloads. The match is solely based on the port number.
>>>>
>>>> Imagine a tunnel bound to port 53, the offloading will look into all
>>>> DNS packets and tries to aggregate them based on the inner data found
>>>> within. This could lead to data corruption and malformed DNS packets.
>>>>
>>>> While this patch minimizes the problem and helps an administrator to find
>>>> the issue by querying ip tunnel/fou, a better way would be to match on
>>>> the specific destination ip address so if a user space socket is bound
>>>> to the same address it will conflict.
>>>>
>>> I don't know... seems like this is more likely to add code into the
>>> critical path rather than solve a problem impacting anyone yet. No
>>> other GRO code needs to be namespace aware and none of these fancy HW
>>> offloads for UDP encapsulations are going to care anything about
>>> namespaces.
>>
>> HW encapsulation actually already respects namespaces, they only iterate
>> over the net_devices in the namespace the tunnel is created in to push
>> down the udp port information.
>>
>> I would like to extend this to destination addresses, too. I am not sure
>> this is possible and if hw offloads actually corrupt packets.
>>
>>> I think you point out the real underlying problem though, the UDP
>>> offloads are restricted only be done by destination port and nothing
>>> else. A more flexible method would be to allow matching on based
>>> addresses, four tuples, interfaces etc. (latter may be needed to
>>> offload connected UDP).
>>
>> With net namespaces a quadruple does not uniquely identify a socket
>> anymore, as different netns could have the same ip address bound. So
>> separation by netns seems to be the first and easy implementable
>> solution to protect against those problems. I am already working to push
>> the local address to gro, too.
>>
> Consider the following scenario with netns:
>
> 1) VXLAN is loaded with port number 7777.
> 2) add_rx_port is caller, driver gets this and then programs device
> that port number 7777 means VXLAN.
> 3) A network name space is added using L3 IPVLAN
> 4) Application in network space now binds an application (not VXLAN)
> to port 7777
> 5) Packets sent to the application at port 7777 are misinterpreted as
> VLXAN by the device
>
> Hopefully, the misinterpretation won't result in corrupted packet (RSS
> and checksum offload should not). However, LRO would have the
> potential for corruption... Unfortunately, this is potentially a
> problem on the host today with GRO since it appears we are doing GRO
> before identifying the packet as IPVLAN :-(
Yes, this is also a possible scenario.
In regard to moving interfaces which have enabled hw offloading across
namespaces this becomes funnier.
I think we should start to add a some more offloading querying
facilities either with procfs or netlink.
Thanks,
Hannes
next prev parent reply other threads:[~2015-12-16 16:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 20:01 [PATCH net 1/2] fou: clean up socket with kfree_rcu Hannes Frederic Sowa
2015-12-15 20:01 ` [PATCH net 2/2] udp: restrict offloads to one namespace Hannes Frederic Sowa
2015-12-15 20:26 ` Tom Herbert
2015-12-15 20:46 ` Hannes Frederic Sowa
2015-12-15 22:39 ` Tom Herbert
2015-12-16 16:43 ` Hannes Frederic Sowa [this message]
2015-12-17 0:04 ` David Miller
2015-12-17 8:49 ` Hannes Frederic Sowa
2015-12-17 17:32 ` Tom Herbert
2015-12-17 17:40 ` Hannes Frederic Sowa
2015-12-17 18:10 ` Tom Herbert
2015-12-17 20:33 ` Hannes Frederic Sowa
2015-12-17 21:31 ` Tom Herbert
2015-12-17 0:03 ` [PATCH net 1/2] fou: clean up socket with kfree_rcu David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=567194B6.3030301@stressinduktion.org \
--to=hannes@stressinduktion.org \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).