summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Mehani <olivier.mehani@nicta.com.au>2010-03-16 04:35:44 +0100
committerRémy Oudompheng <remy@archlinux.org>2011-05-29 08:50:39 +0200
commitc8be1846de2665cd234ec5439f4cd24327fe5686 (patch)
tree6d87ea908ea291ccc2a2b4f9b685c85cf42906cf
parent267d988ef6b6c839ecb837e350ce2861fc454dfd (diff)
downloadnetctl-c8be1846de2665cd234ec5439f4cd24327fe5686.tar.gz
netctl-c8be1846de2665cd234ec5439f4cd24327fe5686.tar.xz
Add support for static routes
Add netcfg configuration option "ROUTES" to setup static routes. This is done regardless of whether the IP address is configured using a DHCP or statically. ROUTES is an array cantaining entries of the form "DESTINATION[/NETMASK] [via ROUTER]" which are directly used in an “ip route add” command. Signed-off-by: Olivier Mehani <shtrom-arch@ssji.net> Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
-rw-r--r--src/connections/ethernet8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index a268698..45f46ac 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -85,6 +85,14 @@ ethernet_up() {
return 1
fi
fi
+ if [[ -n "$ROUTES" ]]; then
+ for route in "${ROUTES[@]}"; do
+ report_debug ethernet_iproute_up ip route add $route dev "$INTERFACE"
+ if ! ip route add $route dev "$INTERFACE" ; then
+ report_iproute "Adding route '$route' failed"
+ fi
+ done
+ fi
if [[ -n "$GATEWAY" ]]; then
report_debug ethernet_iproute_up ip route add default via "$GATEWAY"
if ! ip route add default via "$GATEWAY"; then