summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2009-12-19 08:03:35 +0000
committerRoy Marples <roy@marples.name>2009-12-19 08:03:35 +0000
commit2c0a71172d06a9d1e737c775fc40c3989e959902 (patch)
treec43168c15b7e1fe913cc6b972d558e20ba02f5ed
parentcbafcd078df7a9f48abba949f312625e0d68fb43 (diff)
downloadopenrc-2c0a71172d06a9d1e737c775fc40c3989e959902.tar.gz
openrc-2c0a71172d06a9d1e737c775fc40c3989e959902.tar.bz2
openrc-2c0a71172d06a9d1e737c775fc40c3989e959902.tar.xz
default route commands on Linux now require gw or via (iproute2).
-rw-r--r--conf.d/Makefile2
-rw-r--r--conf.d/Makefile.FreeBSD2
-rw-r--r--conf.d/Makefile.NetBSD2
-rw-r--r--conf.d/network.BSD4
-rw-r--r--conf.d/network.Linux9
-rw-r--r--conf.d/network.in4
-rw-r--r--init.d/network.in14
7 files changed, 15 insertions, 22 deletions
diff --git a/conf.d/Makefile b/conf.d/Makefile
index 5f9cf45..b985271 100644
--- a/conf.d/Makefile
+++ b/conf.d/Makefile
@@ -13,7 +13,7 @@ SOS?= BSD
network: network.in network.${OS}
cp $@.in $@
- [ -e $@.${OS} ] && cat $@.${OS} >> $@ || true
+ [ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true
staticroute: staticroute.${SOS}
cp $@.${SOS} $@
diff --git a/conf.d/Makefile.FreeBSD b/conf.d/Makefile.FreeBSD
index 94a6e7b..c43a1d4 100644
--- a/conf.d/Makefile.FreeBSD
+++ b/conf.d/Makefile.FreeBSD
@@ -1,3 +1 @@
CONF+= ipfw moused powerd rarpd savecore syscons
-
-network.${OS}:
diff --git a/conf.d/Makefile.NetBSD b/conf.d/Makefile.NetBSD
index b069424..18a52cc 100644
--- a/conf.d/Makefile.NetBSD
+++ b/conf.d/Makefile.NetBSD
@@ -1,3 +1 @@
CONF+= moused rarpd savecore
-
-network.${OS}:
diff --git a/conf.d/network.BSD b/conf.d/network.BSD
new file mode 100644
index 0000000..9f49b81
--- /dev/null
+++ b/conf.d/network.BSD
@@ -0,0 +1,4 @@
+
+# You can assign a default route
+#defaultroute="192.168.0.1"
+#defaultroute6="2001:a:b:c"
diff --git a/conf.d/network.Linux b/conf.d/network.Linux
index bda4ac0..f57ec91 100644
--- a/conf.d/network.Linux
+++ b/conf.d/network.Linux
@@ -1,11 +1,16 @@
+
+# You can assign a default route
+#defaultroute="gw 192.168.0.1"
+#defaultroute6="gw 2001:a:b:c"
+
# ifconfig under Linux is not that powerful and doesn't easily handle
# multiple addresses
# On the other hand, ip (iproute2) is quite powerful and is also supported
#ip_eth0="192.168.0.10/24; 192.168.10.10/24"
# You can also use ip to add the default route.
-#defaultiproute="192.168.0.1"
-#defaultiproute6="2001:a:b:c"
+#defaultiproute="via 192.168.0.1"
+#defaultiproute6="via 2001:a:b:c"
# ip doesn't handle MTU like ifconfig, but we can do it like so
#ifup_eth0="ip link set \$int mtu 1500"
diff --git a/conf.d/network.in b/conf.d/network.in
index 68141a7..c7f948c 100644
--- a/conf.d/network.in
+++ b/conf.d/network.in
@@ -9,10 +9,6 @@
# You should note that we don't stop the network at system shutdown by default.
# If you really need this, then set shutdown_network=YES
-# You can assign a default route
-#defaultroute="192.168.0.1"
-#defaultroute6="2001:a:b:c"
-
# Lastly, the interfaces variable pulls in virtual interfaces that cannot
# be automatically detected.
#interfaces="br0 bond0 vlan0"
diff --git a/init.d/network.in b/init.d/network.in
index 259fb31..655fc17 100644
--- a/init.d/network.in
+++ b/init.d/network.in
@@ -253,16 +253,11 @@ start()
if [ -n "$defaultroute" ]; then
ebegin "Setting default route $defaultroute"
- if [ "$RC_UNAME" = Linux -a \
- "${defaultroute#dev }" = "$defaultroute" ]; then
- route add default gw $defaultroute
- else
- route add default $defaultroute
- fi
+ route add default $defaultroute
eend $?
elif [ -n "$defaultiproute" ]; then
ebegin "Setting default route $defaultiproute"
- ip route add default via $defaultiproute
+ ip route add default $defaultiproute
eend $?
fi
@@ -270,9 +265,6 @@ start()
ebegin "Setting default route $defaultroute6"
if [ "$RC_UNAME" = Linux ]; then
routecmd="route -A inet6 add"
- if [ "${defaultroute6#dev }" = "$defaultroute6" ]; then
- routecmd="$routecmd gw"
- fi
else
routecmd="route -inet6 add"
fi
@@ -280,7 +272,7 @@ start()
eend $?
elif [ -n "$defaultiproute6" ]; then
ebegin "Setting default route $defaultiproute6"
- ip route add default via $defaultiproute6
+ ip -f inet6 route add default $defaultiproute6
eend $?
fi