From cf6e4606ba105215036c0f1140e09766d11cf96d Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 14 Sep 1981 02:13:37 +0000 Subject: [PATCH] bridge: Automatically enable promisc mode. There is (maybe) a bug in the linux kernel that we need to set every bridge into promisc mode to get traffic out through the bridges. --- functions.device | 11 +++++++++++ hooks/zones/bridge | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/functions.device b/functions.device index 3bf8df54..8dea6bd6 100644 --- a/functions.device +++ b/functions.device @@ -276,6 +276,17 @@ function device_is_promisc() { ip link show ${device} | grep -qE "<.*PROMISC.*>" } +function device_set_promisc() { + local device=${1} + local state=${2} + + assert device_exists ${device} + assert isset state + assert isoneof state on off + + ip link set ${device} promisc ${state} +} + # Check if the device is free function device_is_free() { ! device_is_used $@ diff --git a/hooks/zones/bridge b/hooks/zones/bridge index 022ca654..7fe89d63 100755 --- a/hooks/zones/bridge +++ b/hooks/zones/bridge @@ -114,6 +114,10 @@ function _up() { device_set_up ${zone} + # XXX Currently, there is a bug (in the linux kernel?) that we need to + # set our bridges to promisc mode. + device_set_promisc ${zone} on + # Bring all ports up zone_ports_up ${zone} zone_configs_up ${zone} @@ -137,6 +141,9 @@ function _down() { zone_configs_down ${zone} zone_ports_down ${zone} + # XXX See remark in _up(). + device_set_promisc ${zone} off + device_set_down ${zone} brctl delbr ${zone} -- 2.47.2