Restore the plugin to its original state
When I started in my copy, I removed a bunch of code and options that I felt were distracting. I also renamed lots of elements like 'linux-cp' and 'Linux CP' and 'Linux-CP' to just be 'lcpng'. Now, rename all of this back, and make it ready for upstreaming. The only diffs between my repo and upstream now are the includes and the lcpng_interface.[ch] code changes, which is good.
This commit is contained in:
28
lcpng.c
28
lcpng.c
@ -24,28 +24,28 @@
|
||||
lcp_main_t lcp_main;
|
||||
|
||||
u8 *
|
||||
lcp_get_netns (void)
|
||||
lcp_get_default_ns (void)
|
||||
{
|
||||
lcp_main_t *lcpm = &lcp_main;
|
||||
|
||||
if (lcpm->netns_name[0] == 0)
|
||||
if (lcpm->default_namespace[0] == 0)
|
||||
return 0;
|
||||
return lcpm->netns_name;
|
||||
return lcpm->default_namespace;
|
||||
}
|
||||
|
||||
int
|
||||
lcp_get_netns_fd (void)
|
||||
lcp_get_default_ns_fd (void)
|
||||
{
|
||||
lcp_main_t *lcpm = &lcp_main;
|
||||
|
||||
return lcpm->netns_fd;
|
||||
return lcpm->default_ns_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* ns is expected to be or look like a NUL-terminated C string.
|
||||
*/
|
||||
int
|
||||
lcp_set_netns (u8 *ns)
|
||||
lcp_set_default_ns (u8 *ns)
|
||||
{
|
||||
lcp_main_t *lcpm = &lcp_main;
|
||||
char *p;
|
||||
@ -59,18 +59,18 @@ lcp_set_netns (u8 *ns)
|
||||
|
||||
if (!p || *p == 0)
|
||||
{
|
||||
clib_memset (lcpm->netns_name, 0,
|
||||
sizeof (lcpm->netns_name));
|
||||
if (lcpm->netns_fd > 0)
|
||||
close (lcpm->netns_fd);
|
||||
lcpm->netns_fd = 0;
|
||||
clib_memset (lcpm->default_namespace, 0,
|
||||
sizeof (lcpm->default_namespace));
|
||||
if (lcpm->default_ns_fd > 0)
|
||||
close (lcpm->default_ns_fd);
|
||||
lcpm->default_ns_fd = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
clib_strncpy ((char *) lcpm->netns_name, p, LCP_NS_LEN - 1);
|
||||
clib_strncpy ((char *) lcpm->default_namespace, p, LCP_NS_LEN - 1);
|
||||
|
||||
s = format (0, "/var/run/netns/%s%c", (char *) lcpm->netns_name, 0);
|
||||
lcpm->netns_fd = open ((char *) s, O_RDONLY);
|
||||
s = format (0, "/var/run/netns/%s%c", (char *) lcpm->default_namespace, 0);
|
||||
lcpm->default_ns_fd = open ((char *) s, O_RDONLY);
|
||||
vec_free (s);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user