summaryrefslogtreecommitdiffstats
path: root/pimd/pim_msdp_socket.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2018-08-10 18:46:07 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commit6bb30c2cbaed955383758c64cf51382dd1978cb9 (patch)
tree156023fc555eda4843d96a708e1e115fddfba927 /pimd/pim_msdp_socket.c
parent*: use frr_elevate_privs() (1/2: coccinelle) (diff)
downloadfrr-6bb30c2cbaed955383758c64cf51382dd1978cb9.tar.xz
frr-6bb30c2cbaed955383758c64cf51382dd1978cb9.zip
*: use frr_elevate_privs() (2/2: manual)
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'pimd/pim_msdp_socket.c')
-rw-r--r--pimd/pim_msdp_socket.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c
index b0e7b39d7..feac42cf5 100644
--- a/pimd/pim_msdp_socket.c
+++ b/pimd/pim_msdp_socket.c
@@ -176,19 +176,9 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
}
}
- if (pimd_privs.change(ZPRIVS_RAISE)) {
- flog_err(LIB_ERR_PRIVILEGES,
- "pim_msdp_socket: could not raise privs, %s",
- safe_strerror(errno));
- }
-
- /* bind to well known TCP port */
- rc = bind(sock, (struct sockaddr *)&sin, socklen);
-
- if (pimd_privs.change(ZPRIVS_LOWER)) {
- flog_err(LIB_ERR_PRIVILEGES,
- "pim_msdp_socket: could not lower privs, %s",
- safe_strerror(errno));
+ frr_elevate_privs(&pimd_privs) {
+ /* bind to well known TCP port */
+ rc = bind(sock, (struct sockaddr *)&sin, socklen);
}
if (rc < 0) {