[zebra 18626] move zebra socket paths to configure.ac
moved definition of the various socket paths from the
per daemon header files into configure.ac. it will set the paths to
be in the directory specified by --localstatedir=<prefix> or
otherwise will try to guess as best it can ( a la pid file path
detection - which probably should try reference ${prefix} too).
the present hardcoded socket path, /tmp, isnt really correct. should
be in /var somewhere really.
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 01d4721..e3ac73f 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -611,7 +611,6 @@
/* Default configuration settings for bgpd. */
#define BGP_VTY_PORT 2605
-#define BGP_VTYSH_PATH "/tmp/.bgpd"
#define BGP_DEFAULT_CONFIG "bgpd.conf"
/* Check AS path loop when we send NLRI. */
diff --git a/configure.ac b/configure.ac
index f66691c..c8460c1 100755
--- a/configure.ac
+++ b/configure.ac
@@ -831,6 +831,37 @@
AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
+dnl ------------------------------
+dnl set paths for socket files
+dnl ------------------------------
+if test "${prefix}" = "NONE"; then
+ ac_sock_prefix="";
+else
+ ac_sock_prefix=${prefix}
+fi
+if test "${localstatedir}" = '${prefix}/var'; then
+ AC_CACHE_CHECK(socket directory,ac_sockdir,
+ [for ZEBRA_SOCK_DIR in ${ac_sock_prefix}/var/run/zebra dnl
+ ${ac_sock_prefix}/var/run dnl
+ ${ac_sock_prefix}/var/adm dnl
+ ${ac_sock_prefix}/tmp; dnl
+ do
+ test -d $ZEBRA_SOCK_DIR && break
+ done
+ ac_sockdir=$ZEBRA_SOCK_DIR
+ if test ! -d $ZEBRA_SOCK_DIR ; then
+ echo "SOCKET DIRECTORY NOT FOUND!"
+ fi])
+else
+ ac_sockdir="`eval echo ${localstatedir}`"
+fi
+AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$ac_sockdir/zserv.api",zebra api socket)
+AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$ac_sockdir/zebra.vty",zebra vty socket)
+AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$ac_sockdir/ripd.vty",rip vty socket)
+AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$ac_sockdir/ripngd.vty",ripng vty socket)
+AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$ac_sockdir/bgpd.vty",bgpd vty socket)
+AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$ac_sockdir/ospfd.vty",ospfd vty socket)
+AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$ac_sockdir/ospf6d.vty",ospf6d vty socket)
dnl ---------------------------
dnl Check htonl works correctly
diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h
index e0d310a..4c9f7dc 100644
--- a/ospf6d/ospf6d.h
+++ b/ospf6d/ospf6d.h
@@ -94,7 +94,6 @@
/* Default port values. */
#define OSPF6_VTY_PORT 2606
-#define OSPF6_VTYSH_PATH "/tmp/.ospf6d"
#ifdef INRIA_IPV6
#ifndef IPV6_PKTINFO
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index f842486..7f82fff 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -39,7 +39,6 @@
/* VTY port number. */
#define OSPF_VTY_PORT 2604
-#define OSPF_VTYSH_PATH "/tmp/.ospfd"
/* IP TTL for OSPF protocol. */
#define OSPF_IP_TTL 1
diff --git a/ripd/ripd.h b/ripd/ripd.h
index 17301c3..112e1cb 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -64,7 +64,6 @@
/* RIP port number. */
#define RIP_PORT_DEFAULT 520
#define RIP_VTY_PORT 2602
-#define RIP_VTYSH_PATH "/tmp/.ripd"
/* Default configuration file name. */
#define RIPD_DEFAULT_CONFIG "ripd.conf"
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index 2509bdd..816deb6 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -27,7 +27,6 @@
#define RIPNG_V1 1
#define RIPNG_PORT_DEFAULT 521
#define RIPNG_VTY_PORT 2603
-#define RIPNG_VTYSH_PATH "/tmp/.ripngd"
#define RIPNG_MAX_PACKET_SIZE 1500
#define RIPNG_PRIORITY_DEFAULT 0
diff --git a/zebra/zserv.h b/zebra/zserv.h
index c762280..a083611 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -25,8 +25,6 @@
/* Default port information. */
#define ZEBRA_PORT 2600
#define ZEBRA_VTY_PORT 2601
-#define ZEBRA_VTYSH_PATH "/tmp/.zebra"
-#define ZEBRA_SERV_PATH "/tmp/.zserv"
/* Default configuration filename. */
#define DEFAULT_CONFIG_FILE "zebra.conf"