openvswitch: bring up member ports
authorStijn Tintel <stijn@linux-ipv6.be>
Fri, 29 Oct 2021 18:27:56 +0000 (20:27 +0200)
committerYousong Zhou <yszhou4tech@gmail.com>
Fri, 19 Nov 2021 06:15:42 +0000 (14:15 +0800)
Open vSwitch does not bring up ports automatically. This is not a
problem for wireless ports, or for ports configured in
/etc/config/network, but other ports will be down, and require manual
interaction to be brought up. Configuring them with proto none will
cause netifd to do some actions on them, which might cause undefined
results, and will also bloat the UCI config file.

The cleanest solution is to bring all member ports up as part of the
init script.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
net/openvswitch/files/openvswitch.init

index f4a88edcfaf5a7cd22073e13cd9e09b2eb58895f..abbbbf792b68f494046381e9268774c3bfc971b8 100755 (executable)
@@ -121,6 +121,7 @@ ovs_bridge_port_add() {
        }
 
        ovs-vsctl --may-exist add-port "$name" "$port" ${type:+ -- set interface "$port" type="$type"}
+       ovs_bridge_port_up "$port"
        __port_list="$__port_list ${port} "
 }
 
@@ -162,6 +163,7 @@ ovs_bridge_port_add_complex() {
        ovs-vsctl --may-exist add-port "$bridge" "$port" ${tag:+tag="$tag"} \
                ${ofport:+ -- set interface "$port" ofport_request="$ofport"} \
                ${type:+ -- set interface "$port" type="$type"}
+       ovs_bridge_port_up "$port"
        __port_list="$__port_list ${port} "
 }
 
@@ -174,6 +176,12 @@ ovs_bridge_port_cleanup() {
        done
 }
 
+ovs_bridge_port_up() {
+       local port="$1"
+
+       ip link set dev "$port" up
+}
+
 ovs_bridge_validate_datapath_id() {
        local dpid="$1"