Re: [RFC] ifconfig: match by link-level address

From: Peter Pentchev (roam_at_ringlet.net)
Date: 05/21/04

  • Next message: Matthew Seaman: "Re: named in sandbox"
    Date: Fri, 21 May 2004 10:04:23 +0300
    To: Brooks Davis <brooks@one-eyed-alien.net>
    
    
    
    

    On Thu, May 20, 2004 at 10:18:38AM -0700, Brooks Davis wrote:
    > On Thu, May 20, 2004 at 07:29:19PM +0300, Peter Pentchev wrote:
    > > Hi,
    > >
    > > I found out recently that the Linux (or at least recent RedHat) startup
    > > scripts could be configured to not bring up an Ethernet interface unless
    > > it has a specified MAC address. This, combined with the wonderful
    > > interface renaming functionality recently committed to -CURRENT, led me
    > > to the idea of interface renaming on boot-up, by hardware addresses -
    > > something like 'I don't care how you detected this network card, or how
    > > many others like it are there, but the card with MAC address
    > > 00:03:0d:08:dc:a7 will be known as sis0int from now on'.
    > >
    > > The main missing piece was the ability to find an interface by MAC
    > > address; hence the attached patch, also available at
    > > http://www.ringlet.net/~roam/bsd-patches/src5/sbin-ifconfig-hwmatch.patch
    > > http://people.FreeBSD.org/~roam/bsd-patches/src5/sbin-ifconfig-hwmatch.patch
    > >
    > > It teaches ifconfig(8) to treat interface "names" beginning with 'hw-'
    > > as link-level addresses; ifconfig tries to find an interface with this
    > > address and behaves as if its name was specified on the command line:
    > >
    > > [roam@straylight ~/fbsd/r/src/sbin/ifconfig]> ./ifconfig hw-00:03:0d:08:dc:a7
    > > sis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    > > options=8<VLAN_MTU>
    > > inet 10.0.8.129 netmask 0xffff0000 broadcast 10.0.255.255
    > > inet 192.168.1.13 netmask 0xffffff00 broadcast 192.168.1.255
    > > ether 00:03:0d:08:dc:a7
    > > media: Ethernet autoselect (100baseTX <full-duplex>)
    > > status: active
    > > [roam@straylight ~/fbsd/r/src/sbin/ifconfig]>
    > >
    > > This could be the first step towards teaching rc.conf about something like
    > > network_interfaces_rename="hw-00:03:0d:08:dc:a7 sis0int"
    > >
    > > I had initially written my own function for parsing the user-supplied
    > > address into a sequence of bytes instead of using ether_aton(); it would
    > > have the advantage of being able to specify 'hw-' to match lo0's empty
    > > link-level "address". However, the odds of somebody actually wishing to
    > > rename lo0 don't seem to be so high :)
    >
    > I don't really like the idea of adding magic values to the interface
    > namespace that only work with ifconfig. If you want ifconfig to match
    > the lladdr, I'd suggest adding a flag that means match interface by
    > address instead of by name. That would be a fairly simple change to
    > your patch and seems like a potentialy useful feature.

    Agreed, I don't like the magic hw- too much either, but.. see below for
    more comments on this and interface renaming on startup.

    > FWIW, I've talked to Warner about automaticly renaming interfaces based
    > on things like their MAC address or their PCI slot and we think devd
    > will eventually be the place to do this. We're probably going to have
    > to rethink interface configuration for this to work though.

    Well, it turned out that adding basic interface renaming support to our
    startup scripts wasn't all that hard - the attached patch, also at
    http://www.ringlet.net/~roam/bsd-patches/src5/etc-iface-rename.patch
    http://people.FreeBSD.org/~roam/bsd-patches/src5/etc-iface-rename.patch
    seems to work for both 'sis0 ethlocal xl0 ethext' and
    'hw-00:03:0d:08:dc:a7 ethlocal', since it just passes the interface name
    to ifconfig(8).

    If the link-level address matching should be done with a separate
    ifconfig(8) option, the interface renaming may need to be split into two
    stages controlled by two configuration variables - one specifying the
    'source' interface by name, the other one by address, with the latter
    code using the new ifconfig option.

    Of course, this still leaves a problem with specifying the address for
    an interface that has not yet been 'found' - after all, we can't
    ifmaybeload() a driver on just the link-level address of the card. This
    is a case when devd might be a better solution indeed. However, I don't
    think that people who use interface renaming will depend on the system
    automatically discovering the *types* of network cards: if you know the
    MAC address of the card, you'll probably know just what brand and model
    it is, too :)

    G'luck,
    Peter

    -- 
    Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
    PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
    Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
    This sentence contradicts itself - or rather - well, no, actually it doesn't!
    
    

    
    




  • Next message: Matthew Seaman: "Re: named in sandbox"

    Relevant Pages

    • Re: Anybody has some experience with bonding driver?
      ... >> the second machine the bonding starts going crazy. ... >> have the same configuration in both and it doesn't ... > o Failure is exhibited by the interface connected to ... > have the same MAC address, ...
      (Fedora)
    • Re: Logic Fachsimpeleien
      ... VST vermeide ich am Mac, ... Die nehme ich dann mit dem iBook ... Heisst ja nicht, dass ein Rechner innerhalb von 3a sofort kaputt gehen ... Zugangsberechtigungen und simplem POST Interface auf einem Server ...
      (de.comp.sys.mac.misc)
    • Re: the new interface
      ... If you are going to use the Mac version of RB ... If you used a Mac for years then you'd know the new interface does not ... one window interfaces are WHY I don't use Windows products (lets see here, ... actually a Mac user as he/she claims. ...
      (comp.lang.basic.realbasic)
    • Re: ng_one2many v.s. AFT (NIC Fault Tolerance/Fail Over/Redundancy Revisited)
      ... > hosts weren't seeing the usual warnings about MAC address changes. ... regardless of what network segment/port a host ... > physical interface ifconfig'd with the IP. ... > tree root and switch 1 is the backup spanning tree root. ...
      (freebsd-questions)
    • Re: kern/109815: wrong interface identifier at pfil_hooks for vlans + if_bridge
      ... +on the interface with the MAC address equal to the packet's destination ... the filter for processing. ... +table according to the packet destination address (not the MAC ...
      (freebsd-net)