From bd50ed18de83493b119e67897a5fa9ba9c7e763e Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Fri, 24 Jul 2020 13:38:03 -0500 Subject: tap: allow change of carrier state on host Type: feature Add a function to adjust the link state of the host side of a tap interface. If an application (e.g. route protocol daemons) running on the host uses netlink to monitor interface state, a plugin could use this function to communicate a loss of connectivity to the application by making the interface appear to go down. Requires a somewhat recent kernel. E.g. it does not have any effect on CentOS 7 but it works on CentOS 8. Change-Id: I677ee7889d2eb142e2395bea98f0b4d7e7e7f810 Signed-off-by: Matthew Smith --- src/vnet/devices/virtio/virtio.c | 1 + src/vnet/devices/virtio/virtio.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/vnet/devices/virtio') diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c index 8209a46b52f..925ad092b91 100644 --- a/src/vnet/devices/virtio/virtio.c +++ b/src/vnet/devices/virtio/virtio.c @@ -345,6 +345,7 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type) if (type == VIRTIO_IF_TYPE_TAP) vlib_cli_output (vm, " host-mac-addr: %U", format_ethernet_address, vif->host_mac_addr); + vlib_cli_output (vm, " host-carrier-up: %u", vif->host_carrier_up); vec_foreach_index (i, vif->vhost_fds) str = format (str, " %d", vif->vhost_fds[i]); diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h index 86660a1f933..fda72365db9 100644 --- a/src/vnet/devices/virtio/virtio.h +++ b/src/vnet/devices/virtio/virtio.h @@ -169,6 +169,7 @@ typedef struct ip4_address_t host_ip4_addr; u8 host_ip4_prefix_len; u8 host_ip6_prefix_len; + u8 host_carrier_up; /* host tun/tap driver link carrier state */ }; struct /* native virtio */ { -- cgit 1.2.3-korg