Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
teamd: escape some sensitive characters in ifname with double quotati…
…on 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>
- Loading branch information