From: Ian Campbell Date: Wed, 25 Jul 2012 16:39:16 +0000 (+0100) Subject: hotplug: network-bridge: fix for interfaces with no gateway X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8157 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f87945a8d104adc08216762c9ac57debf095707f;p=xen.git hotplug: network-bridge: fix for interfaces with no gateway This comes from an old Debian bug report http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588477 which refers to http://lists.xen.org/archives/html/xen-users/2010-06/msg00420.html. Although we no longer have a trap in _claim_lock as described (this was removed in 25590:bb250383a4f5 "hotplug/Linux: use flock based locking") and the use of network-* scripts is discouraged (in favour of using distro provided mechanisms) the general principal that relying on the semantics of /bin/sh's && is unwise seems sound. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Campbell --- diff --git a/tools/hotplug/Linux/network-bridge b/tools/hotplug/Linux/network-bridge index 6f8475acb7..9aa9dda484 100644 --- a/tools/hotplug/Linux/network-bridge +++ b/tools/hotplug/Linux/network-bridge @@ -115,7 +115,9 @@ do_ifup() { ip addr add ${addr_pfx} dev $1 fi ip link set dev $1 up - [ -n "$gateway" ] && ip route add default via ${gateway} + if [ -n "$gateway" ] ; then + ip route add default via ${gateway} + fi fi }