summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2021-01-08 08:51:33 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2021-01-09 14:07:18 +0100
commit031705c9fc046f05560a2fa3926ead9bc99c96ae (patch)
tree6472a540569e76c43a6075f596ff7c984a291ff0 /bfdd
parentMerge pull request #7839 from ton31337/feature/print_large-community_dump (diff)
downloadfrr-031705c9fc046f05560a2fa3926ead9bc99c96ae.tar.xz
frr-031705c9fc046f05560a2fa3926ead9bc99c96ae.zip
bfdd: socket should be bound to vrf interface by default
When running in vrf-lite mode, the socket used in a vrf environment should be bound to an interface belonging to the vrf. If no one is selected, then the vrf interface itself should be bound to that socket, so that outgoing packets are being applied routing rules for that vrf. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd_packet.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c
index 0a71c18a4..10b99a62a 100644
--- a/bfdd/bfd_packet.c
+++ b/bfdd/bfd_packet.c
@@ -951,8 +951,9 @@ int bp_peer_socket(const struct bfd_session *bs)
if (bs->key.ifname[0])
device_to_bind = (const char *)bs->key.ifname;
- else if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)
- && bs->key.vrfname[0])
+ else if ((!vrf_is_backend_netns() && bs->vrf->vrf_id != VRF_DEFAULT)
+ || ((CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)
+ && bs->key.vrfname[0])))
device_to_bind = (const char *)bs->key.vrfname;
frr_with_privs(&bglobal.bfdd_privs) {
@@ -1018,8 +1019,9 @@ int bp_peer_socketv6(const struct bfd_session *bs)
if (bs->key.ifname[0])
device_to_bind = (const char *)bs->key.ifname;
- else if (CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)
- && bs->key.vrfname[0])
+ else if ((!vrf_is_backend_netns() && bs->vrf->vrf_id != VRF_DEFAULT)
+ || ((CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH)
+ && bs->key.vrfname[0])))
device_to_bind = (const char *)bs->key.vrfname;
frr_with_privs(&bglobal.bfdd_privs) {