diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-03-25 17:19:25 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-05-07 15:49:39 +0200 |
commit | e52a638341e9c02d08d9faf5def68d15c7bbf185 (patch) | |
tree | f1df66ffb654a2bbba6037b4200a06414a949eb6 /bfdd | |
parent | bfdd: remove the constraint of bfd vrf and multihop (diff) | |
download | frr-e52a638341e9c02d08d9faf5def68d15c7bbf185.tar.xz frr-e52a638341e9c02d08d9faf5def68d15c7bbf185.zip |
bfdd: socket creation in a vrf can be done
vrf_socket() call is performed instead of socket() call.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bfdd')
-rw-r--r-- | bfdd/bfd.h | 2 | ||||
-rw-r--r-- | bfdd/bfd_packet.c | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/bfdd/bfd.h b/bfdd/bfd.h index 5d7795d7f..36eea2433 100644 --- a/bfdd/bfd.h +++ b/bfdd/bfd.h @@ -49,6 +49,8 @@ DECLARE_MTYPE(BFDD_CONTROL); DECLARE_MTYPE(BFDD_SESSION_OBSERVER); DECLARE_MTYPE(BFDD_NOTIFICATION); +extern struct zebra_privs_t bfdd_privs; + struct bfd_timers { uint32_t desired_min_tx; uint32_t required_min_rx; diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 93677ec85..5b7db4f70 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -37,7 +37,6 @@ #include "bfd.h" - /* * Prototypes */ @@ -906,7 +905,10 @@ int bp_peer_socket(const struct bfd_session *bs) struct sockaddr_in sin; static int srcPort = BFD_SRCPORTINIT; - sd = socket(AF_INET, SOCK_DGRAM, PF_UNSPEC); + frr_elevate_privs(&bfdd_privs) { + sd = vrf_socket(AF_INET, SOCK_DGRAM, PF_UNSPEC, + bs->vrf->vrf_id, NULL); + } if (sd == -1) { log_error("ipv4-new: failed to create socket: %s", strerror(errno)); @@ -976,7 +978,10 @@ int bp_peer_socketv6(const struct bfd_session *bs) struct sockaddr_in6 sin6; static int srcPort = BFD_SRCPORTINIT; - sd = socket(AF_INET6, SOCK_DGRAM, PF_UNSPEC); + frr_elevate_privs(&bfdd_privs) { + sd = vrf_socket(AF_INET6, SOCK_DGRAM, PF_UNSPEC, + bs->vrf->vrf_id, NULL); + } if (sd == -1) { log_error("ipv6-new: failed to create socket: %s", strerror(errno)); |