From owner-svn-src-user@FreeBSD.ORG  Tue Sep 20 00:19:36 2011
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7445F106564A;
	Tue, 20 Sep 2011 00:19:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 642748FC14;
	Tue, 20 Sep 2011 00:19:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K0Jav1002343;
	Tue, 20 Sep 2011 00:19:36 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K0JaOX002341;
	Tue, 20 Sep 2011 00:19:36 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <201109200019.p8K0JaOX002341@svn.freebsd.org>
From: Hiroki Sato <hrs@FreeBSD.org>
Date: Tue, 20 Sep 2011 00:19:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r225680 - user/hrs/ipv6/usr.sbin/rtadvd
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Sep 2011 00:19:36 -0000

Author: hrs
Date: Tue Sep 20 00:19:36 2011
New Revision: 225680
URL: http://svn.freebsd.org/changeset/base/225680

Log:
  Remove RA timer on an interface with !IFF_UP actively after starting to send
  clean-up RA messages for shutting down.  The RA timers could prevent the rtadvd
  daemon from shutting down because ra_output() just ignored !IFF_UP interfaces
  and TRANSITIVE->UNCONFIGURED state transition never happend due to it.
  
  Spotted by:	kib

Modified:
  user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c

Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c	Mon Sep 19 23:49:59 2011	(r225679)
+++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c	Tue Sep 20 00:19:36 2011	(r225680)
@@ -381,6 +381,21 @@ rtadvd_shutdown(void)
 		    "waiting expiration of the all RA timers.");
 
 		TAILQ_FOREACH(ifi, &ifilist, ifi_next) {
+			/*
+			 * Ignore !IFF_UP interfaces in waiting for shutdown.
+			 */
+			if (!(ifi->ifi_flags & IFF_UP) &&
+			    ifi->ifi_ra_timer != NULL) {
+				ifi->ifi_state = IFI_STATE_UNCONFIGURED;
+				rtadvd_remove_timer(ifi->ifi_ra_timer);
+				ifi->ifi_ra_timer = NULL;
+				syslog(LOG_DEBUG, "<%s> %s(idx=%d) is down. "
+				    "Timer removed and marked as UNCONFIGURED.",
+				     __func__, ifi->ifi_ifname,
+				    ifi->ifi_ifindex);
+			}
+		}
+		TAILQ_FOREACH(ifi, &ifilist, ifi_next) {
 			if (ifi->ifi_ra_timer != NULL)
 				break;
 		}