Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1491720 > unrolled thread
| Started by | David Miller <davem@davemloft.net> |
|---|---|
| First post | 2016-09-27 09:40 +0200 |
| Last post | 2016-09-29 17:40 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 David Miller <davem@davemloft.net> - 2016-09-27 09:40 +0200
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 "R. Parameswaran" <parameswaran.r7@gmail.com> - 2016-09-27 21:20 +0200
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 David Miller <davem@davemloft.net> - 2016-09-28 09:50 +0200
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 "R. Parameswaran" <parameswaran.r7@gmail.com> - 2016-09-29 04:40 +0200
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 Jiri Benc <jbenc@redhat.com> - 2016-09-29 14:30 +0200
Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 James Chapman <jchapman@katalix.com> - 2016-09-29 17:40 +0200
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-09-27 09:40 +0200 |
| Subject | Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 |
| Message-ID | <slV9D-6Fu-5@gated-at.bofh.it> |
From: "R. Parameswaran" <parameswaran.r7@gmail.com> Date: Thu, 22 Sep 2016 13:52:43 -0700 (PDT) > From ed585bdd6d3d2b3dec58d414f514cd764d89159d Mon Sep 17 00:00:00 2001 > From: "R. Parameswaran" <rparames@brocade.com> > Date: Thu, 22 Sep 2016 13:19:25 -0700 > Subject: [PATCH] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 > > Take into account all of the tunnel encapsulation headers when setting > up the MTU on the L2TP logical interface device. Otherwise, packets > created by the applications on top of the L2TP layer are larger > than they ought to be, relative to the underlay MTU, leading to > needless fragmentation once the outer IP encap is added. > > Specifically, take into account the (outer, underlay) IP header > imposed on the encapsulated L2TP packet, and the Layer 2 header > imposed on the inner IP packet prior to L2TP encapsulation. > > Do not assume an Ethernet (non-jumbo) underlay. Use the PMTU mechanism > and the dst entry in the L2TP tunnel socket to directly pull up > the underlay MTU (as the baseline number on top of which the > encapsulation headers are factored in). Fall back to Ethernet MTU > if this fails. > > Signed-off-by: R. Parameswaran <rparames@brocade.com> > > Reviewed-by: "N. Prachanda" <nprachan@brocade.com>, > Reviewed-by: "R. Shearman" <rshearma@brocade.com>, > Reviewed-by: "D. Fawcus" <dfawcus@brocade.com> I have to ask, how do other tunnels over UDP such as VXLAN handle this problem?
[toc] | [next] | [standalone]
| From | "R. Parameswaran" <parameswaran.r7@gmail.com> |
|---|---|
| Date | 2016-09-27 21:20 +0200 |
| Message-ID | <sm653-526-7@gated-at.bofh.it> |
| In reply to | #1491720 |
Hi David,
Thanks for the reply, please see inline:
On Tue, 27 Sep 2016, David Miller wrote:
> From: "R. Parameswaran" <parameswaran.r7@gmail.com>
> Date: Thu, 22 Sep 2016 13:52:43 -0700 (PDT)
>
> > From ed585bdd6d3d2b3dec58d414f514cd764d89159d Mon Sep 17 00:00:00 2001
> > From: "R. Parameswaran" <rparames@brocade.com>
> > Date: Thu, 22 Sep 2016 13:19:25 -0700
> > Subject: [PATCH] L2TP:Adjust intf MTU,factor underlay L3,overlay L2
> >
> > Take into account all of the tunnel encapsulation headers when setting
> > up the MTU on the L2TP logical interface device. Otherwise, packets
> > created by the applications on top of the L2TP layer are larger
> > than they ought to be, relative to the underlay MTU, leading to
> > needless fragmentation once the outer IP encap is added.
> >
> > Specifically, take into account the (outer, underlay) IP header
> > imposed on the encapsulated L2TP packet, and the Layer 2 header
> > imposed on the inner IP packet prior to L2TP encapsulation.
> >
> > Do not assume an Ethernet (non-jumbo) underlay. Use the PMTU mechanism
> > and the dst entry in the L2TP tunnel socket to directly pull up
> > the underlay MTU (as the baseline number on top of which the
> > encapsulation headers are factored in). Fall back to Ethernet MTU
> > if this fails.
> >
> > Signed-off-by: R. Parameswaran <rparames@brocade.com>
> >
> > Reviewed-by: "N. Prachanda" <nprachan@brocade.com>,
> > Reviewed-by: "R. Shearman" <rshearma@brocade.com>,
> > Reviewed-by: "D. Fawcus" <dfawcus@brocade.com>
>
> I have to ask, how do other tunnels over UDP such as VXLAN handle
> this problem?
>
Specific to Vxlan, it appears to behave similarly. I haven't functionally
tested fragmentation on vxlan interfaces, but looking at the
code, it seems to account for the headers involved:
When the vxlan interface is created, from vxlan_dev_create(), in
vxlan_setup(), it initially starts off with an ethernet MTU:
vxlan_setup(struct net_device *dev)
{
...
...
ether_setup(dev); <<<<<<< Will set device MTU to 1500
Later, in vxlan_dev_configure(), called from vxlan_dev_create(), it gets
adjusted to account for the headers:
vxlan_dev_configure():
...
if (!conf->mtu)
dev->mtu = lowerdev->mtu - (use_ipv6 ?
VXLAN6_HEADROOM : VXLAN_HEADROOM);
where VXLAN_HEADROOM is defined as follows:
/* IP header + UDP + VXLAN + Ethernet header */
#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
/* IPv6 header + UDP + VXLAN + Ethernet header */
#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
This seems to match what I see with hand config:
sudo ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth0 dstport
4789 <<<< (eth0 has an MTU of 1500)
sudo ip -d link show vxlan0
36: vxlan0: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN mode
DEFAULT group default <<<< (1450 = 1500 -50)
link/ether e2:b8:2d:f4:f7:ae brd ff:ff:ff:ff:ff:ff promiscuity 0
vxlan id 42 group 239.1.1.1 dev eth0 srcport 32768 61000 dstport 4789
ageing 300
thanks,
Ramkumar
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-09-28 09:50 +0200 |
| Message-ID | <smhMR-3RU-3@gated-at.bofh.it> |
| In reply to | #1492111 |
From: "R. Parameswaran" <parameswaran.r7@gmail.com> Date: Tue, 27 Sep 2016 12:17:21 -0700 (PDT) > Later, in vxlan_dev_configure(), called from vxlan_dev_create(), it gets > adjusted to account for the headers: > > vxlan_dev_configure(): > ... > if (!conf->mtu) > dev->mtu = lowerdev->mtu - (use_ipv6 ? > VXLAN6_HEADROOM : VXLAN_HEADROOM); > > > where VXLAN_HEADROOM is defined as follows: > > /* IP header + UDP + VXLAN + Ethernet header */ > #define VXLAN_HEADROOM (20 + 8 + 8 + 14) > /* IPv6 header + UDP + VXLAN + Ethernet header */ > #define VXLAN6_HEADROOM (40 + 8 + 8 + 14) Right but I don't see it going through the effort to make use of the PMTU like you are. I have another strong concern related to this. There seems to be no mechanism used to propagate any PMTU events into the device's MTU. Because if there is a limiting nexthop in the route to the other end of the UDP tunnel, you won't learn the PMTU until you (or some other entity on the machine) actually starts sending traffic to the tunnel's endpoint. If the PMTU events aren't propagated into the tunnel's MTU or similar I think this is an ad-hoc solution. I would suggest that you either: 1) Do what VXLAN appears to do an ignore the PMTu 2) Add code to handle PMTU events that land on the UDP tunnel socket. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | "R. Parameswaran" <parameswaran.r7@gmail.com> |
|---|---|
| Date | 2016-09-29 04:40 +0200 |
| Message-ID | <smzqp-6Cv-5@gated-at.bofh.it> |
| In reply to | #1492299 |
Hi David,
Please see inline:
On Wed, 28 Sep 2016, David Miller wrote:
> From: "R. Parameswaran" <parameswaran.r7@gmail.com>
> Date: Tue, 27 Sep 2016 12:17:21 -0700 (PDT)
>
> > Later, in vxlan_dev_configure(), called from vxlan_dev_create(), it gets
> > adjusted to account for the headers:
> >
> > vxlan_dev_configure():
> > ...
> > if (!conf->mtu)
> > dev->mtu = lowerdev->mtu - (use_ipv6 ?
> > VXLAN6_HEADROOM : VXLAN_HEADROOM);
> >
> >
> > where VXLAN_HEADROOM is defined as follows:
> >
> > /* IP header + UDP + VXLAN + Ethernet header */
> > #define VXLAN_HEADROOM (20 + 8 + 8 + 14)
> > /* IPv6 header + UDP + VXLAN + Ethernet header */
> > #define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
>
> Right but I don't see it going through the effort to make use of the
> PMTU like you are.
>
> I have another strong concern related to this. There seems to be no
> mechanism used to propagate any PMTU events into the device's MTU.
>
> Because if there is a limiting nexthop in the route to the other end
> of the UDP tunnel, you won't learn the PMTU until you (or some other
> entity on the machine) actually starts sending traffic to the tunnel's
> endpoint.
>
> If the PMTU events aren't propagated into the tunnel's MTU or similar
> I think this is an ad-hoc solution.
>
> I would suggest that you either:
>
> 1) Do what VXLAN appears to do an ignore the PMTu
>
I'd like to point out one difference with VXLAN - in VXLAN, the
local physical interface is directly specified at the time of
creation of the tunnel, and the data structure seems to have the ifindex
of the local interface with which it is able to directly pull up the
underlay interface device. Whereas in L2TP, we only have the IP
address of the remote tunnel end-point and thus only the socket and the
dst from which we need to derive this.
Also, dst_mtu references dst->ops->mtu, which if I followed the pointer
chain correctly, will dereference to ipv4_mtu() (for the IPv4 case, as
an example). The code in ipv4_mtu looks like the following:
ipv4_mtu():
unsigned int mtu = rt->rt_pmtu;
if (!mtu || time_after_eq(jiffies, rt->dst.expires))
mtu = dst_metric_raw(dst, RTAX_MTU);
if (mtu)
return mtu;
mtu = dst->dev->mtu;
if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
if (rt->rt_uses_gateway && mtu > 576)
mtu = 576;
}
return min_t(unsigned int, mtu, IP_MAX_MTU);
The code above does not depend on PMTU to be working. If no PMTU
discovered MTU exists, it eventually falls back to the local
underlay device MTU - and this is the mode in which I tested the fix - PMTU
was off in my testbed, but it was picking up the local device MTU correctly.
Basically, this looks better than the VXLAN handling as far as I can
tell - at least it will pick up the existing discovered PMTU on a best
effort basis, while falling back to the underlay device if all else fails.
I agree that something like 2. below would be needed in the long run (it
will need some effort and redesign -e.g. how do I lookup the parent tunnel
from the socket when receiving a PMTU update, existing pointer chain runs
from tunnel to socket).
But since the existing (Ethernet over L2TP) MTU derivation is incorrect, I am
hoping this may be acceptable as an interim solution.
thanks,
Ramkumar
> 2) Add code to handle PMTU events that land on the UDP tunnel
> socket.
>
> Thanks.
>
[toc] | [prev] | [next] | [standalone]
| From | Jiri Benc <jbenc@redhat.com> |
|---|---|
| Date | 2016-09-29 14:30 +0200 |
| Message-ID | <smIDn-45v-9@gated-at.bofh.it> |
| In reply to | #1493113 |
On Wed, 28 Sep 2016 19:36:45 -0700 (PDT), R. Parameswaran wrote: > I'd like to point out one difference with VXLAN - in VXLAN, the > local physical interface is directly specified at the time of > creation of the tunnel, and the data structure seems to have the ifindex > of the local interface with which it is able to directly pull up the > underlay interface device. Whereas in L2TP, we only have the IP > address of the remote tunnel end-point and thus only the socket and the > dst from which we need to derive this. Strictly speaking, VXLAN *may* know the underlying interface. It can also be set up with just local and remote IP address, or even worse, in metadata mode where we don't know the address nor the interface until we get a packet (and each packet may have those different). MTU wise, those cases are not accommodated for in the kernel. The vxlan interface gets MTU of 1500 and it's up to the administrator to set it correctly. Btw, PMTU events won't help with the metadata mode. And even in "normal" mode, it's not clear what should be done - the tunnel interface may be in a bridge, thus there may be other interfaces that depend on the same MTU, up to inside VMs. Jiri
[toc] | [prev] | [next] | [standalone]
| From | James Chapman <jchapman@katalix.com> |
|---|---|
| Date | 2016-09-29 17:40 +0200 |
| Subject | Re: [PATCH net v2] L2TP:Adjust intf MTU,factor underlay L3,overlay L2 |
| Message-ID | <smLBf-5S3-7@gated-at.bofh.it> |
| In reply to | #1493113 |
On 29/09/16 03:36, R. Parameswaran wrote: > I agree that something like 2. below would be needed in the long run (it > will need some effort and redesign -e.g. how do I lookup the parent tunnel > from the socket when receiving a PMTU update, existing pointer chain runs > from tunnel to socket). >> 2) Add code to handle PMTU events that land on the UDP tunnel >> socket. Another function pointer could be added to struct udp_sock, similar to encap_rcv, such that the pmtu event could be handled by the UDP encap protocol implementation. James
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web