Author: Xin Long <lucien.xin(a)gmail.com>
Date: 2016-12-26 (Mon, 26 Dec 2016)
teamd: escape some sensitive characters in ifname with double quotation marks
Now teamd uses dot symbol to split path string into different nodes
in __teamd_json_path_lite_va() when dumping teamd state. But team
port ifname is a part of path string, if ifname has dot character
inside, it would be parsed as two nodes incorrectly.
Like, if users uses eth1.1 as a port ifname
teamdctl team0 state dump would be:
and teamdctl team0 state view even crashs as:
Failed to parse JSON port dump.
command call failed (Invalid argument)
Actually it's common for users to use dot in ifname, especially for
This patch is to escape dot inside ifname by quoting ifname with double
quotation marks, which can also escape any other characters, like '['
and '\"' in ifname.
Note that this patch can also fix the issue that users set/get state
like team0 has two ports eth1.1 and eth2\" :
teamdctl team0 state item get 'ports."eth1.1".link_watches.up'
teamdctl team0 state item get 'ports."eth2"".link_watches.up'
No matter what character is inside ifname, users just need to quoting
it with double quotation marks if necessary.
Signed-off-by: Xin Long <lucien.xin(a)gmail.com>
Signed-off-by: Jiri Pirko <jiri(a)mellanox.com>