All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Heffner <jheffner@psc.edu>
To: David Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>,
	netdev@vger.kernel.org, John Heffner <jheffner@psc.edu>
Subject: [PATCH] [NET] MTU discovery check in ip6_fragment()
Date: Wed, 18 Apr 2007 21:07:43 -0400	[thread overview]
Message-ID: <11769448654084-git-send-email-jheffner@psc.edu> (raw)
In-Reply-To: <11769448642649-git-send-email-jheffner@psc.edu>

Adds a check in ip6_fragment() mirroring ip_fragment() for packets
that we can't fragment, and sends an ICMP Packet Too Big message
in response.

Signed-off-by: John Heffner <jheffner@psc.edu>
---
 net/ipv6/ip6_output.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4cfdad4..5a5b7d4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -567,6 +567,19 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 	nexthdr = *prevhdr;
 
 	mtu = dst_mtu(&rt->u.dst);
+
+	/* 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.)
+	 */
+	if (!np || np->pmtudisc >= IPV6_PMTUDISC_DO) {
+		skb->dev = skb->dst->dev;
+		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
+		IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS);
+		kfree_skb(skb);
+		return -EMSGSIZE;
+	}
+
 	if (np && np->frag_size < mtu) {
 		if (np->frag_size)
 			mtu = np->frag_size;
-- 
1.5.1.rc3.30.ga8f4-dirty


  reply	other threads:[~2007-04-19  1:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-24  0:06 [PATCH 1/3] [NET] Do pmtu check in transport layer John Heffner
2007-03-24  0:06 ` [PATCH 2/3] [NET] Move DF check to ip_forward John Heffner
2007-03-24  0:06   ` [PATCH 3/3] [NET] Add IP(V6)_PMTUDISC_RPOBE John Heffner
2007-03-25  4:23     ` David Miller
2007-03-27 14:18     ` Andi Kleen
     [not found]       ` <4609640D.7010709@psc.edu>
     [not found]         ` <20070327193115.GA28138@one.firstfloor.org>
2007-03-27 19:52           ` [PATCH] ip(7) IP_PMTUDISC_PROBE John Heffner
2007-04-08 18:08             ` Michael Kerrisk
2007-03-25  4:17   ` [PATCH 2/3] [NET] Move DF check to ip_forward David Miller
2007-03-25 13:37   ` [NET]: Fix breakage, use ip_hdr() for DF check in ip_forward Thomas Graf
2007-03-25 20:27     ` David Miller
2007-03-25  4:14 ` [PATCH 1/3] [NET] Do pmtu check in transport layer David Miller
2007-04-09  8:40 ` Patrick McHardy
2007-04-09 16:23   ` John Heffner
2007-04-09 16:40     ` Patrick McHardy
2007-04-19  1:07   ` [PATCH 0/0] Re-try changes for PMTUDISC_PROBE John Heffner
2007-04-20 22:55     ` David Miller
2007-04-19  1:07 ` [PATCH] Revert "[NET] Add IP(V6)_PMTUDISC_RPOBE" John Heffner
2007-04-19  1:07   ` [PATCH] Revert "[NET] Do pmtu check in transport layer" John Heffner
2007-04-19  1:07     ` John Heffner [this message]
2007-04-19  1:07       ` [PATCH] [NET] Add IP(V6)_PMTUDISC_RPOBE John Heffner
2007-04-19  1:11         ` John Heffner
2007-04-19  1:25           ` David Miller
2007-04-19  1:09 ` [PATCH 1/4] Revert "[NET] Add IP(V6)_PMTUDISC_RPOBE" John Heffner
2007-04-19  1:09   ` [PATCH 2/4] Revert "[NET] Do pmtu check in transport layer" John Heffner
2007-04-19  1:09     ` [PATCH 3/4] [NET] MTU discovery check in ip6_fragment() John Heffner
2007-04-19  1:09       ` [PATCH 4/4] [NET] Add IP(V6)_PMTUDISC_RPOBE John Heffner

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=11769448654084-git-send-email-jheffner@psc.edu \
    --to=jheffner@psc.edu \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    /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 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.