diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-04-08 18:08:00 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-04-08 18:11:28 +0200 |
commit | 338b8e914ab1dc30f56f5bcbabd525d547bbc1ea (patch) | |
tree | 472af15e5b3fbdf331da8b18ff653cfa24fe2784 /eigrpd/eigrp_network.c | |
parent | Merge pull request #4101 from pacovn/doc_typo1 (diff) | |
download | frr-338b8e914ab1dc30f56f5bcbabd525d547bbc1ea.tar.xz frr-338b8e914ab1dc30f56f5bcbabd525d547bbc1ea.zip |
*: setting the socket send/recv buffer sizes doesn't need elevated privs
The less code running under elevated privileges the better.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'eigrpd/eigrp_network.c')
-rw-r--r-- | eigrpd/eigrp_network.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index 76f8cfc93..bbb9487b4 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -108,7 +108,6 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen) /* Check if any work has to be done at all. */ if (eigrp->maxsndbuflen >= buflen) return; - frr_elevate_privs(&eigrpd_privs) { /* Now we try to set SO_SNDBUF to what our caller has requested * (the MTU of a newly added interface). However, if the OS has @@ -117,16 +116,15 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen) * may allocate more buffer space, than requested, this isn't * a error. */ - setsockopt_so_sendbuf(eigrp->fd, buflen); - newbuflen = getsockopt_so_sendbuf(eigrp->fd); - if (newbuflen < 0 || newbuflen < (int)buflen) - zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", - __func__, buflen, newbuflen); - if (newbuflen >= 0) - eigrp->maxsndbuflen = (unsigned int)newbuflen; - else - zlog_warn("%s: failed to get SO_SNDBUF", __func__); - } + setsockopt_so_sendbuf(eigrp->fd, buflen); + newbuflen = getsockopt_so_sendbuf(eigrp->fd); + if (newbuflen < 0 || newbuflen < (int)buflen) + zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", + __func__, buflen, newbuflen); + if (newbuflen >= 0) + eigrp->maxsndbuflen = (unsigned int)newbuflen; + else + zlog_warn("%s: failed to get SO_SNDBUF", __func__); } int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, |