Protect VPP -> Linux state propagation behind flag

Introduce lcp_main.lcp_sync, which determines if state changes made
to interfaces in VPP do or don't propagate into Linux.

- Add a startup.conf directive 'lcp-sync' to enable at startup time.
- Add CLI.short_help = "lcp lcp-sync [on|enable|off|disable]",
- Show the current value in "show lcp".

Gate changes in mtu, state and address on lcp_lcp_sync().

When the operator issues 'lcp lcp-sync on', it is prudent to do a
one-off sync of all interface attributes from VPP into Linux.
For this, add a lcp_itf_pair_sync_state_all() function.
This commit is contained in:
Pim van Pelt
2021-08-15 16:07:53 +02:00
parent d23aab2d95
commit 2d00de080b
6 changed files with 104 additions and 11 deletions

20
lcpng.c
View File

@ -69,6 +69,26 @@ int lcp_set_default_ns(u8 *ns) {
return 0;
}
void
lcp_set_lcp_sync (u8 is_auto)
{
lcp_main_t *lcpm = &lcp_main;
lcpm->lcp_sync = (is_auto != 0);
// If we set to 'on', do a one-off sync of LCP interfaces
if (is_auto)
lcp_itf_pair_sync_state_all ();
}
int
lcp_lcp_sync (void)
{
lcp_main_t *lcpm = &lcp_main;
return lcpm->lcp_sync;
}
void
lcp_set_lcp_auto_subint (u8 is_auto)
{