Bug 183265

Summary: ICMP6_PACKET_TOO_BIG doesn't create an entry in hostcache if multifib is active
Product: Base System Reporter: Luc Revardel <lrevardel>
Component: kernAssignee: Andrey V. Elsukov <ae>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Luc Revardel 2013-10-24 10:20:00 UTC
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.

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);
	}
[...]
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.
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2013-10-25 01:56:28 UTC
Responsible Changed
From-To: freebsd-bugs->ae

Take it.
Comment 2 Andrey V. Elsukov freebsd_committer freebsd_triage 2013-10-25 02:02:36 UTC
State Changed
From-To: open->patched

Commited in head/. Thanks!
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-10-25 02:02:45 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"
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-11-11 10:43:52 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"
Comment 5 dfilter service freebsd_committer freebsd_triage 2013-11-11 10:44:02 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"
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-11-11 10:44:46 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"
Comment 7 Andrey V. Elsukov freebsd_committer freebsd_triage 2013-11-11 10:44:57 UTC
State Changed
From-To: patched->closed

Merged to stable/8, stable/9 and stable/10. Thanks!