* While this is bogus, privs are available and easy to use
* for this call as a workaround.
*/
- if (ripngd_privs.change(ZPRIVS_RAISE))
- zlog_ferr(
- 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))
- zlog_ferr(
- LIB_ERR_PRIVILEGES,
- "ripng_multicast_join: could not lower privs");
+ }
if (ret < 0 && save_errno == EADDRINUSE) {
/*
/* Join to multicast group. */
if (ripng_multicast_join(ifp) < 0) {
- zlog_ferr(LIB_ERR_SOCKET,
- "multicast join failed, interface %s not running",
- ifp->name);
+ flog_err_sys(LIB_ERR_SOCKET,
+ "multicast join failed, interface %s not running",
+ ifp->name);
return 0;
}