]> git.proxmox.com Git - mirror_frr.git/blobdiff - babeld/babeld.c
zebra: Convert socket interface to use `union sockunion`
[mirror_frr.git] / babeld / babeld.c
index 20dd098f33026754713b51f3b2c642c570ea5257..0517cbea6d5a9e9f2a1c864a3d071823981f96e9 100644 (file)
@@ -29,6 +29,7 @@ THE SOFTWARE.
 #include "prefix.h"
 #include "filter.h"
 #include "plist.h"
+#include "lib_errors.h"
 
 #include "babel_main.h"
 #include "babeld.h"
@@ -43,6 +44,7 @@ THE SOFTWARE.
 #include "babel_filter.h"
 #include "babel_zebra.h"
 #include "babel_memory.h"
+#include "babel_errors.h"
 
 static int babel_init_routing_process(struct thread *thread);
 static void babel_get_myid(void);
@@ -143,7 +145,8 @@ babel_create_routing_process (void)
     /* Make socket for Babel protocol. */
     protocol_socket = babel_socket(protocol_port);
     if (protocol_socket < 0) {
-        zlog_err("Couldn't create link local socket: %s", safe_strerror(errno));
+        flog_err_sys(EC_LIB_SOCKET, "Couldn't create link local socket: %s",
+                 safe_strerror(errno));
         goto fail;
     }
 
@@ -176,7 +179,7 @@ babel_read_protocol (struct thread *thread)
                     (struct sockaddr*)&sin6, sizeof(sin6));
     if(rc < 0) {
         if(errno != EAGAIN && errno != EINTR) {
-            zlog_err("recv: %s", safe_strerror(errno));
+            flog_err_sys(EC_LIB_SOCKET, "recv: %s", safe_strerror(errno));
         }
     } else {
         FOR_ALL_INTERFACES(vrf, ifp) {
@@ -252,11 +255,13 @@ babel_get_myid(void)
         return;
     }
 
-    zlog_err("Warning: couldn't find router id -- using random value.");
+    flog_err(EC_BABEL_CONFIG,
+             "Warning: couldn't find router id -- using random value.");
 
     rc = read_random_bytes(myid, 8);
     if(rc < 0) {
-        zlog_err("read(random): %s (cannot assign an ID)",safe_strerror(errno));
+        flog_err(EC_BABEL_CONFIG, "read(random): %s (cannot assign an ID)",
+                 safe_strerror(errno));
         exit(1);
     }
     /* Clear group and global bits */
@@ -514,7 +519,8 @@ resize_receive_buffer(int size)
     if(receive_buffer == NULL) {
         receive_buffer = malloc(size);
         if(receive_buffer == NULL) {
-            zlog_err("malloc(receive_buffer): %s", safe_strerror(errno));
+            flog_err(EC_BABEL_MEMORY, "malloc(receive_buffer): %s",
+                     safe_strerror(errno));
             return -1;
         }
         receive_buffer_size = size;
@@ -522,7 +528,8 @@ resize_receive_buffer(int size)
         unsigned char *new;
         new = realloc(receive_buffer, size);
         if(new == NULL) {
-            zlog_err("realloc(receive_buffer): %s", safe_strerror(errno));
+            flog_err(EC_BABEL_MEMORY, "realloc(receive_buffer): %s",
+                     safe_strerror(errno));
             return -1;
         }
         receive_buffer = new;