diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2018-08-10 18:36:43 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-14 22:02:05 +0200 |
commit | 01b9e3fd0d354d7d4c60b1c0240f269a4fd08990 (patch) | |
tree | 7758a10d2c803e86348e04e908f73b63c0048b96 /ripngd/ripng_interface.c | |
parent | lib: add frr_elevate_privs() wrapper (diff) | |
download | frr-01b9e3fd0d354d7d4c60b1c0240f269a4fd08990.tar.xz frr-01b9e3fd0d354d7d4c60b1c0240f269a4fd08990.zip |
*: use frr_elevate_privs() (1/2: coccinelle)
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'ripngd/ripng_interface.c')
-rw-r--r-- | ripngd/ripng_interface.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 006389302..ef324b001 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -72,19 +72,14 @@ static int ripng_multicast_join(struct interface *ifp) * While this is bogus, privs are available and easy to use * for this call as a workaround. */ - if (ripngd_privs.change(ZPRIVS_RAISE)) - flog_err( - LIB_ERR_PRIVILEGES, - "ripng_multicast_join: could not raise privs"); + frr_elevate_privs(&ripngd_privs) { - ret = setsockopt(ripng->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, - (char *)&mreq, sizeof(mreq)); - save_errno = errno; + ret = setsockopt(ripng->sock, IPPROTO_IPV6, + IPV6_JOIN_GROUP, + (char *)&mreq, sizeof(mreq)); + save_errno = errno; - if (ripngd_privs.change(ZPRIVS_LOWER)) - flog_err( - LIB_ERR_PRIVILEGES, - "ripng_multicast_join: could not lower privs"); + } if (ret < 0 && save_errno == EADDRINUSE) { /* |