summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--watchfrr/watchfrr.c8
-rw-r--r--watchfrr/watchfrr.h6
-rw-r--r--watchfrr/watchfrr_vty.c5
3 files changed, 18 insertions, 1 deletions
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index 40749e8fc2..b09d092458 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -68,6 +68,7 @@ DEFINE_MTYPE_STATIC(WATCHFRR, WATCHFRR_DAEMON, "watchfrr daemon entry");
struct thread_master *master;
static bool watch_only = false;
+const char *pathspace;
typedef enum {
PHASE_NONE = 0,
@@ -1513,8 +1514,15 @@ int main(int argc, char **argv)
else
unsetenv("FRR_PATHSPACE");
+ /*
+ * when watchfrr_di.pathspace is read, if it is not specified
+ * pathspace is NULL as expected
+ */
+ pathspace = watchfrr_di.pathspace;
+
if (netns_en && !netns)
netns = watchfrr_di.pathspace;
+
if (netns_en && netns && netns[0])
netns_setup(netns);
diff --git a/watchfrr/watchfrr.h b/watchfrr/watchfrr.h
index 4df1bf74af..4987a932c0 100644
--- a/watchfrr/watchfrr.h
+++ b/watchfrr/watchfrr.h
@@ -25,6 +25,12 @@
DECLARE_MGROUP(WATCHFRR);
+/*
+ * This is the name of the pathspace we are in `-N XXX`
+ * If the default then this is NULL
+ */
+extern const char *pathspace;
+
extern void watchfrr_vty_init(void);
extern pid_t integrated_write_pid;
diff --git a/watchfrr/watchfrr_vty.c b/watchfrr/watchfrr_vty.c
index eda4f5d516..1492ee37b6 100644
--- a/watchfrr/watchfrr_vty.c
+++ b/watchfrr/watchfrr_vty.c
@@ -105,7 +105,10 @@ DEFUN(config_write_integrated,
/* don't allow the user to pass parameters, we're root here!
* should probably harden vtysh at some point too... */
- execl(VTYSH_BIN_PATH, "vtysh", "-w", NULL);
+ if (pathspace)
+ execl(VTYSH_BIN_PATH, "vtysh", "-N", pathspace, "-w", NULL);
+ else
+ execl(VTYSH_BIN_PATH, "vtysh", "-w", NULL);
/* unbuffered write; we just messed with stdout... */
char msg[512];