ip: link_vti.c: add json output support
Schema:
{
"remote": {
"type": "string",
"attr": "IFLA_VTI_REMOTE"
},
"local": {
"type": "string",
"attr": "IFLA_VTI_LOCAL"
},
"link": {
"type": "string",
"attr": "IFLA_VTI_LINK",
"mutually_exclusive": {
"link_index": {
"type": "uint",
}
}
},
"ikey": {
"type": "string",
"attr": "IFLA_VTI_IKEY"
},
"okey": {
"type": "string",
"attr": "IFLA_VTI_OKEY"
}
}
$ ip tunnel add vti0 mode vti local 192.0.2.1 remote 198.51.100.3
$ ip link show
10: ip_vti0@NONE: <NOARP> mtu 1428 qdisc noop state DOWN mode DEFAULT group
default
link/ipip 0.0.0.0 brd 0.0.0.0
11: vti0@NONE: <POINTOPOINT,NOARP> mtu 1428 qdisc noop state DOWN mode
DEFAULT group default
link/ipip 192.0.2.1 peer 198.51.100.3
$ ./ip -details -json link show
[{
"ifindex": 10,
"ifname": "ip_vti0",
"link": null,
"flags": ["NOARP"],
"mtu": 1428,
"qdisc": "noop",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"link_type": "ipip",
"address": "0.0.0.0",
"broadcast": "0.0.0.0",
"promiscuity": 0,
"linkinfo": {
"info_kind": "vti",
"info_data": {
"remote": "any",
"local": "any",
"ikey": "0.0.0.0",
"okey": "0.0.0.0"
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535
},{
"ifindex": 11,
"ifname": "vti0",
"link": null,
"flags": ["POINTOPOINT","NOARP"],
"mtu": 1428,
"qdisc": "noop",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"link_type": "ipip",
"address": "192.0.2.1",
"link_pointtopoint": true,
"broadcast": "198.51.100.3",
"promiscuity": 0,
"linkinfo": {
"info_kind": "vti",
"info_data": {
"remote": "198.51.100.3",
"local": "192.0.2.1",
"ikey": "0.0.0.0",
"okey": "0.0.0.0"
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535
}
]
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>