From: Michael Tremer Date: Fri, 4 Aug 2017 11:57:32 +0000 (+0000) Subject: ip-tunnel: Make local address optional X-Git-Tag: 009~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eec68f19891a72a948e5f879fd8d651ad2f0c83e;p=network.git ip-tunnel: Make local address optional Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.ip-tunnel b/src/functions/functions.ip-tunnel index 5e6bd8e6..195ee932 100644 --- a/src/functions/functions.ip-tunnel +++ b/src/functions/functions.ip-tunnel @@ -82,8 +82,6 @@ ip_tunnel_add() { return ${EXIT_ERROR} fi - assert isset local_address - local cmd_args # Apply TTL if a value has been set. @@ -91,6 +89,11 @@ ip_tunnel_add() { cmd_args="${cmd_args} ttl ${ttl}" fi + # Apply local address if a value has been set. + if isset local_address; then + cmd_args="${cmd_args} local ${local_address}" + fi + # Apply remote address if a value has been set. if isset remote_address; then cmd_args="${cmd_args} remote ${remote_address}" @@ -104,8 +107,7 @@ ip_tunnel_add() { log DEBUG "Creating tunnel device '${device}' (mode=${mode})..." # Create the device. - if ! cmd ip tunnel add ${device} mode ${mode} \ - local ${local_address} ${cmd_args}; then + if ! cmd ip tunnel add ${device} mode ${mode} ${cmd_args}; then error "Could not create tunnel device ${device}" return ${EXIT_ERROR} fi