Remove ability to override netns

This gives a lot of operational problems later. It's definitely reasonable
to be able to create tap interfaces in other namespaces, and this is
still possible (see below for syntax).

However, changing the runtime netns makes the netlink listener much more
complicated because it will have to listen on not just one netns, but all
of them, for netlink updates.

So, for now, let's remove the ability to set the namespace in the API.
Still possible:
- set at startup.conf in lcpng { netns <x> }
- force creating in 'lcpng create ... netns <x>'

This will nudge folks to create one singular namespace (say,
'dataplane', in the startup.conf), and then handle all netlink messages
in that namespace only.
This commit is contained in:
Pim van Pelt
2021-08-08 20:54:43 +02:00
parent f3fa25d897
commit ca273dc953
6 changed files with 47 additions and 88 deletions

View File

@ -169,22 +169,22 @@ vl_api_lcp_itf_pair_get_t_handler (vl_api_lcp_itf_pair_get_t *mp)
}
static void
vl_api_lcp_default_ns_set_t_handler (vl_api_lcp_default_ns_set_t *mp)
vl_api_lcp_netns_set_t_handler (vl_api_lcp_netns_set_t *mp)
{
vl_api_lcp_default_ns_set_reply_t *rmp;
vl_api_lcp_netns_set_reply_t *rmp;
int rv;
mp->namespace[LCP_NS_LEN - 1] = 0;
rv = lcp_set_default_ns (mp->namespace);
rv = lcp_set_netns (mp->namespace);
REPLY_MACRO (VL_API_LCP_DEFAULT_NS_SET_REPLY);
REPLY_MACRO (VL_API_LCP_NETNS_SET_REPLY);
}
static void
vl_api_lcp_default_ns_get_t_handler (vl_api_lcp_default_ns_get_t *mp)
vl_api_lcp_netns_get_t_handler (vl_api_lcp_netns_get_t *mp)
{
lcp_main_t *lcpm = &lcp_main;
vl_api_lcp_default_ns_get_reply_t *rmp;
vl_api_lcp_netns_get_reply_t *rmp;
vl_api_registration_t *reg;
char *ns;
@ -194,10 +194,10 @@ vl_api_lcp_default_ns_get_t_handler (vl_api_lcp_default_ns_get_t *mp)
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = (VL_API_LCP_DEFAULT_NS_GET_REPLY + lcpm->msg_id_base);
rmp->_vl_msg_id = (VL_API_LCP_NETNS_GET_REPLY + lcpm->msg_id_base);
rmp->context = mp->context;
ns = (char *) lcp_get_default_ns ();
ns = (char *) lcp_get_netns ();
if (ns)
clib_strncpy ((char *) rmp->namespace, ns, LCP_NS_LEN - 1);