From c8be1846de2665cd234ec5439f4cd24327fe5686 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Tue, 16 Mar 2010 14:35:44 +1100 Subject: Add support for static routes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Rémy Oudompheng --- src/connections/ethernet | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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 -- cgit v1.2.3-24-g4f1b