From nobody@FreeBSD.org  Thu Oct 24 09:14:44 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 0BAA8D8E
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Oct 2013 09:14:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id ED9312916
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Oct 2013 09:14:43 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r9O9EhA3045028
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Oct 2013 09:14:43 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r9O9EhGK044930;
	Thu, 24 Oct 2013 09:14:43 GMT
	(envelope-from nobody)
Message-Id: <201310240914.r9O9EhGK044930@oldred.freebsd.org>
Date: Thu, 24 Oct 2013 09:14:43 GMT
From: Luc Revardel <lrevardel@nvidia.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ICMP6_PACKET_TOO_BIG doesn't create an entry in hostcache if multifib is active
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         183265
>Category:       kern
>Synopsis:       ICMP6_PACKET_TOO_BIG doesn't create an entry in hostcache if multifib is active
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ae
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 24 09:20:00 UTC 2013
>Closed-Date:    Mon Nov 11 10:45:36 UTC 2013
>Last-Modified:  Mon Nov 11 10:50:04 UTC 2013
>Originator:     Luc Revardel
>Release:        8.2
>Organization:
NVidia
>Environment:
Linux 2.6.24-24-generic #1 SMP Fri Jul 24 22:46:06 UTC 2009 i686 GNU/Linux
>Description:
This issue occurs when running in multifib (MAXROUTES=11)

Upon reception of an ICMP6 PACKET_TOO_BIG, the hostcache isn't updated with the MTU provided by the ICMP error message.
Subsequent IPv6 packet are not fragmented according to the new MTU value as they should be.
>How-To-Repeat:
Ensure the kernel is compiled with MAXROUTES>1.

Ping a remote destination on the internet using large ping packets (>1500). The route to the destination should contain a segment on which the MTU is smaller than 1500 (say X) in order to reproduce the problem.

First ping packet (IPv6 fragment)should be emitted with a size of 1500.
The host shold receive an ICMP6 packet with a smaller MTU (X).
Next ping packet will be re-emitted with a size of 1500 instead of X.

>Fix:
It looks like the fibnum isn't managed by icmp6_mtudisc_update.
tcp_macmtu6 doesn't find a route matching the searched address.

Fixing inc.inc_fibnum in icmp6_mtudisc_update() seems to solve the problem:

icmp6_mtudisc_update()
[...]
	bzero(&inc, sizeof(inc));
	inc.inc_flags |= INC_ISIPV6;
	inc.inc6_faddr = *dst;
+	inc.inc_fibnum = M_GETFIB(ip6cp->ip6c_m);
	if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL))
		return;

	if (mtu < tcp_maxmtu6(&inc, NULL)) {
		tcp_hc_updatemtu(&inc, mtu);
		ICMP6STAT_INC(icp6s_pmtuchg);
	}
