default route commands on Linux now require gw or via (iproute2).

This commit is contained in:
William Hubbs 2009-12-19 08:03:35 +00:00 committed by Roy Marples
parent cbafcd078d
commit 2c0a71172d
7 changed files with 15 additions and 22 deletions

View File

@ -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} $@

View File

@ -1,3 +1 @@
CONF+= ipfw moused powerd rarpd savecore syscons
network.${OS}:

View File

@ -1,3 +1 @@
CONF+= moused rarpd savecore
network.${OS}:

4
conf.d/network.BSD Normal file
View File

@ -0,0 +1,4 @@
# You can assign a default route
#defaultroute="192.168.0.1"
#defaultroute6="2001:a:b:c"

View File

@ -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"

View File

@ -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"

View File

@ -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