]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_mpls_openbsd.c
Merge pull request #5789 from donaldsharp/bgp_ebgp_reason
[mirror_frr.git] / zebra / zebra_mpls_openbsd.c
index 72c8f73522116c41965231cb784fd661c93b4baa..5e18414985916d3d8a6e8549fe916289e8f1ef17 100644 (file)
@@ -27,6 +27,7 @@
 #include "zebra/zebra_mpls.h"
 #include "zebra/debug.h"
 #include "zebra/zebra_errors.h"
+#include "zebra/zebra_router.h"
 
 #include "privs.h"
 #include "prefix.h"
@@ -43,7 +44,7 @@ struct {
 } kr_state;
 
 static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
-                               zebra_nhlfe_t *nhlfe)
+                               const zebra_nhlfe_t *nhlfe)
 {
        struct iovec iov[5];
        struct rt_msghdr hdr;
@@ -118,7 +119,7 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
                        hdr.rtm_mpls = MPLS_OP_SWAP;
        }
 
-       frr_elevate_privs(&zserv_privs) {
+       frr_with_privs(&zserv_privs) {
                ret = writev(kr_state.fd, iov, iovcnt);
        }
 
@@ -135,7 +136,7 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
 #endif
 
 static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
-                               zebra_nhlfe_t *nhlfe)
+                               const zebra_nhlfe_t *nhlfe)
 {
        struct iovec iov[5];
        struct rt_msghdr hdr;
@@ -225,7 +226,7 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
                        hdr.rtm_mpls = MPLS_OP_SWAP;
        }
 
-       frr_elevate_privs(&zserv_privs) {
+       frr_with_privs(&zserv_privs) {
                ret = writev(kr_state.fd, iov, iovcnt);
        }
 
@@ -238,7 +239,7 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
 
 static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
 {
-       zebra_nhlfe_t *nhlfe;
+       const zebra_nhlfe_t *nhlfe;
        struct nexthop *nexthop = NULL;
        unsigned int nexthop_num = 0;
        int action;
@@ -262,7 +263,7 @@ static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
                if (!nexthop)
                        continue;
 
-               if (nexthop_num >= multipath_num)
+               if (nexthop_num >= zrouter.multipath_num)
                        break;
 
                if (((action == RTM_ADD || action == RTM_CHANGE)
@@ -301,7 +302,7 @@ static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
                }
        }
 
-       return (0);
+       return 0;
 }
 
 enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx)
@@ -342,7 +343,7 @@ static enum zebra_dplane_result kmpw_install(struct zebra_dplane_ctx *ctx)
 
        /* pseudowire nexthop */
        memset(&ss, 0, sizeof(ss));
-       gaddr = dplane_ctx_get_pw_nexthop(ctx);
+       gaddr = dplane_ctx_get_pw_dest(ctx);
        switch (dplane_ctx_get_pw_af(ctx)) {
        case AF_INET:
                sa_in->sin_family = AF_INET;
@@ -368,7 +369,7 @@ static enum zebra_dplane_result kmpw_install(struct zebra_dplane_ctx *ctx)
 
        /* ioctl */
        memset(&ifr, 0, sizeof(ifr));
-       strlcpy(ifr.ifr_name, dplane_ctx_get_pw_ifname(ctx),
+       strlcpy(ifr.ifr_name, dplane_ctx_get_ifname(ctx),
                sizeof(ifr.ifr_name));
        ifr.ifr_data = (caddr_t)&imr;
        if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
@@ -387,7 +388,7 @@ static enum zebra_dplane_result kmpw_uninstall(struct zebra_dplane_ctx *ctx)
 
        memset(&ifr, 0, sizeof(ifr));
        memset(&imr, 0, sizeof(imr));
-       strlcpy(ifr.ifr_name, dplane_ctx_get_pw_ifname(ctx),
+       strlcpy(ifr.ifr_name, dplane_ctx_get_ifname(ctx),
                sizeof(ifr.ifr_name));
        ifr.ifr_data = (caddr_t)&imr;
        if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
@@ -415,7 +416,7 @@ enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx)
                break;
        default:
                break;
-       };
+       }
 
        return result;
 }