Add automatic LCP creation

Update the pair_config() parser to follow suite.

When the configuration 'lcp-auto-subint' is set, and the interface at
hand is a subinterface, in lcp_itf_interface_add_del():

- if it's a deletion and we're a sub-int, and we have a LIP: delete it.
- if it's a creation and we're a sub-int, and our parent has a LIP, create one.

Fix a few logging consistency issues (pair_del), and in
pair_delete_by_index() ensure that the right namespace is selected.

Due to this quirk with lip->lip_namespace not wanting to be a vec_dup()
string, rewrite them all to be strdup/free instead.
This commit is contained in:
Pim van Pelt
2021-08-14 17:20:31 +02:00
parent b3d8e75706
commit 934446dcd9
5 changed files with 105 additions and 37 deletions

16
lcpng.c

@ -69,6 +69,22 @@ int lcp_set_default_ns(u8 *ns) {
return 0;
}
void
lcp_set_auto_subint (u8 is_auto)
{
lcp_main_t *lcpm = &lcp_main;
lcpm->auto_subint = (is_auto != 0);
}
int
lcp_auto_subint (void)
{
lcp_main_t *lcpm = &lcp_main;
return lcpm->auto_subint;
}
/*
* fd.io coding-style-patch-verification: ON
*