Branch: refs/heads/master Home: https://github.com/jpirko/libteam Commit: b30381795c691be9256c49616105d022a2884d1c https://github.com/jpirko/libteam/commit/b30381795c691be9256c49616105d022a28... Author: Xin Long lucien.xin@gmail.com Date: 2016-12-26 (Mon, 26 Dec 2016)
Changed paths: M man/teamdctl.8 M teamd/teamd_json.c M teamd/teamd_state.c
Log Message: ----------- 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: "ports": { "eth1": { "1": { "ifinfo": { ...
and teamdctl team0 state view even crashs as: ... ports: Failed to parse JSON port dump. command call failed (Invalid argument)
Actually it's common for users to use dot in ifname, especially for vlan device.
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@gmail.com Signed-off-by: Jiri Pirko jiri@mellanox.com
libteam@lists.fedorahosted.org