]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/vty.c
Merge remote-tracking branch 'origin/master' into EIGRP
[mirror_frr.git] / lib / vty.c
index 3a3265f54d528b9b25490be41bb92f8ecb0ae0d4..bd0b1c3219719cd74cd8903559aec0f7305107e8 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -214,7 +214,7 @@ vty_time_print (struct vty *vty, int cr)
 
   if (quagga_timestamp(0, buf, sizeof(buf)) == 0)
     {
-      zlog (NULL, LOG_INFO, "quagga_timestamp error");
+      zlog_info("quagga_timestamp error");
       return;
     }
   if (cr)
@@ -437,7 +437,7 @@ vty_command (struct vty *vty, char *buf)
       snprintf(prompt_str, sizeof(prompt_str), cmd_prompt (vty->node), vty_str);
 
       /* now log the command */
-      zlog(NULL, LOG_ERR, "%s%s", prompt_str, buf);
+      zlog_err("%s%s", prompt_str, buf);
     }
   /* Split readline string up into the vector */
   vline = cmd_make_strvec (buf);
@@ -457,10 +457,7 @@ vty_command (struct vty *vty, char *buf)
   ret = cmd_execute_command (vline, vty, NULL, 0);
 
   /* Get the name of the protocol if any */
-  if (zlog_default)
-      protocolname = zlog_proto_names[zlog_default->protocol];
-  else
-      protocolname = zlog_proto_names[ZLOG_NONE];
+  protocolname = zlog_protoname();
 
 #ifdef CONSUMED_TIME_CHECK
     GETRUSAGE(&after);
@@ -737,6 +734,7 @@ vty_end_config (struct vty *vty)
     case ZEBRA_NODE:
     case RIP_NODE:
     case RIPNG_NODE:
+    case EIGRP_NODE:
     case BGP_NODE:
     case BGP_VPNV4_NODE:
     case BGP_VPNV6_NODE:
@@ -1164,6 +1162,7 @@ vty_stop_input (struct vty *vty)
     case ZEBRA_NODE:
     case RIP_NODE:
     case RIPNG_NODE:
+    case EIGRP_NODE:
     case BGP_NODE:
     case RMAP_NODE:
     case OSPF_NODE:
@@ -1856,8 +1855,8 @@ vty_accept (struct thread *thread)
       if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) &&
           (access_list_apply (acl, &p) == FILTER_DENY))
         {
-          zlog (NULL, LOG_INFO, "Vty connection refused from %s",
-                sockunion2str (&su, buf, SU_ADDRSTRLEN));
+          zlog_info ("Vty connection refused from %s",
+                     sockunion2str (&su, buf, SU_ADDRSTRLEN));
           close (vty_sock);
 
           /* continue accepting connections */
@@ -1873,8 +1872,8 @@ vty_accept (struct thread *thread)
       if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) &&
           (access_list_apply (acl, &p) == FILTER_DENY))
         {
-          zlog (NULL, LOG_INFO, "Vty connection refused from %s",
-                sockunion2str (&su, buf, SU_ADDRSTRLEN));
+          zlog_info ("Vty connection refused from %s",
+                     sockunion2str (&su, buf, SU_ADDRSTRLEN));
           close (vty_sock);
 
           /* continue accepting connections */
@@ -1888,11 +1887,11 @@ vty_accept (struct thread *thread)
   ret = setsockopt (vty_sock, IPPROTO_TCP, TCP_NODELAY,
                     (char *) &on, sizeof (on));
   if (ret < 0)
-    zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s",
-          safe_strerror (errno));
+    zlog_info ("can't set sockopt to vty_sock : %s",
+               safe_strerror (errno));
 
-  zlog (NULL, LOG_INFO, "Vty connection from %s",
-        sockunion2str (&su, buf, SU_ADDRSTRLEN));
+  zlog_info ("Vty connection from %s",
+             sockunion2str (&su, buf, SU_ADDRSTRLEN));
 
   vty_create (vty_sock, &su);
 
@@ -2354,7 +2353,7 @@ vty_read_file (FILE *confp)
 }
 
 static FILE *
-vty_use_backup_config (char *fullpath)
+vty_use_backup_config (const char *fullpath)
 {
   char *fullpath_sav, *fullpath_tmp;
   FILE *ret = NULL;
@@ -2413,12 +2412,12 @@ out_close_sav:
 
 /* Read up configuration file from file_name. */
 void
-vty_read_config (char *config_file,
+vty_read_config (const char *config_file,
                  char *config_default_dir)
 {
   char cwd[MAXPATHLEN];
   FILE *confp = NULL;
-  char *fullpath;
+  const char *fullpath;
   char *tmp = NULL;
 
   /* If -f flag specified. */
@@ -2518,7 +2517,7 @@ vty_read_config (char *config_file,
 
 tmp_free_and_out:
   if (tmp)
-    XFREE (MTYPE_TMP, fullpath);
+    XFREE (MTYPE_TMP, tmp);
 }
 
 /* Small utility function which output log to the VTY. */
@@ -2663,7 +2662,7 @@ vty_event (enum event event, int sock, struct vty *vty)
     }
 }
 
-DEFUN (config_who,
+DEFUN_NOSH (config_who,
        config_who_cmd,
        "who",
        "Display who is on vty\n")
@@ -2680,7 +2679,7 @@ DEFUN (config_who,
 }
 
 /* Move to vty configuration mode. */
-DEFUN (line_vty,
+DEFUN_NOSH (line_vty,
        line_vty_cmd,
        "line vty",
        "Configure a terminal line\n"
@@ -2870,7 +2869,7 @@ DEFUN (no_service_advanced_vty,
   return CMD_SUCCESS;
 }
 
-DEFUN (terminal_monitor,
+DEFUN_NOSH (terminal_monitor,
        terminal_monitor_cmd,
        "terminal monitor",
        "Set terminal line parameters\n"
@@ -2880,7 +2879,7 @@ DEFUN (terminal_monitor,
   return CMD_SUCCESS;
 }
 
-DEFUN (terminal_no_monitor,
+DEFUN_NOSH (terminal_no_monitor,
        terminal_no_monitor_cmd,
        "terminal no monitor",
        "Set terminal line parameters\n"
@@ -2891,7 +2890,7 @@ DEFUN (terminal_no_monitor,
   return CMD_SUCCESS;
 }
 
-DEFUN (no_terminal_monitor,
+DEFUN_NOSH (no_terminal_monitor,
        no_terminal_monitor_cmd,
        "no terminal monitor",
        NO_STR
@@ -2902,7 +2901,7 @@ DEFUN (no_terminal_monitor,
 }
 
 
-DEFUN (show_history,
+DEFUN_NOSH (show_history,
        show_history_cmd,
        "show history",
        SHOW_STR
@@ -3124,6 +3123,8 @@ vty_terminate (void)
       vty_reset ();
       vector_free (vtyvec);
       vector_free (Vvty_serv_thread);
+      vtyvec = NULL;
+      Vvty_serv_thread = NULL;
     }
 }