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/bfd_packet.c | |
| parent | 5764d816d370aebad1da4281177bbb15ea7f748e (diff) | |
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/bfd_packet.c')
| -rw-r--r-- | bfdd/bfd_packet.c | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 93677ec85a..5b7db4f709 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));  | 
