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

12
lcpng.h
View File

@ -22,8 +22,8 @@
typedef struct lcp_main_s
{
u16 msg_id_base; /* API message ID base */
u8 default_namespace[LCP_NS_LEN]; /* default namespace if set */
int default_ns_fd;
u8 netns_name[LCP_NS_LEN]; /* namespace, if set */
int netns_fd;
/* Set when Unit testing */
u8 test_mode;
} lcp_main_t;
@ -31,11 +31,11 @@ typedef struct lcp_main_s
extern lcp_main_t lcp_main;
/**
* Get/Set the default namespace for LCP host taps.
* Get/Set the namespace in which to create LCP host taps.
*/
int lcp_set_default_ns (u8 *ns);
u8 *lcp_get_default_ns (void); /* Returns NULL or shared string */
int lcp_get_default_ns_fd (void);
int lcp_set_netns (u8 *ns);
u8 *lcp_get_netns (void); /* Returns NULL or shared string */
int lcp_get_netns_fd (void);
#endif