From 5040a95369844243d7a3f247f4c091941959d302 Mon Sep 17 00:00:00 2001 From: Phillip Smith Date: Mon, 16 Apr 2012 10:50:59 +1000 Subject: [PATCH] check for existing ipv6 route before adding gateway iproute2 does not allow multiple default gateways in ipv6. this patch checks for an existing default route before adding the gateway. if an existing gateway is found, we use the iproute2 command "route replace" instead of "route add" --- src/connections/ethernet | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/connections/ethernet b/src/connections/ethernet index 49dfa4c..eef9680 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -181,8 +181,12 @@ ethernet_up() { done fi if [[ -n "$GATEWAY6" ]]; then - report_debug ethernet_iproute_up ip -6 route add default via "$GATEWAY6" dev "$INTERFACE" - if ! ip -6 route add default via "$GATEWAY6" dev "$INTERFACE"; then + local iproute2_cmd='add' + if ip -6 route show default | grep '^default'; then + iproute2_cmd='replace' + fi + report_debug ethernet_iproute_up ip -6 route $iproute2_cmd default via "$GATEWAY6" dev "$INTERFACE" + if ! ip -6 route $iproute2_cmd default via "$GATEWAY6" dev "$INTERFACE"; then report_iproute "Adding gateway $GATEWAY6 failed" fi fi -- 1.7.10