]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_main.c
pimd: Cleanup dest buffer to small
[mirror_frr.git] / pimd / pim_main.c
index 29432ea230a2c75f5f6962cd65181b8d237709f3..2e81ac53fd05737db2bc98003c3ed8110a1b89a6 100644 (file)
 #include "prefix.h"
 #include "plist.h"
 #include "vrf.h"
+#include "sockopt.h"
 
 #include "pimd.h"
 #include "pim_version.h"
 #include "pim_signals.h"
 #include "pim_zebra.h"
-
-#ifdef PIM_ZCLIENT_DEBUG
-extern int zclient_debug;
-#endif
+#include "pim_msdp.h"
+#include "pim_iface.h"
+#include "pim_rp.h"
 
 extern struct host host;
 
 char config_default[] = SYSCONFDIR PIMD_DEFAULT_CONFIG;
 
+/* pimd options */
+#define OPTION_VTYSOCK 1000
 struct option longopts[] = {
   { "daemon",        no_argument,       NULL, 'd'},
   { "config_file",   required_argument, NULL, 'f'},
   { "pid_file",      required_argument, NULL, 'i'},
+  { "socket",        required_argument, NULL, 'z'},
   { "vty_addr",      required_argument, NULL, 'A'},
   { "vty_port",      required_argument, NULL, 'P'},
+  { "vty_socket",    required_argument, NULL, OPTION_VTYSOCK},
   { "version",       no_argument,       NULL, 'v'},
   { "debug_zclient", no_argument,       NULL, 'Z'},
   { "help",          no_argument,       NULL, 'h'},
   { 0 }
 };
 
+/* VTY Socket prefix */
+char vty_sock_path[MAXPATHLEN] = PIM_VTYSH_PATH;
+
 /* pimd privileges */
 zebra_capabilities_t _caps_p [] = 
 {
   ZCAP_NET_ADMIN,
   ZCAP_SYS_ADMIN,
   ZCAP_NET_RAW,
+  ZCAP_BIND,
 };
 
 /* pimd privileges to run with */
@@ -103,19 +111,11 @@ Daemon which manages PIM.\n\n\
 -z, --socket         Set path of zebra socket\n\
 -A, --vty_addr       Set vty's bind address\n\
 -P, --vty_port       Set vty's port number\n\
+    --vty_socket     Override vty socket path\n\
 -v, --version        Print program version\n\
-"
-
-#ifdef PIM_ZCLIENT_DEBUG
-"\
--Z, --debug_zclient  Enable zclient debugging\n\
-"
-#endif
-
-"\
 -h, --help           Display this help and exit\n\
 \n\
-Report bugs to %s\n", progname, PIMD_BUG_ADDRESS);
+Report bugs to %s\n", progname, PACKAGE_BUGREPORT);
   }
 
   exit (status);
@@ -172,16 +172,14 @@ int main(int argc, char** argv, char** envp) {
     case 'P':
       vty_port = atoi (optarg);
       break;
+    case OPTION_VTYSOCK:
+      set_socket_path(vty_sock_path, PIM_VTYSH_PATH, optarg, sizeof (vty_sock_path));
+      break;
     case 'v':
       printf(PIMD_PROGNAME " version %s\n", PIMD_VERSION);
       print_version(progname);
       exit (0);
       break;
-#ifdef PIM_ZCLIENT_DEBUG
-    case 'Z':
-      zclient_debug = 1;
-      break;
-#endif
     case 'h':
       usage (0);
       break;
@@ -206,8 +204,12 @@ int main(int argc, char** argv, char** envp) {
   vrf_init ();
   access_list_init();
   prefix_list_init ();
+  prefix_list_add_hook (pim_rp_prefix_list_update);
+  prefix_list_delete_hook (pim_rp_prefix_list_update);
+
   pim_route_map_init ();
   pim_init();
+  pim_msdp_init (master);
 
   /*
    * Initialize zclient "update" and "lookup" sockets
@@ -238,7 +240,7 @@ int main(int argc, char** argv, char** envp) {
   /* Create pimd VTY socket */
   if (vty_port < 0)
     vty_port = PIMD_VTY_PORT;
-  vty_serv_sock(vty_addr, vty_port, PIM_VTYSH_PATH);
+  vty_serv_sock(vty_addr, vty_port, vty_sock_path);
 
   zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting, VTY interface at port TCP %d",
              FRR_VERSION, PIMD_VERSION, vty_port);
@@ -254,11 +256,6 @@ int main(int argc, char** argv, char** envp) {
   PIM_DO_DEBUG_ZEBRA;
 #endif
 
-#ifdef PIM_ZCLIENT_DEBUG
-  zlog_notice("PIM_ZCLIENT_DEBUG: zclient debugging is supported, mode is %s (see option -Z)",
-             zclient_debug ? "ON" : "OFF");
-#endif
-
 #ifdef PIM_CHECK_RECV_IFINDEX_SANITY
   zlog_notice("PIM_CHECK_RECV_IFINDEX_SANITY: will match sock/recv ifindex");
 #ifdef PIM_REPORT_RECV_IFINDEX_MISMATCH
@@ -270,12 +267,6 @@ int main(int argc, char** argv, char** envp) {
   zlog_notice("PIM_UNEXPECTED_KERNEL_UPCALL: report unexpected kernel upcall");
 #endif
 
-#ifdef HAVE_CLOCK_MONOTONIC
-  zlog_notice("HAVE_CLOCK_MONOTONIC");
-#else
-  zlog_notice("!HAVE_CLOCK_MONOTONIC");
-#endif
-
   while (thread_fetch(master, &thread))
     thread_call(&thread);