openflow: sync changes from openwrt-packages

c05103da9 openvswitch: add option for OpenFlow datapath desc
 b2bfb572a openvswitch: fix build with libunbound
 9e45d4534 openvswitch: add option for failure mode

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
Stijn Tintel
2021-10-13 01:07:19 +03:00
committed by John Crispin
parent 330eead632
commit 2c37a6983f
4 changed files with 55 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ include ./openvswitch.mk
#
PKG_NAME:=openvswitch
PKG_VERSION:=$(ovs_version)
PKG_RELEASE:=6
PKG_RELEASE:=9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
PKG_HASH:=5c7baed537364d43af36c15dde298c95d35cb2cb3204b4d3fe9b0fc73c97f16d
@@ -155,7 +155,7 @@ ovs_libopenvswitch_title:=Open vSwitch (libopenvswitch.so)
ovs_libopenvswitch_hidden:=1
ovs_libopenvswitch_depends:=+libopenssl +!(arc||arceb):libunwind
ovs_libopenvswitch_depends+=+libatomic
ifeq ($(CONFIG_KEEPALIVED_ROUTES),y)
ifeq ($(CONFIG_OPENVSWITCH_WITH_LIBUNBOUND),y)
ovs_libopenvswitch_depends+=+libunbound
endif
ovs_libopenvswitch_files:=usr/lib/libopenvswitch*.so*

View File

@@ -85,12 +85,14 @@ after adding or changing these options.
The ovs_bridge section also supports the options below,
for initialising a virtual bridge with an OpenFlow controller.
| Name | Type | Required | Default | Description |
|-------------|---------|----------|--------------------------------|------------------------------------------------------------|
| disabled | boolean | no | 0 | If set to true, disable initialisation of the named bridge |
| name | string | no | Inherits UCI config block name | The name of the switch in the OVS daemon |
| controller | string | no | (none) | The endpoint of an OpenFlow controller for this bridge |
| datapath_id | string | no | (none) | The OpenFlow datapath ID for this bridge |
| Name | Type | Required | Default | Description |
|---------------|---------|----------|--------------------------------|------------------------------------------------------------|
| disabled | boolean | no | 0 | If set to true, disable initialisation of the named bridge |
| name | string | no | Inherits UCI config block name | The name of the switch in the OVS daemon |
| controller | string | no | (none) | The endpoint of an OpenFlow controller for this bridge |
| datapath_id | string | no | (none) | The OpenFlow datapath ID for this bridge |
| datapath_desc | string | no | (none) | The OpenFlow datapath description for this bridge |
| fail_mode | string | no | standalone | The bridge failure mode |
The ovs_port section can be used to add ports to a bridge. It supports the options below.

View File

@@ -14,7 +14,9 @@ config ovs_bridge
option disabled 1
option name 'my-bridge'
option controller 'tcp:192.168.0.1'
option datapath_desc ''
option datapath_id ''
option fail_mode 'standalone'
config ovs_port
option disabled 1

View File

@@ -187,6 +187,31 @@ ovs_bridge_validate_datapath_id() {
fi
}
ovs_bridge_validate_datapath_desc() {
local dpdesc="$1"
if [ "$(echo $dpdesc | wc -c)" -le 255 ]; then
return 0
else
logger -t openvswitch "invalid datapath_desc: $dpdesc"
return 1
fi
}
ovs_bridge_validate_fail_mode() {
local fail_mode="$1"
case "$fail_mode" in
secure|standalone)
return 0
;;
*)
logger -t openvswitch "invalid fail_mode: $fail_mode"
return 1
;;
esac
}
ovs_bridge_init() {
local cfg="$1"
@@ -208,6 +233,24 @@ ovs_bridge_init() {
}
}
config_get datapath_desc "$cfg" datapath_desc
[ -n "$datapath_desc" ] && {
ovs_bridge_validate_datapath_desc "$datapath_desc" && {
ovs-vsctl --if-exists set bridge "$name" other-config:dp-desc="$datapath_desc"
}
}
config_get fail_mode "$cfg" fail_mode
[ -n "$fail_mode" ] && {
ovs_bridge_validate_fail_mode "$fail_mode" && {
ovs-vsctl set-fail-mode "$name" "$fail_mode" 2> /dev/null
} || {
ovs-vsctl del-fail-mode "$name" 2> /dev/null
}
} || {
ovs-vsctl del-fail-mode "$name" 2> /dev/null
}
config_list_foreach "$cfg" "ports" ovs_bridge_port_add
config_foreach ovs_bridge_port_add_complex ovs_port "$name"
config_get_bool drop "$cfg" "drop_unknown_ports" 0