Package: netbase
Version: 4.19
Severity: wishlist
Tags: patch
According to nameif manpage you should run it before bringing up the interfaces.
I found it most suitable to place nameif hooks in /etc/init.d/networking (right
before bringing up all interfaces).
I'll attach two patches. The first one (networking-nameif.patch) is what I've
been using for a long time now. The second patch
(networking-nameif-option.patch) is a suggestion of how to do it
"properly" and I've not tested it at all but it looks obvious enough.
The patch adds a check for /etc/mactab (the default "configuration file" for
nameif) and if it exists nameif is launched. The second patch should also
introduce an option in /etc/network/options where you can set "nameif={no,yes}"
(defaulting to no) to enable/disable renaming of network interfaces (thus the
file /etc/mactab can exist but nameif is still not run until you explicitly
enable it in /etc/network/options).
If you use the second patch please also add nameif=no to /etc/network/options as
a template.
If you prefer to change the default to nameif=yes (which would still not trigger
nameif since the admin would need to create /etc/mactab) I support that. :)
If so you might want to delete the warning (else statement in nameif()
function) that /etc/mactab is missing.
Regards,
Andreas Henriksson
PS. The second patch also touches the "doopt spoofprotect yes"-line but it only
changes a tab into spaces to make indentation consistent with the rest of the
file.
--- /etc/init.d/networking.org 2003-12-06 16:39:31.000000000 +0100
+++ /etc/init.d/networking 2003-12-06 17:01:32.000000000 +0100
@@ -66,6 +66,12 @@
doopt syncookies no
doopt ip_forward no
+ if [ -x /sbin/nameif -a -e /etc/mactab ]; then
+ echo -n "Naming network interfaces... "
+ /sbin/nameif
+ echo "done."
+ fi
+
echo -n "Configuring network interfaces... "
ifup -a
echo "done."
--- networking.org 2005-01-10 09:55:04.000000000 +0100
+++ networking 2005-01-10 10:07:03.000000000 +0100
@@ -47,6 +47,16 @@
fi
}
+nameif () {
+ if [ -e /etc/mactab ]; then
+ echo -n "Naming interfaces..."
+ nameif -c /etc/mactab
+ echo "done."
+ else
+ echo "Missing /etc/mactab, skipping nameif."
+ fi
+}
+
doopt () {
optname=$1
default=$2
@@ -62,9 +72,10 @@
case "$1" in
start)
- doopt spoofprotect yes
+ doopt spoofprotect yes
doopt syncookies no
doopt ip_forward no
+ doopt nameif no
echo -n "Configuring network interfaces..."
ifup -a