Subject: misc/12398: no 802.1Q vlan related code in /etc/rc.d
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hag@linnaean.org>
List: netbsd-bugs
Date: 03/12/2001 23:23:34
>Number: 12398
>Category: misc
>Synopsis: no 802.1Q vlan related code in /etc/rc.d
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: misc-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Mar 12 20:24:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Daniel Hagerty
>Release: 1.5.1_ALPHA January 15th
>Organization:
no
>Environment:
System:NetBSD perdition.linnaean.org 1.5.1_ALPHA NetBSD 1.5.1_ALPHA (NEURALGIA) #93: Fri Feb 16 17:24:13 EST 2001 root@perdition.linnaean.org:/usr/src/sys/arch/i386/compile/NEURALGIA i386 unknown
Architecture: i386
>Description:
NetBSD 1.5.1 has vlan support, but no code in /etc/rc.d to allow a
simple config file for it.
>How-To-Repeat:
Install NetBSD 1.5.1. Be a vlan junky.
>Fix:
rc.d file appended (as diff). Potentially rewrite rc.d/network
rather than using BEFORE.
An example /etc/vlan.conf would look like:
vlan0 fxp0 42
--- /dev/null Mon Mar 12 22:57:02 2001
+++ /etc/rc.d/vlan Mon Mar 12 23:10:22 2001
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# PROVIDE: vlan
+# REQUIRE: ipfilter ipsec sysctl
+# BEFORE: network
+
+. /etc/rc.subr
+
+name="vlan"
+rcvar=$name
+start_precmd=vlan_prestart
+start_cmd=vlan_start
+stop_precmd="test -f /etc/vlan.conf"
+stop_cmd=vlan_stop
+
+vlan_prestart()
+{
+ # Steal code from ipf startup; we'll assume that setting up an
+ # insane vlan config should be very fatal.
+ if [ ! -f /etc/vlan.conf ]; then
+ warn "/etc/vlan.conf not readable; vlan start aborted."
+ #
+ # If booting directly to multiuser, send SIGTERM to
+ # the parent (/etc/rc) to abort the boot
+ #
+ if [ "$autoboot" = yes ]; then
+ echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
+ kill -TERM $$
+ exit 1
+ fi
+ return 1
+ fi
+
+}
+
+vlan_start()
+{
+ sed -e '/^#/d' /etc/vlan.conf |
+ while read vlan parent tag
+ do
+ echo "Creating ${vlan} interface"
+ if ifconfig ${vlan} create ; then
+ ifconfig ${vlan} vlan ${tag} vlanif ${parent}
+ fi
+ done
+}
+
+vlan_stop()
+{
+ sed -e '/^#/d' /etc/vlan.conf |
+ while read vlan parent tag
+ do
+ echo "Destroying ${vlan} interface"
+ ifconfig ${vlan} destroy
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted: