Cleanup interface sync

- move tap_set_carrier() upstream to lcp_itf_set_link_state()
- refuse to set admin-up on sub-int if parent is down
- no need to switch namespaces, lcp_itf_set_link_state() already does
- in change_mtu and change_admin_state, if the interface is a sub,
  we only have to sync that one interface. Otherwise, walk the parent
  interface and all sub-ints with lcp_itf_pair_sync_state_hw() and
  make note of this in the (DBG) log
This commit is contained in:
Pim van Pelt
2021-09-08 20:53:02 +00:00
parent ba4d9d1a3c
commit 45cb9b4afc
2 changed files with 64 additions and 35 deletions

View File

@ -601,6 +601,7 @@ void
lcp_itf_set_link_state (const lcp_itf_pair_t *lip, u8 state)
{
vnet_main_t *vnm = vnet_get_main ();
vnet_sw_interface_t *si;
int curr_ns_fd, vif_ns_fd;
if (!lip) return;
@ -629,6 +630,11 @@ lcp_itf_set_link_state (const lcp_itf_pair_t *lip, u8 state)
}
vnet_netlink_set_link_state (lip->lip_vif_index, state);
/* Set carrier (oper link) on the TAP
*/
si = vnet_get_sw_interface_or_null (vnm, lip->lip_host_sw_if_index);
tap_set_carrier (si->hw_if_index, state);
if (vif_ns_fd != -1)
close (vif_ns_fd);