diff options
| author | Stijn Tintel <stijn@linux-ipv6.be> | 2021-08-23 16:33:19 +0300 |
|---|---|---|
| committer | Yousong Zhou <yszhou4tech@gmail.com> | 2021-09-22 20:40:45 +0800 |
| commit | c05103da92ecb00545d591840eae688452f350c2 (patch) | |
| tree | a0860c66eadda04b0faeecb91da308f080aef707 /net/openvswitch/files/openvswitch.init | |
| parent | 1a400370c04c5d8f8a15dda492d6915764da5b92 (diff) | |
openvswitch: add option for OpenFlow datapath desc
Add a UCI config option to set the OpenFlow datapath description. This
allows setting a human readable description of the bridge, e.g.
"Building x, Floor y, AP z", which makes it easier to recognize the AP.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'net/openvswitch/files/openvswitch.init')
| -rwxr-xr-x | net/openvswitch/files/openvswitch.init | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/openvswitch/files/openvswitch.init b/net/openvswitch/files/openvswitch.init index 229e6869b..53259d513 100755 --- a/net/openvswitch/files/openvswitch.init +++ b/net/openvswitch/files/openvswitch.init @@ -187,6 +187,17 @@ 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_init() { local cfg="$1" @@ -208,6 +219,13 @@ 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_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 |
