void-packages/srcpkgs/OpenRC/patches/xbps_use_iproute2.patch

84 lines
2.7 KiB
Diff

Replace 'ifconfig' uses to use 'ip' command from iproute2.
--- conf.d/network.Linux.orig 2011-06-18 20:56:50.593211799 +0200
+++ conf.d/network.Linux 2011-06-18 20:57:50.352207353 +0200
@@ -3,14 +3,12 @@
#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 (iproute2) is quite powerful and is the default method.
#ip_eth0="192.168.0.10/24; 192.168.10.10/24"
# You can also use ip to add the default route.
-#defaultiproute="via 192.168.0.1"
-#defaultiproute6="via 2001:a:b:c"
+#defaultroute="via 192.168.0.1"
+#defaultroute6="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"
--- init.d/network.in.orig 2011-06-18 20:42:08.035277498 +0200
+++ init.d/network.in 2011-06-18 20:55:54.240215997 +0200
@@ -46,7 +46,7 @@ sys_interfaces()
i=${w%%:*}
[ "$i" != "$w" ] || continue
if [ "$cmd" = u ]; then
- ifconfig "$i" | grep -q "[ ]*UP" || continue
+ ip link show "$i" | grep -q "[ ]*UP" || continue
fi
printf "%s " "$i"
done </proc/net/dev
@@ -222,9 +222,7 @@ start()
einfo "Starting network"
routeflush
if [ "$RC_UNAME" = "Linux" ]; then
- ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
- route add -net 127.0.0.0 netmask 255.0.0.0 \
- gw 127.0.0.1 reject 2>/dev/null
+ ip link set up dev lo
else
ifconfig lo0 127.0.0.1 netmask 255.0.0.0 || cr=1
route -q add -inet 127.0.0.0 -netmask 255.0.0.0 \
@@ -290,26 +288,13 @@ start()
if [ -n "$defaultroute" ]; then
ebegin "Setting default route $defaultroute"
- route add default $defaultroute
- eend $?
- elif [ -n "$defaultiproute" ]; then
- ebegin "Setting default route $defaultiproute"
- ip route add default $defaultiproute
+ ip route add default $defaultroute
eend $?
fi
if [ -n "$defaultroute6" ]; then
ebegin "Setting default route $defaultroute6"
- if [ "$RC_UNAME" = Linux ]; then
- routecmd="route -A inet6 add"
- else
- routecmd="route -inet6 add"
- fi
- $routecmd default $defaultroute6
- eend $?
- elif [ -n "$defaultiproute6" ]; then
- ebegin "Setting default route $defaultiproute6"
- ip -f inet6 route add default $defaultiproute6
+ ip -f inet6 route add default $defaultroute6
eend $?
fi
@@ -343,8 +328,8 @@ stop()
# fail to add things correctly on restart
ip address flush dev "$int" 2>/dev/null
fi
- ifconfig "$int" down 2>/dev/null
- ifconfig "$int" destroy 2>/dev/null
+ ip link set dev "$int" down 2>/dev/null
+ ip link delete "$int" 2>/dev/null
fi
done
eoutdent