]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Add LIB_ERR_VTY
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 14 Jun 2018 13:21:11 +0000 (09:21 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 14 Aug 2018 20:02:05 +0000 (20:02 +0000)
Add a error code for when the vty subsystem detects
an error.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/lib_errors.c
lib/lib_errors.h
lib/vty.c

index f9bfa17b2eed1254b5aa0cbb0ab32b55e1e84d05..0c36d801d8fb5e4ea17f45c8d77f765b8b6d0459 100644 (file)
@@ -64,6 +64,12 @@ static struct ferr_ref ferr_lib_err[] = {
                .description = "FRR has detected a error from using a vital system call and has probably\nalready exited",
                .suggestion = "Ensure permissions are correct for FRR and FRR user and groups are correct\nAdditionally check that system resources are still available"
        },
+       {
+               .code = LIB_ERR_VTY,
+               .title = "VTY subsystem Error",
+               .description = "FRR has detected a problem with the specified configuration file",
+               .suggestion = "Ensure configuration file exists and has correct permissions for operations\nAdditionally ensure that all config lines are correct as well",
+       },
        {
                .code = END_FERR,
        }
index 24521a6008c09c504dcf0fdeb51dabbed4af3d58..3b5eb577b134375618544d5643fc8835df880c0f 100644 (file)
@@ -31,6 +31,7 @@ enum lib_ferr_refs {
        LIB_ERR_ZAPI_ENCODE,
        LIB_ERR_ZAPI_SOCKET,
        LIB_ERR_SYSTEM_CALL,
+       LIB_ERR_VTY,
 };
 
 extern void lib_error_init(void);
index 0b431a5c7f22a841ac7ecd641fc2c5ffe89ef4b3..d591ef4b5bfe344b7fa670939296bce54b4d0af4 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -40,6 +40,7 @@
 #include "network.h"
 #include "libfrr.h"
 #include "frrstr.h"
+#include "lib_errors.h"
 
 #include <arpa/telnet.h>
 #include <termios.h>
@@ -2412,8 +2413,9 @@ static void vty_read_file(FILE *confp)
                nl = strchr(vty->error_buf, '\n');
                if (nl)
                        *nl = '\0';
-               zlog_err("ERROR: %s on config line %u: %s", message, line_num,
-                        vty->error_buf);
+               zlog_ferr(LIB_ERR_VTY,
+                         "ERROR: %s on config line %u: %s", message, line_num,
+                         vty->error_buf);
        }
 
        vty_close(vty);
@@ -2509,8 +2511,9 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
                                zlog_warn(
                                        "WARNING: using backup configuration file!");
                        else {
-                               zlog_err("can't open configuration file [%s]",
-                                        config_file);
+                               zlog_ferr(LIB_ERR_VTY,
+                                         "can't open configuration file [%s]",
+                                         config_file);
                                exit(1);
                        }
                }
@@ -2556,8 +2559,9 @@ bool vty_read_config(const char *config_file, char *config_default_dir)
                                        "WARNING: using backup configuration file!");
                                fullpath = config_default_dir;
                        } else {
-                               zlog_err("can't open configuration file [%s]",
-                                        config_default_dir);
+                               zlog_ferr(LIB_ERR_VTY,
+                                         "can't open configuration file [%s]",
+                                         config_default_dir);
                                goto tmp_free_and_out;
                        }
                } else