From owner-freebsd-current Fri Apr 12 12:37:29 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id MAA01992 for current-outgoing; Fri, 12 Apr 1996 12:37:29 -0700 (PDT) Received: from GndRsh.aac.dev.com (GndRsh.aac.dev.com [198.145.92.241]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id MAA01952 for ; Fri, 12 Apr 1996 12:37:23 -0700 (PDT) Received: (from rgrimes@localhost) by GndRsh.aac.dev.com (8.6.12/8.6.12) id MAA21749; Fri, 12 Apr 1996 12:35:56 -0700 From: "Rodney W. Grimes" Message-Id: <199604121935.MAA21749@GndRsh.aac.dev.com> Subject: Re: feedback sought on proposed change to netstart To: jgreco@brasil.moneng.mei.com (Joe Greco) Date: Fri, 12 Apr 1996 12:35:56 -0700 (PDT) Cc: current@FreeBSD.org In-Reply-To: <199604121627.LAA17682@brasil.moneng.mei.com> from Joe Greco at "Apr 12, 96 11:27:09 am" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > > > Rod, > > > > > > See my previous mail. What if we _remove_ the ifconfig in netstart in the > > > case where there is a start_if. file? > > > > > > Theory being, that script is entirely responsible for starting the > > > interface. In my book that may include establishing a physical link, > > > and/or > > > setting up whatever addresses and aliases are appropriate. Can't this all be done on one line??? /etc/sysconfig: ifconfig_de0="inet a.b.c.d netmask 0xffffff00 alias v.x.y.z Will that not work correctly? [I have no idea, since I don't play with aliased interfaces :-(] > > > This seems like a very generalized solution to me (at least, it's what I do > > > here, and it works great for me). > > > > That seems quite reasonable... I have done this by setting ifconfig_${INT} > > to null in /etc/sysconfig. That does have the nasty side effect of of > > echoing the config parameters out twice, but it does what you want. > > > > I have no objection to the removal of if_config ${ifn} ${ifconfig_args] > > if an /etc/start_if.${ifn} is called. > > Hi Rod, > > Um, well. That would be an acceptable punt, I suppose, but in my "ideal" > situation I would like to still set ifconfig_ in /etc/sysconfig.. > memory aid type thing. :-) (I have numerous boxes with multi interfaces) My ``memory aid'' to remind me that I am actually setting these values up some place else is to set the ifconfig_${int} to null in /etc/sysconfig, that way I know I need to go look else where for the real stuff... > Thinking out loud: > > 1) it does not make a lot of sense to set up a variable that has no effect, > therefore setting ifconfig_ to nothing in sysconfig makes sense. Yep... kinda why I do it.. though some times I forget to do this and then pound my head against the wall for a while when I change it in /etc/sysconfig and it seems to have no effect :-) :-). > 2) it's still nice to see a high level explanation of interfaces in > sysconfig... so it would be nice to propagate this data into the > start_if. thingie. So then we would keep the ifconfig_ thingie. Since the start_if.${ifn} is a ``sourced'' shell script it has full access to ${ifn} and ifconfig_${ifn}. You can't pass args on a ``.'' command though. We could change the ``.'' to a ``sh'' and pass the args so it was clearer that you had access to them in /etc/start_if.${ifn}. > 3) that only (easily) works if start_if.xxx is a sourceable shell script.. > but the current construction makes that assumption anyways... maybe > that's not a problem. The problem is lack of documentation, perhaps a comment or even a sample /etc/start_if.FOOBAR that showed how you can use ${ifn} and ifconfig_${ifn} to do some fancier things. [I once had an /etc/start_if.slip that was symlinked to by 3 /etc/start_if.sl{0,1,2}'s, this script used ${ifn} to figure out what phone numbers to dial, and what modem ports to use with a case statement, no reason to duplicate code :-)]. > 4) this still hides alias address declarations, it's also not immediately > obvious at the sysconfig level that the interface configuration may actually > be set elsewhere, and could be set to something else entirely.. but that is > not a new problem, and it's not immediately apparent what the fix is. See above, can't you just tack the alias stuff onto the end of the ifconfig command, or must these be done as seperate ifconfig commands? > I guess my conclusion is that this is all an ugly hack, this change only > serves to make it somewhat more functional and flexible. Ideas on how to > elegantly fix it? I don't have any, at least any that retain the same level > of flexibility.. Here is one proposal... not much cleaner, it moves the ifconfig into the /etc/start_if.${ifn} and does the eval of ifconfig_${ifn} to create ifconfig_args before sourceing the script. Index: netstart =================================================================== RCS file: /home/ncvs/src/etc/netstart,v retrieving revision 1.32.4.3 diff -c -r1.32.4.3 netstart *** netstart 1995/08/25 07:21:46 1.32.4.3 --- netstart 1996/04/12 19:26:19 *************** *** 35,45 **** # Set up all the network interfaces, calling startup scripts if needed for ifn in ${network_interfaces}; do if [ -e /etc/start_if.${ifn} ]; then ! . /etc/start_if.${ifn} ${ifn} fi - eval ifconfig_args=\$ifconfig_${ifn} - ifconfig ${ifn} ${ifconfig_args} ifconfig ${ifn} done --- 35,46 ---- # Set up all the network interfaces, calling startup scripts if needed for ifn in ${network_interfaces}; do + eval ifconfig_args=\$ifconfig_${ifn} if [ -e /etc/start_if.${ifn} ]; then ! . /etc/start_if.${ifn} ! else ! ifconfig ${ifn} ${ifconfig_args} fi ifconfig ${ifn} done You could also change the ``. /etc/start_if.${ifn}'' to ``sh /etc/start_if.${ifn} ${ifconfig_args}'' if you wanted to make it clear that these are being passed in. This would remove the ability of /etc/start_if.${ifn} to play games with other netstart variables though. -- Rod Grimes rgrimes@gndrsh.aac.dev.com Accurate Automation Company Reliable computers for FreeBSD