unix: mkdir VPP_RUN_DIR before opening a socket in it

Change https://gerrit.fd.io/r/#/c/7230/ added a Unix domain
CLI socket in the default startup.conf; however unless you
had previously run VPP with the DPDK plugin enabled the
directory that it is created in. /run/vpp, would not exist
and startup would fail. This directory is typically hosted
in a tmpfs ramdisk and is thus ephemeral.

This patch adds a function that attempts to mkdir VPP_RUN_DIR
and uses it in both the DPDK plugin and the CLI code if the
CLI socket is to be created in that directory.

Change-Id: Ibbf925819099dce2b5eb0fa238b9edca1036d6fd
Signed-off-by: Chris Luke <chrisy@flirble.org>
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 953d133..1befa25 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2642,6 +2642,17 @@
       /* CLI listen. */
       unix_file_t template = { 0 };
 
+      /* If our listen address looks like a path and it starts with
+       * VPP_RUN_DIR, go make sure VPP_RUN_DIR exists before trying to open
+       * a socket in it.
+       */
+      if (strncmp (s->config, VPP_RUN_DIR "/", strlen (VPP_RUN_DIR) + 1) == 0)
+	{
+	  error = unix_make_vpp_run_dir ();
+	  if (error)
+	    return error;
+	}
+
       s->flags = SOCKET_IS_SERVER |	/* listen, don't connect */
 	SOCKET_ALLOW_GROUP_WRITE;	/* PF_LOCAL socket only */
       error = clib_socket_init (s);