[...]

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ae 
Responsible-Changed-By: ae 
Responsible-Changed-When: Fri Oct 25 00:56:28 UTC 2013 
Responsible-Changed-Why:  
Take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183265 
State-Changed-From-To: open->patched 
State-Changed-By: ae 
State-Changed-When: Fri Oct 25 01:02:36 UTC 2013 
State-Changed-Why:  
Commited in head/. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183265 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183265: commit references a PR
Date: Fri, 25 Oct 2013 01:02:45 +0000 (UTC)

 Author: ae
 Date: Fri Oct 25 01:02:25 2013
 New Revision: 257084
 URL: http://svnweb.freebsd.org/changeset/base/257084
 
 Log:
   Initialize inc_fibnum for properly handling ICMP6_PACKET_TOO_BIG errors
   in multifib environment.
   
   PR:		183265
   MFC after:	1 week
 
 Modified:
   head/sys/netinet6/icmp6.c
 
 Modified: head/sys/netinet6/icmp6.c
 ==============================================================================
 --- head/sys/netinet6/icmp6.c	Fri Oct 25 00:35:26 2013	(r257083)
 +++ head/sys/netinet6/icmp6.c	Fri Oct 25 01:02:25 2013	(r257084)
 @@ -1227,6 +1227,7 @@ icmp6_mtudisc_update(struct ip6ctlparam 
  		mtu = IPV6_MMTU - 8;
  
  	bzero(&inc, sizeof(inc));
 +	inc.inc_fibnum = M_GETFIB(m);
  	inc.inc_flags |= INC_ISIPV6;
  	inc.inc6_faddr = *dst;
  	if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: ae 
State-Changed-When: Mon Nov 11 10:44:57 UTC 2013 
State-Changed-Why:  
Merged to stable/8, stable/9 and stable/10. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183265 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183265: commit references a PR
Date: Mon, 11 Nov 2013 10:44:46 +0000 (UTC)

 Author: ae
 Date: Mon Nov 11 10:44:38 2013
 New Revision: 257963
 URL: http://svnweb.freebsd.org/changeset/base/257963
 
 Log:
   MFC r257084:
     Initialize inc_fibnum for properly handling ICMP6_PACKET_TOO_BIG
     errors in multifib environment.
   
     PR:		183265
 
 Modified:
   stable/8/sys/netinet6/icmp6.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/netinet6/   (props changed)
 
 Modified: stable/8/sys/netinet6/icmp6.c
 ==============================================================================
 --- stable/8/sys/netinet6/icmp6.c	Mon Nov 11 10:43:55 2013	(r257962)
 +++ stable/8/sys/netinet6/icmp6.c	Mon Nov 11 10:44:38 2013	(r257963)
 @@ -1159,6 +1159,7 @@ icmp6_mtudisc_update(struct ip6ctlparam 
  		mtu = IPV6_MMTU - 8;
  
  	bzero(&inc, sizeof(inc));
 +	inc.inc_fibnum = M_GETFIB(m);
  	inc.inc_flags |= INC_ISIPV6;
  	inc.inc6_faddr = *dst;
  	if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183265: commit references a PR
Date: Mon, 11 Nov 2013 10:44:02 +0000 (UTC)

 Author: ae
 Date: Mon Nov 11 10:43:55 2013
 New Revision: 257962
 URL: http://svnweb.freebsd.org/changeset/base/257962
 
 Log:
   MFC r257084:
     Initialize inc_fibnum for properly handling ICMP6_PACKET_TOO_BIG
     errors in multifib environment.
   
     PR:		183265
 
 Modified:
   stable/9/sys/netinet6/icmp6.c
 Directory Properties:
   stable/9/sys/   (props changed)
 
 Modified: stable/9/sys/netinet6/icmp6.c
 ==============================================================================
 --- stable/9/sys/netinet6/icmp6.c	Mon Nov 11 10:43:39 2013	(r257961)
 +++ stable/9/sys/netinet6/icmp6.c	Mon Nov 11 10:43:55 2013	(r257962)
 @@ -1242,6 +1242,7 @@ icmp6_mtudisc_update(struct ip6ctlparam 
  		mtu = IPV6_MMTU - 8;
  
  	bzero(&inc, sizeof(inc));
 +	inc.inc_fibnum = M_GETFIB(m);
  	inc.inc_flags |= INC_ISIPV6;
  	inc.inc6_faddr = *dst;
  	if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183265: commit references a PR
Date: Mon, 11 Nov 2013 10:43:52 +0000 (UTC)

 Author: ae
 Date: Mon Nov 11 10:43:39 2013
 New Revision: 257961
 URL: http://svnweb.freebsd.org/changeset/base/257961
 
 Log:
   MFC r257084:
     Initialize inc_fibnum for properly handling ICMP6_PACKET_TOO_BIG
     errors in multifib environment.
   
     PR:		183265
   Approved by:	re (hrs)
 
 Modified:
   stable/10/sys/netinet6/icmp6.c
 Directory Properties:
   stable/10/sys/   (props changed)
 
 Modified: stable/10/sys/netinet6/icmp6.c
 ==============================================================================
 --- stable/10/sys/netinet6/icmp6.c	Mon Nov 11 10:38:37 2013	(r257960)
 +++ stable/10/sys/netinet6/icmp6.c	Mon Nov 11 10:43:39 2013	(r257961)
 @@ -1227,6 +1227,7 @@ icmp6_mtudisc_update(struct ip6ctlparam 
  		mtu = IPV6_MMTU - 8;
  
  	bzero(&inc, sizeof(inc));
 +	inc.inc_fibnum = M_GETFIB(m);
  	inc.inc_flags |= INC_ISIPV6;
  	inc.inc6_faddr = *dst;
  	if (in6_setscope(&inc.inc6_faddr, m->m_pkthdr.rcvif, NULL))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
