]> git.proxmox.com Git - mirror_frr.git/commitdiff
build: replace some hardcoding with ./configure
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 20 Dec 2016 17:10:30 +0000 (18:10 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 20 Dec 2016 17:18:44 +0000 (18:18 +0100)
Several places have paths and names that can change hardcoded, e.g. the
package name and the /var/run path.  This fixes a few of them, there's
still some to do.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/agentx.c
lib/version.h.in
ospfd/ospf_main.c
vtysh/vtysh.c
watchquagga/watchquagga.c
zebra/zebra_ptm.c

index 5996b34a0fbe87ffca8413492011737629f9ea8c..4175e7ba927e96131e860ebb1057b713e038ef86 100644 (file)
@@ -31,6 +31,7 @@
 #include "smux.h"
 #include "memory.h"
 #include "linklist.h"
+#include "version.h"
 
 static int agentx_enabled = 0;
 
@@ -175,7 +176,7 @@ DEFUN (agentx_enable,
 {
   if (!agentx_enabled)
     {
-      init_snmp("quagga");
+      init_snmp(FRR_SMUX_NAME);
       events = list_new();
       agentx_events_update ();
       agentx_enabled = 1;
@@ -209,7 +210,7 @@ smux_init (struct thread_master *tm)
                          SNMP_CALLBACK_LOGGING,
                          agentx_log_callback,
                          NULL);
-  init_agent ("quagga");
+  init_agent (FRR_SMUX_NAME);
 
   install_node (&agentx_node, config_write_agentx);
   install_element (CONFIG_NODE, &agentx_enable_cmd);
index c41d44e0a4d3e973216bce9312058c02dd9891b4..adc82781892b2ee3e77ad71df0736e8e68dba6d7 100644 (file)
@@ -37,6 +37,7 @@
 
 #define FRR_PAM_NAME    "@PACKAGE_NAME@"
 #define FRR_SMUX_NAME   "@PACKAGE_NAME@"
+#define FRR_PTM_NAME    "@PACKAGE_NAME@"
 
 #define FRR_FULL_NAME   "FreeRangeRouting"
 #define FRR_VERSION     "@PACKAGE_VERSION@" GIT_SUFFIX
index 5309af5bf9bd61474afc085e701a7f2e61a337e1..e0719b397a67fde77a11f80910171256b8428f2f 100644 (file)
@@ -360,8 +360,8 @@ main (int argc, char **argv)
   /* Create VTY socket */
   if (instance)
     {
-      sprintf(pid_file, "/var/run/quagga/ospfd-%d.pid", instance);
-      sprintf(vty_path, "/var/run/quagga/ospfd-%d.vty", instance);
+      sprintf(pid_file, "%s/ospfd-%d.pid", DAEMON_VTY_DIR, instance);
+      sprintf(vty_path, "%s/ospfd-%d.vty", DAEMON_VTY_DIR, instance);
     }
   else
     {
index 82d0f437df74586a6999b62a28702728e43dcc9d..a4f108e44725107679856fff832ab6019b952206 100644 (file)
@@ -2999,8 +2999,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
 
   if (head_client->flag != VTYSH_OSPFD) return;
 
-  /* ls /var/run/quagga/ and look for all files ending in .vty */
-  dir = opendir("/var/run/quagga/");
+  /* ls DAEMON_VTY_DIR and look for all files ending in .vty */
+  dir = opendir(DAEMON_VTY_DIR "/");
   if (dir)
     {
       while ((file = readdir(dir)) != NULL)
@@ -3010,7 +3010,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
               if (n == MAXIMUM_INSTANCES)
                 {
                   fprintf(stderr,
-                          "Parsing /var/run/quagga/, client limit(%d) reached!\n", n);
+                          "Parsing %s/, client limit(%d) reached!\n",
+                          DAEMON_VTY_DIR, n);
                   break;
                 }
               client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client));
@@ -3018,7 +3019,7 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
              client->name = "ospfd";
               client->flag = VTYSH_OSPFD;
               ptr = (char *) malloc(100);
-              sprintf(ptr, "/var/run/quagga/%s", file->d_name);
+              sprintf(ptr, "%s/%s", DAEMON_VTY_DIR, file->d_name);
              client->path = (const char *)ptr;
               client->next = NULL;
               vtysh_client_sorted_insert(head_client, client);
index 98e91295675a9bd43164bec5682138ca35ed3e3f..a70070bef7013220276c300a30daae19a4145519 100644 (file)
@@ -706,7 +706,7 @@ daemon_send_ready (void)
 #if defined (HAVE_CUMULUS)
       FILE *fp;
 
-      fp = fopen("/var/run/quagga/watchquagga.started", "w");
+      fp = fopen(DAEMON_VTY_DIR "/watchquagga.started", "w");
       fclose(fp);
 #endif
       zlog_notice ("Watchquagga: Notifying Systemd we are up and running");
index e6d13b5070e3cf9e87bc22506a90b2752d4f1834..c5223199a4c57e4076a24bd70209a3987eae39d4 100644 (file)
@@ -38,6 +38,7 @@
 #include "vrf.h"
 #include "rib.h"
 #include "zebra_vrf.h"
+#include "version.h"
 
 #define ZEBRA_PTM_RECONNECT_TIME_INITIAL 1 /* initial reconnect is 1s */
 #define ZEBRA_PTM_RECONNECT_TIME_MAX     300
@@ -119,7 +120,7 @@ zebra_ptm_init (void)
   ptm_cb.pid = getpid();
   zebra_ptm_install_commands();
 
-  sprintf(buf, "%s", "quagga");
+  sprintf(buf, "%s", FRR_PTM_NAME);
   ptm_hdl = ptm_lib_register(buf, NULL, zebra_ptm_handle_msg_cb,
                                     zebra_ptm_handle_msg_cb);
   ptm_cb.wb = buffer_new(0);