diff options
| author | David Lamparter <equinox@diac24.net> | 2018-08-16 16:39:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-16 16:39:40 +0200 |
| commit | 55d3dad27cad9e38c9bb9f70248661a06052c83a (patch) | |
| tree | e8e0fbac5155e5e50eee628f2c75f4ed074acb62 /zebra/zebra_mpls_openbsd.c | |
| parent | f5bffa5a7435696780d8a7f1ebe842e4cd7b3af4 (diff) | |
| parent | 633fc9b133b73aee6c828b20339ce0762664e3f0 (diff) | |
Merge pull request #2448 from qlyoung/error-reference-cards
Error Reference Cards
Diffstat (limited to 'zebra/zebra_mpls_openbsd.c')
| -rw-r--r-- | zebra/zebra_mpls_openbsd.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index 412fe7d3dd..542de27e83 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -31,6 +31,7 @@ #include "prefix.h" #include "interface.h" #include "log.h" +#include "lib_errors.h" extern struct zebra_privs_t zserv_privs; @@ -116,14 +117,13 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label, hdr.rtm_mpls = MPLS_OP_SWAP; } - if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_err("Can't raise privileges"); - ret = writev(kr_state.fd, iov, iovcnt); - if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_err("Can't lower privileges"); + frr_elevate_privs(&zserv_privs) { + ret = writev(kr_state.fd, iov, iovcnt); + } if (ret == -1) - zlog_err("%s: %s", __func__, safe_strerror(errno)); + flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__, + safe_strerror(errno)); return ret; } @@ -224,14 +224,13 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label, hdr.rtm_mpls = MPLS_OP_SWAP; } - if (zserv_privs.change(ZPRIVS_RAISE)) - zlog_err("Can't raise privileges"); - ret = writev(kr_state.fd, iov, iovcnt); - if (zserv_privs.change(ZPRIVS_LOWER)) - zlog_err("Can't lower privileges"); + frr_elevate_privs(&zserv_privs) { + ret = writev(kr_state.fd, iov, iovcnt); + } if (ret == -1) - zlog_err("%s: %s", __func__, safe_strerror(errno)); + flog_err_sys(LIB_ERR_SOCKET, "%s: %s", __func__, + safe_strerror(errno)); return ret; } @@ -360,8 +359,8 @@ static int kmpw_install(struct zebra_pw *pw) imr.imr_type = IMR_TYPE_ETHERNET_TAGGED; break; default: - zlog_err("%s: unhandled pseudowire type (%#X)", __func__, - pw->type); + zlog_warn("%s: unhandled pseudowire type (%#X)", __func__, + pw->type); return -1; } @@ -382,8 +381,8 @@ static int kmpw_install(struct zebra_pw *pw) sa_in6->sin6_addr = pw->nexthop.ipv6; break; default: - zlog_err("%s: unhandled pseudowire address-family (%u)", - __func__, pw->af); + zlog_warn("%s: unhandled pseudowire address-family (%u)", + __func__, pw->af); return -1; } memcpy(&imr.imr_nexthop, (struct sockaddr *)&ss, @@ -398,7 +397,8 @@ static int kmpw_install(struct zebra_pw *pw) strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name)); ifr.ifr_data = (caddr_t)&imr; if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) { - zlog_err("ioctl SIOCSETMPWCFG: %s", safe_strerror(errno)); + flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", + safe_strerror(errno)); return -1; } @@ -415,7 +415,8 @@ static int kmpw_uninstall(struct zebra_pw *pw) strlcpy(ifr.ifr_name, pw->ifname, sizeof(ifr.ifr_name)); ifr.ifr_data = (caddr_t)&imr; if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) { - zlog_err("ioctl SIOCSETMPWCFG: %s", safe_strerror(errno)); + flog_err_sys(LIB_ERR_SYSTEM_CALL, "ioctl SIOCSETMPWCFG: %s", + safe_strerror(errno)); return -1; } |
