summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2023-01-17 09:31:37 -0500
committerGitHub <noreply@github.com>2023-01-17 09:31:37 -0500
commit00d7261e203a6f9426f7ced1c1b940fc9191fe2b (patch)
tree71ebfcf88cf088a6c7ca5d9b10faa3076771eb1e /lib/if.c
parentc542606e5648d6d22dc470fe5492f8c81b01ba6b (diff)
parent8a02d9fe1e167bc57bcf8f8968107a739b41b654 (diff)
Merge pull request #12636 from opensourcerouting/fix/bgp_accept-own_connected_routes
bgpd: Allow importing local routes with accept-own mechanism
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index 70c0c18141..db73210036 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -564,6 +564,20 @@ size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
return count;
}
+/* Get the VRF loopback interface, i.e. the loopback on the default VRF
+ * or the VRF interface.
+ */
+struct interface *if_get_vrf_loopback(vrf_id_t vrf_id)
+{
+ struct interface *ifp = NULL;
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
+
+ FOR_ALL_INTERFACES (vrf, ifp)
+ if (if_is_loopback(ifp))
+ return ifp;
+
+ return NULL;
+}
/* Get interface by name if given name interface doesn't exist create
one. */