Browse Source

[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.
paul 17 years ago
parent
commit
23bd12c31d
7 changed files with 31 additions and 7 deletions
  1. 0 1
      bgpd/bgpd.h
  2. 31 0
      configure.ac
  3. 0 1
      ospf6d/ospf6d.h
  4. 0 1
      ospfd/ospfd.h
  5. 0 1
      ripd/ripd.h
  6. 0 1
      ripngd/ripngd.h
  7. 0 2
      zebra/zserv.h

+ 0 - 1
bgpd/bgpd.h

@@ -611,7 +611,6 @@ struct bgp_nlri
 
 /* 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.  */

+ 31 - 0
configure.ac

@@ -831,6 +831,37 @@ AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
 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

+ 0 - 1
ospf6d/ospf6d.h

@@ -94,7 +94,6 @@ extern char *recent_reason;
 
 /* Default port values. */
 #define OSPF6_VTY_PORT             2606
-#define OSPF6_VTYSH_PATH           "/tmp/.ospf6d"
 
 #ifdef INRIA_IPV6
 #ifndef IPV6_PKTINFO

+ 0 - 1
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

+ 0 - 1
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"

+ 0 - 1
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
 

+ 0 - 2
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"