]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/vici.c
nhrpd: Add NHRP_ERR_XXXX for zlog_err to zlog_ferr conversion
[mirror_frr.git] / nhrpd / vici.c
index eb3827a12fdda935fea7773bd03999e0da29fc14..dae29e535acc0992b1d470014029b4059119685b 100644 (file)
 #include "thread.h"
 #include "zbuf.h"
 #include "log.h"
-#include "nhrpd.h"
+#include "lib_errors.h"
 
+#include "nhrpd.h"
 #include "vici.h"
+#include "nhrp_errors.h"
 
 #define ERRNO_IO_RETRY(EN) (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR))
 
@@ -212,9 +214,9 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
                                        if (str2sockunion(buf,
                                                          &sactx->local.host)
                                            < 0)
-                                               zlog_err(
-                                                       "VICI: bad strongSwan local-host: %s",
-                                                       buf);
+                                               zlog_ferr(NHRP_ERR_SWAN,
+                                                         "VICI: bad strongSwan local-host: %s",
+                                                         buf);
                        } else if (blob_equal(key, "local-id")
                                   && ctx->nsections == 1) {
                                sactx->local.id = *val;
@@ -230,9 +232,9 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
                                        if (str2sockunion(buf,
                                                          &sactx->remote.host)
                                            < 0)
-                                               zlog_err(
-                                                       "VICI: bad strongSwan remote-host: %s",
-                                                       buf);
+                                               zlog_ferr(NHRP_ERR_SWAN,
+                                                         "VICI: bad strongSwan remote-host: %s",
+                                                         buf);
                        } else if (blob_equal(key, "remote-id")
                                   && ctx->nsections == 1) {
                                sactx->remote.id = *val;
@@ -275,7 +277,7 @@ static void parse_cmd_response(struct vici_message_ctx *ctx,
        case VICI_KEY_VALUE:
                if (blob_equal(key, "errmsg")
                    && blob2buf(val, buf, sizeof(buf)))
-                       zlog_err("VICI: strongSwan: %s", buf);
+                       zlog_ferr(NHRP_ERR_SWAN, "VICI: strongSwan: %s", buf);
                break;
        default:
                break;
@@ -334,7 +336,7 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
                break;
        case VICI_EVENT_UNKNOWN:
        case VICI_CMD_UNKNOWN:
-               zlog_err(
+               zlog_ferr(NHRP_ERR_SWAN,
                        "VICI: StrongSwan does not support mandatory events (unpatched?)");
                break;
        case VICI_EVENT_CONFIRM: