mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 18:50:18 +01:00
ovs: don't replace all "other_config" in _set_bridge_mac()
Doing an "update" is wrong, because that will replace all "other_config"
entries. We only want to reset the "hwaddr".
Note that https://www.rfc-editor.org/rfc/rfc7047 says about
"<mutations>":
If <mutator> is "insert", then each of the key-value pairs in
the map in <value> is added to <column> only if its key is not
already present. The required type of <value> is slightly
relaxed, in that it may have fewer than the minimum number of
elements specified by the column's type.
That means, we need to first delete, and then insert the key.
Fixes: 5d4c8521a3 ('ovs: set MAC address on the bridge for local interfaces')
This commit is contained in:
parent
17e16c8fa6
commit
2641af2cc9
1 changed files with 24 additions and 15 deletions
|
|
@ -592,21 +592,30 @@ _set_bridge_ports(json_t *params, const char *ifname, json_t *new_ports)
|
|||
static void
|
||||
_set_bridge_mac(json_t *params, const char *ifname, const char *mac)
|
||||
{
|
||||
json_array_append_new(params,
|
||||
json_pack("{s:s, s:s, s:{s:[s, [[s, s]]]}, s:[[s, s, s]]}",
|
||||
"op",
|
||||
"update",
|
||||
"table",
|
||||
"Bridge",
|
||||
"row",
|
||||
"other_config",
|
||||
"map",
|
||||
"hwaddr",
|
||||
mac,
|
||||
"where",
|
||||
"name",
|
||||
"==",
|
||||
ifname));
|
||||
json_array_append_new(
|
||||
params,
|
||||
json_pack("{s:s, s:s, s:[[s, s, [s, [s]]], [s, s, [s, [[s, s]]]]], s:[[s, s, s]]}",
|
||||
"op",
|
||||
"mutate",
|
||||
"table",
|
||||
"Bridge",
|
||||
"mutations",
|
||||
|
||||
"other_config",
|
||||
"delete",
|
||||
"set",
|
||||
"hwaddr",
|
||||
|
||||
"other_config",
|
||||
"insert",
|
||||
"map",
|
||||
"hwaddr",
|
||||
mac,
|
||||
|
||||
"where",
|
||||
"name",
|
||||
"==",
|
||||
ifname));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue