From jinmei@shuttle.wide.toshiba.co.jp  Wed Sep 20 05:36:45 2006
Return-Path: <jinmei@shuttle.wide.toshiba.co.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0DCA016A403
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Sep 2006 05:36:45 +0000 (UTC)
	(envelope-from jinmei@shuttle.wide.toshiba.co.jp)
Received: from shuttle.wide.toshiba.co.jp (shuttle.wide.toshiba.co.jp [202.249.10.124])
	by mx1.FreeBSD.org (Postfix) with ESMTP id ADB9243D45
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Sep 2006 05:36:44 +0000 (GMT)
	(envelope-from jinmei@shuttle.wide.toshiba.co.jp)
Received: from shuttle.wide.toshiba.co.jp (localhost [::1])
	by shuttle.wide.toshiba.co.jp (Postfix) with ESMTP id 1BFD615267
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Sep 2006 14:36:43 +0900 (JST)
Received: (from jinmei@localhost)
	by shuttle.wide.toshiba.co.jp (8.12.8p1/8.12.6/Submit) id k8K5agKO050954;
	Wed, 20 Sep 2006 14:36:42 +0900 (JST)
Message-Id: <200609200536.k8K5agKO050954@shuttle.wide.toshiba.co.jp>
Date: Wed, 20 Sep 2006 14:36:42 +0900 (JST)
From: JINMEI Tatuya <jinmei@kame.net>
Reply-To: JINMEI Tatuya <jinmei@kame.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: IPv6 packets arriving to stf are not accepted
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         103415
>Category:       kern
>Synopsis:       IPv6 packets arriving to stf are not accepted
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 20 05:40:21 GMT 2006
>Closed-Date:    Fri Sep 22 01:45:09 GMT 2006
>Last-Modified:  Fri Sep 22 01:50:14 GMT 2006
>Originator:     JINMEI Tatuya
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
KAME Project
>Environment:
System: FreeBSD impact.jinmei.org 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #1: Wed Sep 20 01:43:54 JST 2006 jinmei@impact.jinmei.org:/local/usr.local/freebsd/src-6.1S/sys/i386/compile/GBDE i386


	
>Description:

Recent FreeBSD kernels (6-STABLE and probably 5-STABLE also) fail to
accept IPv6 packets assigned on an stf (6to4) interface of the
receiving node.

This is a (buggy) side-effect of a fix to netinet6/in6.c (rev. 1.61).
With this fix the in6_ifaddr structure corresponding to the IPv6
address configured on the stf interface won't have the ifa_rtrequest
function (since nd6_need_cache() returns false for the interface).  As
a side-effect that was not expected at that time, the loopback route
to the configured address generated via in6_ifaddloop() is not
installed properly.

ip6_input() requires the loopback route to accept incoming packets to
the receiving node, so this change caused the problem reported here.

>How-To-Repeat:

# ifconfig stf0 create
# ifconfig stf0 inet6 2002:c000:0201::1 prefixlen 16
% ping6 2002:c000:0201::1

And you'll notice the ping6 doesn't receive the echo-replies.
netstat -s -p ip6 should indicate the echo-requests are dropped in
ip6_input().

>Fix:

Apply the patch below.

Index: in6.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/in6.c,v
retrieving revision 1.51.2.9
diff -u -r1.51.2.9 in6.c
--- in6.c	17 Jun 2006 17:58:33 -0000	1.51.2.9
+++ in6.c	20 Sep 2006 05:35:05 -0000
@@ -1720,8 +1720,12 @@
 
 	/* we could do in(6)_socktrim here, but just omit it at this moment. */
 
-	if (newhost && nd6_need_cache(ifp) != 0) {
-		/* set the rtrequest function to create llinfo */
+	if (newhost) {
+		/*
+		 * set the rtrequest function to create llinfo.  It also
+		 * adjust outgoing interface of the route for the local
+		 * address when called via in6_ifaddloop() below. 
+		 */
 		ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
 	}
 


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: suz 
State-Changed-When: Fri Sep 22 01:44:24 UTC 2006 
State-Changed-Why:  
the proposed patch is okay, so I committed it to -current 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/103415: commit references a PR
Date: Fri, 22 Sep 2006 01:42:41 +0000 (UTC)

 suz         2006-09-22 01:42:22 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/netinet6         in6.c 
   Log:
   fixed a bug that IPv6 packets arriving to stf are not accepted.
   (a degrade introduced in in6.c Rev 1.61)
   
   PR: kern/103415
   Submitted by: JINMEI Tatuya
   MFC after: 1 week
   
   Revision  Changes    Path
   1.64      +6 -2      src/sys/netinet6/in6.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
