]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/vici.c
zebra: Convert socket interface to use `union sockunion`
[mirror_frr.git] / nhrpd / vici.c
index 3bb0d8308ecbb94c1574eadbf57e7ca486985883..3de4609a2bc435966bbb18d6881b370db08b14d7 100644 (file)
@@ -7,6 +7,10 @@
  * (at your option) any later version.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #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,7 +218,8 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
                                        if (str2sockunion(buf,
                                                          &sactx->local.host)
                                            < 0)
-                                               zlog_err(
+                                               flog_err(
+                                                       EC_NHRP_SWAN,
                                                        "VICI: bad strongSwan local-host: %s",
                                                        buf);
                        } else if (blob_equal(key, "local-id")
@@ -230,7 +237,8 @@ static void parse_sa_message(struct vici_message_ctx *ctx,
                                        if (str2sockunion(buf,
                                                          &sactx->remote.host)
                                            < 0)
-                                               zlog_err(
+                                               flog_err(
+                                                       EC_NHRP_SWAN,
                                                        "VICI: bad strongSwan remote-host: %s",
                                                        buf);
                        } else if (blob_equal(key, "remote-id")
@@ -275,7 +283,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);
+                       flog_err(EC_NHRP_SWAN, "VICI: strongSwan: %s", buf);
                break;
        default:
                break;
@@ -306,7 +314,7 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
        uint32_t msglen;
        uint8_t msgtype;
        struct blob name;
-       struct vici_message_ctx ctx;
+       struct vici_message_ctx ctx = { .nsections = 0 };
 
        msglen = zbuf_get_be32(msg);
        msgtype = zbuf_get8(msg);
@@ -334,7 +342,8 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
                break;
        case VICI_EVENT_UNKNOWN:
        case VICI_CMD_UNKNOWN:
-               zlog_err(
+               flog_err(
+                       EC_NHRP_SWAN,
                        "VICI: StrongSwan does not support mandatory events (unpatched?)");
                break;
        case VICI_EVENT_CONFIRM: