From nobody@FreeBSD.org  Thu Dec 27 20:24:14 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 879C916A418
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 20:24:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DF2113C47E
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 20:24:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lBRKNagB008834
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Dec 2007 20:23:36 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lBRKNa0h008833;
	Thu, 27 Dec 2007 20:23:36 GMT
	(envelope-from nobody)
Message-Id: <200712272023.lBRKNa0h008833@www.freebsd.org>
Date: Thu, 27 Dec 2007 20:23:36 GMT
From: Jaakko Heinonen <jh@saunalahti.fi>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] /etc/rc.d/netif tries to remove alias addresses two times from interfaces
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         119076
>Category:       conf
>Synopsis:       [patch] [rc.d] /etc/rc.d/netif tries to remove alias addresses two times from interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 27 20:30:00 UTC 2007
>Closed-Date:    
>Last-Modified:  Mon Jan 12 00:04:06 UTC 2009
>Originator:     Jaakko Heinonen
>Release:        7.0-BETA4
>Organization:
>Environment:
FreeBSD x 7.0-BETA4 FreeBSD 7.0-BETA4 #0: Sun Dec  2 19:19:04 UTC 2007     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
/etc/rc.d/netif runs first "ifconfig interface inet x.x.x.x delete" and then "ifconfig interface inet x.x.x.x -alias" for network interface aliases defined in /etc/rc.conf with ifconfig_<int>_aliasX syntax. The second attempt to remove an address results an error.
>How-To-Repeat:
/etc/rc.conf:
ifconfig_vr0="inet 10.0.0.3 netmask 255.0.0.0"
ifconfig_vr0_alias0="inet 10.0.0.4"

# /etc/rc.d/netif stop vr0
Stopping network:ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address vr0.

(after applying the attached patch)
# /etc/rc.d/netif stop vr0
Stopping network: vr0.

>Fix:


Patch attached with submission follows:

--- ./network.subr.orig	Fri Jan 12 09:13:15 2007
+++ ./network.subr	Tue Dec 25 23:01:19 2007
@@ -284,6 +284,9 @@
 
 	ifexists ${_if} || return 1
 
+	ifalias_down ${_if} && _ret=0
+	ipv4_addrs_common ${_if} -alias && _ret=0
+
 	inetList="`ifconfig ${_if} | grep 'inet ' | tr "\n" "$_ifs"`"
 
 	oldifs="$IFS"
@@ -300,9 +303,6 @@
 		_ret=0
 	done
 	IFS="$oldifs"
-
-	ifalias_down ${_if} && _ret=0
-	ipv4_addrs_common ${_if} -alias && _ret=0
 
 	return $_ret
 }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sun Jan 27 23:10:10 UTC 2008 
Responsible-Changed-Why:  
Over to rc mailing list 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119076 
>Unformatted:
