]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/irdp_main.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / zebra / irdp_main.c
index 39e04480c6d8ef6f73cb22594ca934fa0af3b38c..9300ba6034f888ad41980ebbfe049ad94e38d6fd 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 /*
- * Thanks to Jens Låås at Swedish University of Agricultural Sciences
+ * Thanks to Jens Laas at Swedish University of Agricultural Sciences
  * for reviewing and tests.
  */
 
@@ -51,6 +51,7 @@
 #include "thread.h"
 #include "privs.h"
 #include "libfrr.h"
+#include "lib_errors.h"
 #include "version.h"
 #include "zebra/interface.h"
 #include "zebra/rtadv.h"
@@ -58,6 +59,7 @@
 #include "zebra/zserv.h"
 #include "zebra/redistribute.h"
 #include "zebra/irdp.h"
+#include "zebra/zebra_errors.h"
 #include <netinet/ip_icmp.h>
 
 #include "checksum.h"
@@ -80,36 +82,32 @@ int irdp_sock_init(void)
        int save_errno;
        int sock;
 
-       if (zserv_privs.change(ZPRIVS_RAISE))
-               zlog_err("irdp_sock_init: could not raise privs, %s",
-                        safe_strerror(errno));
+       frr_elevate_privs(&zserv_privs) {
 
-       sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-       save_errno = errno;
+               sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+               save_errno = errno;
 
-       if (zserv_privs.change(ZPRIVS_LOWER))
-               zlog_err("irdp_sock_init: could not lower privs, %s",
-                        safe_strerror(errno));
+       }
 
        if (sock < 0) {
-               zlog_warn("IRDP: can't create irdp socket %s",
-                         safe_strerror(save_errno));
+               flog_err_sys(EC_LIB_SOCKET, "IRDP: can't create irdp socket %s",
+                            safe_strerror(save_errno));
                return sock;
        };
 
        i = 1;
        ret = setsockopt(sock, IPPROTO_IP, IP_TTL, (void *)&i, sizeof(i));
        if (ret < 0) {
-               zlog_warn("IRDP: can't do irdp sockopt %s",
-                         safe_strerror(errno));
+               flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
+                            safe_strerror(errno));
                close(sock);
                return ret;
        };
 
        ret = setsockopt_ifindex(AF_INET, sock, 1);
        if (ret < 0) {
-               zlog_warn("IRDP: can't do irdp sockopt %s",
-                         safe_strerror(errno));
+               flog_err_sys(EC_LIB_SOCKET, "IRDP: can't do irdp sockopt %s",
+                            safe_strerror(errno));
                close(sock);
                return ret;
        };
@@ -146,7 +144,7 @@ static int make_advertisement_packet(struct interface *ifp, struct prefix *p,
        struct irdp_interface *irdp = zi->irdp;
        int size;
        int pref;
-       u_int16_t checksum;
+       uint16_t checksum;
 
        pref = get_pref(irdp, p);
 
@@ -177,8 +175,8 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)
        struct zebra_if *zi = ifp->info;
        struct irdp_interface *irdp = zi->irdp;
        char buf[PREFIX_STRLEN];
-       u_int32_t dst;
-       u_int32_t ttl = 1;
+       uint32_t dst;
+       uint32_t ttl = 1;
 
        if (!irdp)
                return;
@@ -210,7 +208,7 @@ static void irdp_advertisement(struct interface *ifp, struct prefix *p)
 
 int irdp_send_thread(struct thread *t_advert)
 {
-       u_int32_t timer, tmp;
+       uint32_t timer, tmp;
        struct interface *ifp = THREAD_ARG(t_advert);
        struct zebra_if *zi = ifp->info;
        struct irdp_interface *irdp = zi->irdp;
@@ -288,7 +286,7 @@ void process_solicit(struct interface *ifp)
 {
        struct zebra_if *zi = ifp->info;
        struct irdp_interface *irdp = zi->irdp;
-       u_int32_t timer;
+       uint32_t timer;
 
        if (!irdp)
                return;