Date: Fri, 5 Dec 2014 20:38:56 +0100 From: <knl@bitflop.com> To: freebsd-net@freebsd.org Subject: Re: NICs devices switches "pshycial" place on each boot (SOLVED - FOR REAL) Message-ID: <20141205203856.10384916@easynote>
next in thread | raw e-mail | index | archive | help
This is what I got working correctly via the solution provided by Warner Losh in Martins bug report about devd. I had some problems getting PF to read its rule set due to it not having all the cards ready before that. I solved that by simply having PF flush and reload its rule set on each device renaming. So.. # cat /usr/local/etc/mac-names-map.txt 00:24:9b:0d:e0:0c olan 192.168.1.1 00:24:9b:0e:23:8e clan 192.168.2.1 00:24:9b:0f:9d:3f plan 192.168.3.1 Remember to make fix-mac-name executable. # cat /usr/local/sbin/fix-mac-name #!/bin/sh # Script to fix a custom device name for the USB->NIC adapters. # This script is being invoked by devd using an attach event that # catches the device name (ueX). dev=$1 mac=$(ifconfig $dev | grep ether | awk '{print $2;}') name=$(grep ^$mac /usr/local/etc/mac-names-map.txt | awk '{print $2;}') IP=$(grep ^$mac /usr/local/etc/mac-names-map.txt | awk '{print $3;}') if [ -n $name ]; then ifconfig $dev name $name ifconfig $name inet $IP netmask 255.255.255.0 # Make sure PF is started correctly again. pfctl -F all -f /etc/pf.conf fi # cat /usr/local/etc/devd/devd.conf notify 100 { match "system" "IFNET"; match "type" "ATTACH"; action "/usr/local/sbin/fix-mac-name $subsystem"; }; That's it. Cheers, Kim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141205203856.10384916>