From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 9 03:18:02 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 922F516A401 for ; Sun, 9 Apr 2006 03:18:02 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers.102a7e@mired.org) Received: from mired.org (dsl092-153-074.wdc2.dsl.speakeasy.net [66.92.153.74]) by mx1.FreeBSD.org (Postfix) with SMTP id EFF6543D45 for ; Sun, 9 Apr 2006 03:18:01 +0000 (GMT) (envelope-from mwm-keyword-freebsdhackers.102a7e@mired.org) Received: (qmail 74545 invoked by uid 1001); 9 Apr 2006 03:18:01 -0000 Received: by localhost.mired.org (tmda-sendmail, from uid 1001); Sat, 08 Apr 2006 23:18:01 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17464.31976.938131.944829@bhuda.mired.org> Date: Sat, 8 Apr 2006 23:18:00 -0400 To: Darren Pilgrim In-Reply-To: <44385525.8000203@bitfreak.org> References: <20060407225742.GA21619@odin.ac.hmc.edu> <20060407230247.GH16344@submonkey.net> <4437C9F6.5000008@samsco.org> <17463.65076.117616.563302@bhuda.mired.org> <20060408224140.GA15366@outcold.yadt.co.uk> <17464.17494.251794.271711@bhuda.mired.org> <44385525.8000203@bitfreak.org> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) From: Mike Meyer Cc: hackers@freebsd.org Subject: Re: Using any network interface whatsoever (solution?) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Apr 2006 03:18:02 -0000 In <44385525.8000203@bitfreak.org>, Darren Pilgrim typed: > Mike Meyer wrote: > > In <20060408224140.GA15366@outcold.yadt.co.uk>, David Taylor typed: > >> That doesn't quite work, though. Unless you require everyone wanting > >> to distinguish between LAN and WAN interfaces uses different types > >> of hardware for each card, they'll still end up with xl0 and xl1 > >> (or whatever), which is in no way better than eth0 and eth1, > > > > You're right - but at least you have the option of using different > > types of cards to get different names. I agree that this sucks, but > > it's better than nothing. > > This is a script to rename interfaces based on the MAC address: Very nice. > If you add something to /etc/rc.d so that a sh-ified version of this script > runs after all interfaces have attached but before any numbering or cloning > takes place you can have lines like this in /etc/rc.conf: > > ifconfig_PublicLAN="inet a.b.c.d/24" > > That's far better than trying to remember what's on em0. That's certainly true. But is there an advantage to tieing the PublicLAN name to a MAC address as opposed to em0? > Comments please! This is certainly a move in the right direction. However, MAC addresses are of about the same order of obscurity as device probe order numbers. It might be more usefull to do something like: ifn_list=/etc/NETIF_list for ifn in $(ifconfig -l link) do ifn_addr=$(pciconf -l | grep "^$ifn" | sed -e 's/^[^@]*@//' -e 's/: .*//') ifn_name=$(grep $ifn_addr $ifn_list | cut -d ' ' -f 2$) ifconfig $ifn name $ifn_name done This way, the name would be tied to the slot on the backplane that the device is plugged into. If you changed the card in that slot, it'd still get the same name, even if it was a different card type. That seems like desirable behavior to me, but I can also see cases where the name should follow the card if it moves to a different slot, which is what your version does. The real problem with what I proposed is that you have to arrange to search config information for things that may not be tied to a pci bus. That could get real messy. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.