diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-21 23:59:18 +0100 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-22 00:00:53 +0100 |
commit | f43be00b6aa130e515479a95f89f0d103a9b0614 (patch) | |
tree | 38d7044e832368b67e04115ac343e0fa84c25bac /ldpd/ldpe.c | |
parent | zebra: fix compilation on OpenBSD (diff) | |
download | frr-f43be00b6aa130e515479a95f89f0d103a9b0614.tar.xz frr-f43be00b6aa130e515479a95f89f0d103a9b0614.zip |
ldpd: fix startup on OpenBSD
We must open the PF_KEY socket before dropping privileges, otherwise the
socket creation will fail with permission problems.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'ldpd/ldpe.c')
-rw-r--r-- | ldpd/ldpe.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 56af76d94..c16d92f28 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -139,6 +139,16 @@ ldpe(void) void ldpe_init(struct ldpd_init *init) { +#ifdef __OpenBSD__ + /* This socket must be open before dropping privileges. */ + global.pfkeysock = pfkey_init(); + if (sysdep.no_pfkey == 0) { + pfkey_ev = NULL; + thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, + &pfkey_ev); + } +#endif + /* drop privileges */ ldpe_privs.user = init->user; ldpe_privs.group = init->group; @@ -159,14 +169,6 @@ ldpe_init(struct ldpd_init *init) fatal("inet_pton"); if (inet_pton(AF_INET6, AllRouters_v6, &global.mcast_addr_v6) != 1) fatal("inet_pton"); -#ifdef __OpenBSD__ - global.pfkeysock = pfkey_init(); - if (sysdep.no_pfkey == 0) { - pfkey_ev = NULL; - thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, - &pfkey_ev); - } -#endif /* mark sockets as closed */ global.ipv4.ldp_disc_socket = -1; |