Files
infix/test/case/cli/system-output/ip-link-show.json
T
Richard Alpe b9492c7bee cli: add container support to show interfaces
Make show interfaces container aware. This is done by looking though
all podman containers for interfaces and looking up there info from
network namespaces on the main system / hypervisor.

Interfaces controlled by containers are clearly marked in the "show
interfaces" output, with a single gray row. Telling the user that they
belong to one or more named containers. The user can then run "show
interface name NAME" on interfaces owned by containers, which provided
some additional info, such as mac address and stat counters.

The patch also add support for printing veth peers which are owned by
containers.

Lastly, the patch also adds test cases for this functionality.

Signed-off-by: Richard Alpe <richard@bit42.se>
2024-10-29 17:23:30 +01:00

679 lines
16 KiB
JSON

[
{
"ifindex": 2,
"ifname": "dsa0",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1504,
"qdisc": "mq",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "internal",
"txqlen": 2048,
"link_type": "ether",
"address": "02:00:de:ad:02:20",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 9888,
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 8,
"num_rx_queues": 4,
"gso_max_size": 65536,
"gso_max_segs": 300,
"tso_max_size": 65536,
"tso_max_segs": 300,
"gro_max_size": 65536,
"gso_ipv4_max_size": 65536,
"gro_ipv4_max_size": 65536,
"parentbus": "platform",
"parentdev": "f2000000.ethernet",
"stats64": {
"rx": {
"bytes": 1751876,
"packets": 6757,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 1843945,
"packets": 7136,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 7,
"ifname": "br0",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "noqueue",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:00",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_kind": "bridge",
"info_data": {
"forward_delay": 1500,
"hello_time": 200,
"max_age": 2000,
"ageing_time": 30000,
"stp_state": 0,
"priority": 32768,
"vlan_filtering": 1,
"vlan_protocol": "802.1Q",
"bridge_id": "8000.2:0:0:0:0:0",
"root_id": "8000.2:0:0:0:0:0",
"root_port": 0,
"root_path_cost": 0,
"topology_change": 0,
"topology_change_detected": 0,
"hello_timer": 0,
"tcn_timer": 0,
"topology_change_timer": 0,
"gc_timer": 27.38,
"vlan_default_pvid": 0,
"vlan_stats_enabled": 0,
"vlan_stats_per_port": 0,
"group_fwd_mask": "0",
"group_addr": "01:80:c2:00:00:00",
"mcast_snooping": 0,
"no_linklocal_learn": 0,
"mcast_vlan_snooping": 0,
"mcast_router": 1,
"mcast_query_use_ifaddr": 0,
"mcast_querier": 0,
"mcast_hash_elasticity": 16,
"mcast_hash_max": 4096,
"mcast_last_member_cnt": 2,
"mcast_startup_query_cnt": 2,
"mcast_last_member_intvl": 100,
"mcast_membership_intvl": 26000,
"mcast_querier_intvl": 25500,
"mcast_query_intvl": 12500,
"mcast_query_response_intvl": 1000,
"mcast_startup_query_intvl": 3124,
"mcast_stats_enabled": 0,
"mcast_igmp_version": 2,
"mcast_mld_version": 1,
"nf_call_iptables": 0,
"nf_call_ip6tables": 0,
"nf_call_arptables": 0
}
},
"inet6_addr_gen_mode": "none",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"stats64": {
"rx": {
"bytes": 3158,
"packets": 42,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 37
},
"tx": {
"bytes": 0,
"packets": 0,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 8,
"ifname": "br1",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "noqueue",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:02",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_kind": "bridge",
"info_data": {
"forward_delay": 1500,
"hello_time": 200,
"max_age": 2000,
"ageing_time": 30000,
"stp_state": 0,
"priority": 32768,
"vlan_filtering": 1,
"vlan_protocol": "802.1Q",
"bridge_id": "8000.2:0:0:0:0:2",
"root_id": "8000.2:0:0:0:0:2",
"root_port": 0,
"root_path_cost": 0,
"topology_change": 0,
"topology_change_detected": 0,
"hello_timer": 0.00,
"tcn_timer": 0.00,
"topology_change_timer": 0.00,
"gc_timer": 53.73,
"vlan_default_pvid": 0,
"vlan_stats_enabled": 0,
"vlan_stats_per_port": 0,
"group_fwd_mask": "0",
"group_addr": "01:80:c2:00:00:00",
"mcast_snooping": 0,
"no_linklocal_learn": 0,
"mcast_vlan_snooping": 0,
"mcast_router": 1,
"mcast_query_use_ifaddr": 0,
"mcast_querier": 0,
"mcast_hash_elasticity": 16,
"mcast_hash_max": 4096,
"mcast_last_member_cnt": 2,
"mcast_startup_query_cnt": 2,
"mcast_last_member_intvl": 100,
"mcast_membership_intvl": 26000,
"mcast_querier_intvl": 25500,
"mcast_query_intvl": 12500,
"mcast_query_response_intvl": 1000,
"mcast_startup_query_intvl": 3124,
"mcast_stats_enabled": 0,
"mcast_igmp_version": 2,
"mcast_mld_version": 1,
"nf_call_iptables": 0,
"nf_call_ip6tables": 0,
"nf_call_arptables": 0
}
},
"inet6_addr_gen_mode": "none",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"stats64": {
"rx": {
"bytes": 0,
"packets": 0,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 0,
"packets": 0,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 2,
"ifname": "e0",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "pfifo_fast",
"master": "br0",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:00",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 1,
"allmulti": 1,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_slave_kind": "bridge",
"info_slave_data": {
"state": "forwarding",
"priority": 32,
"cost": 100,
"hairpin": false,
"guard": false,
"root_block": false,
"fastleave": false,
"learning": true,
"flood": true,
"id": "0x8001",
"no": "0x1",
"designated_port": 32769,
"designated_cost": 0,
"bridge_id": "8000.2:0:0:0:0:0",
"root_id": "8000.2:0:0:0:0:0",
"hold_timer": 0,
"message_age_timer": 0,
"forward_delay_timer": 0,
"topology_change_ack": 0,
"config_pending": 0,
"proxy_arp": false,
"proxy_arp_wifi": false,
"multicast_router": 1,
"mcast_flood": true,
"bcast_flood": true,
"mcast_to_unicast": false,
"neigh_suppress": false,
"group_fwd_mask": "0",
"group_fwd_mask_str": "0x0",
"vlan_tunnel": false,
"isolated": false,
"locked": false
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"parentbus": "e1000",
"parentdev": "e1000-foobar",
"stats64": {
"rx": {
"bytes": 6537,
"packets": 59,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 20891,
"packets": 106,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 3,
"ifname": "e1",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "pfifo_fast",
"master": "br0",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:01",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 1,
"allmulti": 1,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_slave_kind": "bridge",
"info_slave_data": {
"state": "forwarding",
"priority": 32,
"cost": 100,
"hairpin": false,
"guard": false,
"root_block": false,
"fastleave": false,
"learning": true,
"flood": true,
"id": "0x8002",
"no": "0x2",
"designated_port": 32770,
"designated_cost": 0,
"bridge_id": "8000.2:0:0:0:0:0",
"root_id": "8000.2:0:0:0:0:0",
"hold_timer": 0,
"message_age_timer": 0,
"forward_delay_timer": 0,
"topology_change_ack": 0,
"config_pending": 0,
"proxy_arp": false,
"proxy_arp_wifi": false,
"multicast_router": 1,
"mcast_flood": true,
"bcast_flood": true,
"mcast_to_unicast": false,
"neigh_suppress": false,
"group_fwd_mask": "0",
"group_fwd_mask_str": "0x0",
"vlan_tunnel": false,
"isolated": false,
"locked": false
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"parentbus": "e1000",
"parentdev": "e1000-foobar",
"stats64": {
"rx": {
"bytes": 1397,
"packets": 11,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 24849,
"packets": 130,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 4,
"ifname": "e2",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "pfifo_fast",
"master": "br1",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:02",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 1,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_slave_kind": "bridge",
"info_slave_data": {
"state": "forwarding",
"priority": 32,
"cost": 100,
"hairpin": false,
"guard": false,
"root_block": false,
"fastleave": false,
"learning": true,
"flood": true,
"id": "0x8001",
"no": "0x1",
"designated_port": 32769,
"designated_cost": 0,
"bridge_id": "8000.2:0:0:0:0:2",
"root_id": "8000.2:0:0:0:0:2",
"hold_timer": 0.00,
"message_age_timer": 0.00,
"forward_delay_timer": 0.00,
"topology_change_ack": 0,
"config_pending": 0,
"proxy_arp": false,
"proxy_arp_wifi": false,
"multicast_router": 1,
"mcast_flood": true,
"bcast_flood": true,
"mcast_to_unicast": false,
"neigh_suppress": false,
"group_fwd_mask": "0",
"group_fwd_mask_str": "0x0",
"vlan_tunnel": false,
"isolated": false,
"locked": false
}
},
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"parentbus": "virtio",
"parentdev": "virtio4",
"stats64": {
"rx": {
"bytes": 0,
"packets": 0,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 19114,
"packets": 81,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 5,
"ifname": "e3",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "pfifo_fast",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:03",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 65535,
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"parentbus": "virtio",
"parentdev": "virtio5",
"stats64": {
"rx": {
"bytes": 1327,
"packets": 10,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 15057,
"packets": 72,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 6,
"ifname": "e4",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "pfifo_fast",
"operstate": "DOWN",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "02:00:00:00:00:04",
"broadcast": "ff:ff:ff:ff:ff:ff",
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 65535,
"inet6_addr_gen_mode": "eui64",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 65536,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"parentbus": "virtio",
"parentdev": "virtio6",
"stats64": {
"rx": {
"bytes": 1327,
"packets": 10,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 19022,
"packets": 95,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
},
{
"ifindex": 9,
"link_index": 8,
"ifname": "veth0j",
"flags": [
"BROADCAST",
"MULTICAST",
"UP",
"LOWER_UP"
],
"mtu": 1500,
"qdisc": "noqueue",
"operstate": "UP",
"linkmode": "DEFAULT",
"group": "default",
"txqlen": 1000,
"link_type": "ether",
"address": "b2:82:e3:ce:d5:9e",
"broadcast": "ff:ff:ff:ff:ff:ff",
"link_netnsid": 1,
"promiscuity": 0,
"allmulti": 0,
"min_mtu": 68,
"max_mtu": 65535,
"linkinfo": {
"info_kind": "veth"
},
"inet6_addr_gen_mode": "none",
"num_tx_queues": 1,
"num_rx_queues": 1,
"gso_max_size": 65536,
"gso_max_segs": 65535,
"tso_max_size": 524280,
"tso_max_segs": 65535,
"gro_max_size": 65536,
"gso_ipv4_max_size": 65536,
"gro_ipv4_max_size": 65536,
"stats64": {
"rx": {
"bytes": 1006,
"packets": 13,
"errors": 0,
"dropped": 0,
"over_errors": 0,
"multicast": 0
},
"tx": {
"bytes": 18668,
"packets": 50,
"errors": 0,
"dropped": 0,
"carrier_errors": 0,
"collisions": 0
}
}
}
]