diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-21 15:27:44 +0100 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-21 22:33:48 +0100 |
commit | 1ef00571f89f0899c88f63aa7350b90913e42bb3 (patch) | |
tree | f26f6a405941964bcf6b5859eaca157bc72b19aa /ldpd | |
parent | Merge pull request #3499 from donaldsharp/topotest_inheritance (diff) | |
download | frr-1ef00571f89f0899c88f63aa7350b90913e42bb3.tar.xz frr-1ef00571f89f0899c88f63aa7350b90913e42bb3.zip |
ldpd: add support for FreeBSD IP_BINDANY
Add yet another way to setsockopt a socket to listen to a foreign
address.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/socket.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ldpd/socket.c b/ldpd/socket.c index bebd7a7d6..78a07b1ed 100644 --- a/ldpd/socket.c +++ b/ldpd/socket.c @@ -268,9 +268,18 @@ sock_set_bindany(int fd, int enable) return (-1); } return (0); +#elif defined(IP_BINDANY) + frr_elevate_privs(&ldpd_privs) { + if (setsockopt(fd, IPPROTO_IP, IP_BINDANY, &enable, sizeof(int)) + < 0) { + log_warn("%s: error setting IP_BINDANY", __func__); + return (-1); + } + } #else - log_warnx("%s: missing SO_BINDANY and IP_FREEBIND, unable to bind " - "to a nonlocal IP address", __func__); + log_warnx( + "%s: missing SO_BINDANY, IP_FREEBIND and IP_BINDANY, unable to bind to a nonlocal IP address", + __func__); return (-1); #endif /* HAVE_SO_BINDANY */ } |