ip: link_gre.c: add json output support
Schema
{
"external": {
"type": "bool",
"comment": "!tb[IFLA_GRE_COLLECT_METADATA]"
},
"remote": {
"type": "string",
"attr": "IFLA_GRE_REMOTE"
},
"local": {
"type": "string",
"attr": "IFLA_GRE_LOCAL"
},
"link": {
"type": "string",
"attr": "IFLA_GRE_LINK",
"mutually_exclusive": {
"link_index": {
"type": "uint",
}
}
},
"ttl": {
"type": "int",
"attr": "IFLA_GRE_TTL"
},
"tos": {
"type": "string",
"attr": "IFLA_GRE_TOS"
},
"pmtudisc": {
"type": "bool",
"attr": "IFLA_GRE_PMTUDISC"
},
"ikey": {
"type": "string",
"attr": "IFLA_GRE_IKEY"
},
"okey": {
"type": "string",
"attr": "IFLA_GRE_OKEY"
},
"iseq": {
"type": "bool",
"attr": "IFLA_GRE_IFLAGS & GRE_SEQ"
},
"oseq": {
"type": "bool",
"attr": "IFLA_GRE_OFLAGS & GRE_SEQ"
},
"icsum": {
"type": "bool",
"attr": "IFLA_GRE_IFLAGS & GRE_CSUM"
},
"ocsum": {
"type": "bool",
"attr": "IFLA_GRE_OFLAGS & GRE_CSUM"
},
"ignore_df": {
"type": "bool",
"attr": "IFLA_GRE_IGNORE_DF"
},
"encap": {
"type": "dict",
"attr": "IFLA_GRE_ENCAP_TYPE != TUNNEL_ENCAP_NONE",
"dict": {
"type": {
"type": "string",
"attr": "IFLA_GRE_ENCAP_TYPE"
},
"sport": {
"type": "uint",
"attr": "IFLA_GRE_ENCAP_SPORT"
},
"dport": {
"type": "uint",
"attr": "IFLA_GRE_ENCAP_DPORT"
},
"csum": {
"type": "bool",
"attr": "TUNNEL_ENCAP_FLAG_CSUM"
},
"csum6": {
"type": "bool",
"attr": "TUNNEL_ENCAP_FLAG_CSUM6"
},
"remcsum": {
"type": "bool",
"attr": "TUNNEL_ENCAP_FLAG_REMCSUM"
}
}
}
}
$ ip link show
$ ip tunnel add tun42 mode gre local 192.0.2.42 remote 203.0.113.42 key 42
$ ip link show
10: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group
default
link/gre 0.0.0.0 brd 0.0.0.0
11: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
12: tun42@NONE: <POINTOPOINT,NOARP> mtu 1472 qdisc noop state DOWN mode
DEFAULT group default
link/gre 192.0.2.42 peer 203.0.113.42
$ ip -details -json link show
[{
"ifindex": 10,
"ifname": "gre0",
"link": null,
"flags": ["NOARP"],
"mtu": 1476,
"qdisc": "noop",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"link_type": "gre",
"address": "0.0.0.0",
"broadcast": "0.0.0.0",
"promiscuity": 0,
"linkinfo": {
"info_kind": "gre",
"info_data": {
"remote": "any",
"local": "any",
"ttl": 0,
"pmtudisc": false
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535
},{
"ifindex": 11,
"ifname": "gretap0",
"link": null,
"flags": ["BROADCAST","MULTICAST"],
"mtu": 1462,
"qdisc": "noop",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "00:00:00:00:00:00",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"linkinfo": {
"info_kind": "gretap",
"info_data": {
"remote": "any",
"local": "any",
"ttl": 0,
"pmtudisc": false
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535
},{
"ifindex": 12,
"ifname": "tun42",
"link": null,
"flags": ["POINTOPOINT","NOARP"],
"mtu": 1472,
"qdisc": "noop",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"link_type": "gre",
"address": "192.0.2.42",
"link_pointtopoint": true,
"broadcast": "203.0.113.42",
"promiscuity": 0,
"linkinfo": {
"info_kind": "gre",
"info_data": {
"remote": "203.0.113.42",
"local": "192.0.2.42",
"ttl": 0,
"pmtudisc": true,
"ikey": "0.0.0.42",
"okey": "0.0.0.42"
}
},
"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>
1 file changed