teamd config interprets period (".") in interface name as json object attribute token
when one adds an interface with a period in its name to a team device (e.g. a vlan interface). "teamdctl state dump" adds an extra level of json objects under the list of ports.
Environment:
- libteam 1.17 compiled from source.
- Linux foo 3.19.0-21-generic #21~14.04.1-Ubuntu SMP Sun Jun 14 18:45:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Example:
root@foo:~# ip link add link eth2 name eth2.255 type vlan id 255
root@foo:~# ip link add link eth2 name eth2v256 type vlan id 256
root@foo:~# teamdctl team0 port add eth2.255
root@foo:~# teamdctl team0 port add eth2v256
The resulting port configuration (as per output of teamd -g) appears correct:
<port_list>
*19: eth2v256: down 0Mbit HD
18: eth2.255: down 0Mbit HD
</port_list>
But the state dump is incorrect (key "255" is nested under "eth2"):
{
"ports": {
"eth2": {
"255": {
"ifinfo": {
...
"ifname": "eth2.255"
},
...
},
"eth2v256": {
"ifinfo": {
...
"ifname": "eth2v256"
}
...
}
},
"runner": {
"active_port": ""
},
"setup": {
"daemonized": false,
"dbus_enabled": false,
"debug_level": 1,
"kernel_team_mode_name": "activebackup",
"pid": 13730,
"pid_file": "/var/run/teamd/team0.pid",
"runner_name": "activebackup",
"zmq_enabled": false
},
"team_device": {
"ifinfo": {
"dev_addr": "00:50:56:90:78:78",
"dev_addr_len": 6,
"ifindex": 17,
"ifname": "team0"
}
}
}
I'm not sure if this affects anything the json dump, and item get/set. things appear to work fine with the actual teaming of traffic regardless -- probably because ids are used instead of names -- but port configuration is affected (see following comment).
Getting items:
root@foo:~# teamdctl team0 state item get setup.dbus_enabled
false
root@foo:~# teamdctl team0 state item get ports.eth2v256.link.duplex
half
root@foo:~# teamdctl team0 state item get ports.eth2.255.link.duplex
Failed to get state item "ports.eth2.255.link.duplex".
libteamdctl: cli_usock_process_msg: usock: Error message received: "PathDoesNotExist"
libteamdctl: cli_usock_process_msg: usock: Error message content: "Item path does not exist."
In fact, it also looks like it is not picking up the proper priority from the json config files when periods are involved:
teamd.conf:
{
"device": "team255",
"runner": {
"name": "activebackup"
},
"link_watch": {
"name": "ethtool"
},
"ports": {
"eth3.255": {
"prio": -10,
"sticky": true
},
"eth2.255": {
"prio": 100
}
}
}
Priorities are not picked up:
root@foo:~# teamd -o -t team255 -g -f /etc/teamd.conf
...
<port_list>
</port_list>
eth3.255: Adding port (found ifindex "22").
eth2.255: Adding port (found ifindex "21").
1.17 successfully started.
<ifinfo_list>
24: team255: aa:26:89:68:23:55: 0
</ifinfo_list>
<port_list>
*22: eth3.255: up 1000Mbit FD
</port_list>
eth3.255: Got link watch from global config.
eth3.255: Using sticky "0".
Added loop callback: lw_ethtool_delay, 0x688ff0
eth3.255: ethtool-link went up.
eth3.255: Can't get port priority. Using default.
Found best port: "eth3.255" (ifindex "22", prio "0").
Changed active port to "eth3.255".
<ifinfo_list>
24: team255: aa:26:89:68:23:55: 0
22: eth3.255: 00:50:56:90:78:79: 24
</ifinfo_list>
Current active port: "eth3.255" (ifindex "22", prio "0").
<port_list>
*21: eth2.255: up 1000Mbit FD
22: eth3.255: up 1000Mbit FD
</port_list>
eth2.255: Got link watch from global config.
eth2.255: Using sticky "0".
Added loop callback: lw_ethtool_delay, 0x689450
eth2.255: ethtool-link went up.
Current active port: "eth3.255" (ifindex "22", prio "0").
eth2.255: Can't get port priority. Using default.
<ifinfo_list>
*24: team255: *00:50:56:90:78:79: 0
22: eth3.255: 00:50:56:90:78:79: 24
21: eth2.255: 00:50:56:90:78:78: 24
</ifinfo_list>
Current active port: "eth3.255" (ifindex "22", prio "0").
<ifinfo_list>
24: team255: 00:50:56:90:78:79: 0
22: eth3.255: 00:50:56:90:78:79: 24
*21: eth2.255: *00:50:56:90:78:79: 24
</ifinfo_list>
Current active port: "eth3.255" (ifindex "22", prio "0").
Current active port: "eth3.255" (ifindex "22", prio "0").
Port settings are picked up when I remove the period characters from the names.