From owner-freebsd-rc@FreeBSD.ORG Tue Oct 18 14:10:39 2005 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 590CC16A41F for ; Tue, 18 Oct 2005 14:10:39 +0000 (GMT) (envelope-from cryx-freebsd@h3q.com) Received: from mail.h3q.com (mail.h3q.com [217.13.206.148]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8351D43D46 for ; Tue, 18 Oct 2005 14:10:37 +0000 (GMT) (envelope-from cryx-freebsd@h3q.com) Received: (qmail 18264 invoked from network); 18 Oct 2005 14:09:56 -0000 Received: from unknown (HELO ?192.168.23.34?) (cryx@85.178.78.60) by mail.h3q.com with AES256-SHA encrypted SMTP; 18 Oct 2005 14:09:56 -0000 Message-ID: <43550260.9050206@h3q.com> Date: Tue, 18 Oct 2005 16:10:40 +0200 From: Philipp Wuensche User-Agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brooks Davis References: <435412F7.2030906@h3q.com> <20051017215309.GH15097@odin.ac.hmc.edu> <435443DE.6090300@h3q.com> <20051018015233.GA20157@odin.ac.hmc.edu> In-Reply-To: <20051018015233.GA20157@odin.ac.hmc.edu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-rc@freebsd.org Subject: Re: alias configuration in rc.conf X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2005 14:10:39 -0000 Brooks Davis wrote: > Similar code could presumably be written for ipv6. The range feature will be a bit more complicated but yes. >>>Corresponding ifalias_down() support should also be added. >> >>Done. > > Since there's a one word difference between the two cases, I think > an ipv4_addrs_common function taking an add or delete argument and the > interface would be appropriate to avoid duplication of this code. > Also, if you could find a way to rewrite the loop so ifconfig is only > called in one place, that would be a bit cleaner. You're right, I removed the code duplication by implementing a ipv4_addr_common function, getting the interface and an action as argument and giving back a list of cidr-ipaddr. directly usable with ifconfig. ipv4_addr_common is called by ipv4_up() and ipv4_down() which also use ifconfig_if() and ifalias_if(), appending the alias or -alias arguement used by ifconfig and finally executing ifconfig. ipv4_up() and ipv4_down() could be called by etc/rc.d/netif, removing ifconfig_if() and ifalias_if(). To test the code easier, I put my implementation in a shell script: http://outpost.h3q.com/patches/ipv4-ifconfig.sh greetings, cryx