All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: Use 1280 as min MTU for ipv6 forwarding
@ 2010-02-26  9:27 Ulrich Weber
  2010-02-26 11:59 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weber @ 2010-02-26  9:27 UTC (permalink / raw)
  To: davem; +Cc: netdev

Clients will set their MTU to 1280 if they receive a
ICMPV6_PKT_TOOBIG message with an MTU less than 1280.

To allow encapsulating of packets over a 1280 link
we should always accept packets with a size of 1280
for forwarding even if the path has a lower MTU and
fragment the encapsulated packets afterwards.

In case a forwarded packet is not going to be encapsulated
a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
with the correct MTU.

Signed-off-by: Ulrich Weber <uweber@astaro.com>
---
 net/ipv6/ip6_output.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index eb6d097..8e19bfe 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -402,6 +402,7 @@ int ip6_forward(struct sk_buff *skb)
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
 	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct net *net = dev_net(dst->dev);
+	u32 mtu;
 
 	if (net->ipv6.devconf_all->forwarding == 0)
 		goto error;
@@ -509,10 +510,14 @@ int ip6_forward(struct sk_buff *skb)
 		}
 	}
 
-	if (skb->len > dst_mtu(dst)) {
+	mtu = dst_mtu(dst);
+	if (mtu < IPV6_MIN_MTU)
+		mtu = IPV6_MIN_MTU;
+
+	if (skb->len > mtu) {
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
-		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst), skb->dev);
+		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
 		IP6_INC_STATS_BH(net,
 				 ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS);
 		IP6_INC_STATS_BH(net,
@@ -622,8 +627,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 	mtu = ip6_skb_dst_mtu(skb);
 
 	/* We must not fragment if the socket is set to force MTU discovery
-	 * or if the skb it not generated by a local socket.  (This last
-	 * check should be redundant, but it's free.)
+	 * or if the skb it not generated by a local socket.
 	 */
 	if (!skb->local_df) {
 		skb->dev = skb_dst(skb)->dev;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv6: Use 1280 as min MTU for ipv6 forwarding
  2010-02-26  9:27 [PATCH] ipv6: Use 1280 as min MTU for ipv6 forwarding Ulrich Weber
@ 2010-02-26 11:59 ` David Miller
  2010-02-26 12:32   ` [PATCH net-next] " Ulrich Weber
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2010-02-26 11:59 UTC (permalink / raw)
  To: uweber; +Cc: netdev

From: Ulrich Weber <uweber@astaro.com>
Date: Fri, 26 Feb 2010 10:27:52 +0100

> Clients will set their MTU to 1280 if they receive a
> ICMPV6_PKT_TOOBIG message with an MTU less than 1280.
> 
> To allow encapsulating of packets over a 1280 link
> we should always accept packets with a size of 1280
> for forwarding even if the path has a lower MTU and
> fragment the encapsulated packets afterwards.
> 
> In case a forwarded packet is not going to be encapsulated
> a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
> with the correct MTU.
> 
> Signed-off-by: Ulrich Weber <uweber@astaro.com>

Patch does not apply to net-next-2.6, icmpv6_send() no longer
takes the final 'dev' argument.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next] ipv6: Use 1280 as min MTU for ipv6 forwarding
  2010-02-26 11:59 ` David Miller
@ 2010-02-26 12:32   ` Ulrich Weber
  2010-02-26 12:34     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weber @ 2010-02-26 12:32 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Clients will set their MTU to 1280 if they receive a
ICMPV6_PKT_TOOBIG message with an MTU less than 1280.

To allow encapsulating of packets over a 1280 link
we should always accept packets with a size of 1280
for forwarding even if the path has a lower MTU and
fragment the encapsulated packets afterwards.

In case a forwarded packet is not going to be encapsulated
a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
with the correct MTU.

Signed-off-by: Ulrich Weber <uweber@astaro.com>
---
 net/ipv6/ip6_output.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1a5fe9a..dabf108 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -402,6 +402,7 @@ int ip6_forward(struct sk_buff *skb)
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
 	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct net *net = dev_net(dst->dev);
+	u32 mtu;
 
 	if (net->ipv6.devconf_all->forwarding == 0)
 		goto error;
@@ -508,10 +509,14 @@ int ip6_forward(struct sk_buff *skb)
 		}
 	}
 
-	if (skb->len > dst_mtu(dst)) {
+	mtu = dst_mtu(dst);
+	if (mtu < IPV6_MIN_MTU)
+		mtu = IPV6_MIN_MTU;
+
+	if (skb->len > mtu) {
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
-		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst));
+		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
 		IP6_INC_STATS_BH(net,
 				 ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS);
 		IP6_INC_STATS_BH(net,
@@ -621,8 +626,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 	mtu = ip6_skb_dst_mtu(skb);
 
 	/* We must not fragment if the socket is set to force MTU discovery
-	 * or if the skb it not generated by a local socket.  (This last
-	 * check should be redundant, but it's free.)
+	 * or if the skb it not generated by a local socket.
 	 */
 	if (!skb->local_df) {
 		skb->dev = skb_dst(skb)->dev;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] ipv6: Use 1280 as min MTU for ipv6 forwarding
  2010-02-26 12:32   ` [PATCH net-next] " Ulrich Weber
@ 2010-02-26 12:34     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-02-26 12:34 UTC (permalink / raw)
  To: uweber; +Cc: netdev

From: Ulrich Weber <uweber@astaro.com>
Date: Fri, 26 Feb 2010 13:32:44 +0100

> Clients will set their MTU to 1280 if they receive a
> ICMPV6_PKT_TOOBIG message with an MTU less than 1280.
> 
> To allow encapsulating of packets over a 1280 link
> we should always accept packets with a size of 1280
> for forwarding even if the path has a lower MTU and
> fragment the encapsulated packets afterwards.
> 
> In case a forwarded packet is not going to be encapsulated
> a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
> with the correct MTU.
> 
> Signed-off-by: Ulrich Weber <uweber@astaro.com>

Applied, thanks for fixing up this patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-26 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26  9:27 [PATCH] ipv6: Use 1280 as min MTU for ipv6 forwarding Ulrich Weber
2010-02-26 11:59 ` David Miller
2010-02-26 12:32   ` [PATCH net-next] " Ulrich Weber
2010-02-26 12:34     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.