From a21f8d8fb83479e01326d50e685d5694da74ab32 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Tue, 16 Mar 2010 14:35:44 +1100 Subject: [PATCH 1/3] 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 --- src/connections/ethernet | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/connections/ethernet b/src/connections/ethernet index 36f6b93..bdc311d 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -95,6 +95,16 @@ ethernet_up() { ;; esac + # Add static routes + 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 "$IPCFG" ]]; then for line in "${IPCFG[@]}"; do -- 1.7.0.2