Author: alexander
Date: 2006-05-25 04:35:21 -0600 (Thu, 25 May 2006)
New Revision: 1559

Added:
   trunk/packages/oui-data/
   trunk/packages/oui-data/Makefile
Modified:
   trunk/Makefile
   trunk/scripts/net-setup
Log:
Fixes to net-setup:

 * Accept arbitrary named Ethernet-like interfaces
 * Print manufacturer name of each network card.

This is supposed to fix Ticket 1648. I won't close it until someone else tests
the new functionality.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile      2006-05-22 15:38:48 UTC (rev 1558)
+++ trunk/Makefile      2006-05-25 10:35:21 UTC (rev 1559)
@@ -260,7 +260,7 @@
        ch-cpio ch-mutt ch-msmtp ch-tin ch-mdadm ch-which ch-BRLTTY \
        ch-strace ch-iptables ch-eject ch-xlockmore ch-hdparm ch-linux \
        ch-sysfsutils ch-pcmcia-cs ch-pcmciautils ch-ddccontrol 
ch-ddccontrol-db \
-       ch-initramfs ch-zisofs-tools ch-cdrtools ch-blfs-bootscripts \
+       ch-initramfs ch-zisofs-tools ch-cdrtools ch-blfs-bootscripts 
ch-oui-data \
        ch-man-fr ch-man-pages-es ch-man-pages-it ch-manpages-de ch-manpages-ru 
\
        ch-anthy ch-scim ch-scim-tables ch-scim-anthy ch-scim-hangul \
        ch-libchewing ch-scim-chewing ch-scim-pinyin ch-scim-input-pad \

Added: trunk/packages/oui-data/Makefile
===================================================================
--- trunk/packages/oui-data/Makefile                            (rev 0)
+++ trunk/packages/oui-data/Makefile    2006-05-25 10:35:21 UTC (rev 1559)
@@ -0,0 +1,30 @@
+# oui-data Makefile
+
+NM= oui-data
+VRS= 20060525
+DIR= $(NM)-$(VRS)
+
+# The files are tarballed only for the purpose of checking SHA1 sum
+FILE= $(DIR).tar.bz2
+URL-$(FILE)= http://www.linuxfromscratch.org/~alexander/$(FILE)
+SHA-$(FILE)= a2fa7b331262781afca3589d81ac94665ce7c399
+
+# Targets
+
+include $(ROOT)/scripts/functions
+
+chroot:
+       chroot "$(MP)" $(chenv-blfs) \
+       'cd $(ROOT) && make ch-$(NM) $(chbash-post-bash)'
+
+stage2: Makefile $(FILE)
+       $(std_build)
+
+compile-stage2:
+       install -d /usr/share/oui-data
+       install -m644 *.txt /usr/share/oui-data
+
+clean:
+       -rm -rf $(DIR)
+
+.PHONY: clean chroot compile-stage2

Modified: trunk/scripts/net-setup
===================================================================
--- trunk/scripts/net-setup     2006-05-22 15:38:48 UTC (rev 1558)
+++ trunk/scripts/net-setup     2006-05-25 10:35:21 UTC (rev 1559)
@@ -13,7 +13,26 @@
 DIR=/etc/sysconfig/network-devices
 IFUP=$DIR/ifup
 IFDOWN=$DIR/ifdown
+OUI_DIR=/usr/share/oui-data
 
+# Find manufacturer by MAC address
+find_oui() {
+       MACADDR=`echo $1 | LC_ALL=C tr a-f A-F`
+       IFS=":"
+       set $MACADDR
+       if [ "$1-$2-$3" = "00-50-C2" ] ; then
+               # Search IAB
+               TAIL=$4$5$6
+               TAIL=${TAIL%???}000
+               LINE=`LC_ALL=C grep ^$TAIL- $OUI_DIR/iab.txt || echo "DUMMY     
DUMMY   UNKNOWN MANUFACTURER"`
+               echo "$LINE" | cut -f 3-
+       else
+               # Search OUI
+               LINE=`LC_ALL=C grep ^$1-$2-$3 $OUI_DIR/oui.txt || echo "DUMMY   
DUMMY   UNKNOWN MANUFACTURER"`
+               echo "$LINE" | cut -f 3-
+       fi
+}
+
 # Form to enter nameservers for /etc/resolv.conf
 set_dns(){
        DLG_COMMAND="dialog --title \"DNS Servers - /etc/resolv.conf\" 
--no-cancel \
@@ -332,7 +351,16 @@
        exit 1;
 fi
 
-for EDEV in /sys/class/net/eth* /sys/class/net/wlan* ; do
+for EDEV in /sys/class/net/* ; do
+       if [ ! -f $EDEV/addr_len ] || [ ! -f $EDEV/address ] ; then
+               continue
+       fi
+       read ADDRLEN <$EDEV/addr_len
+       read MACADDR <$EDEV/address
+       if [ "$ADDRLEN" != "6" ] || [ "$MACADDR" = "00:00:00:00:00:00" ] ; then
+               continue
+       fi
+       
        EDEV=`basename $EDEV`
        if echo $EDEV | grep -q "*" ; then continue ; fi
        if echo `/sbin/ip link show $EDEV 2> /dev/null` | grep -q UP ; then
@@ -340,6 +368,7 @@
        else
                EDEVSTATUS="DOWN"
        fi
+       EDEVSTATUS="$EDEVSTATUS (`find_oui $MACADDR` $MACADDR)"
        DEVLIST="$DEVLIST `basename $EDEV` \"$EDEVSTATUS\""
 done
 DEVLIST="$DEVLIST dialup \"Configure a dial-up modem.\" gprs \"Configure a 
GPRS modem.\""

-- 
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to