]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Treat vrf interface as loopback type
authorChirag Shah <chirag@cumulusnetworks.com>
Tue, 6 Mar 2018 20:55:59 +0000 (12:55 -0800)
committerChirag Shah <chirag@cumulusnetworks.com>
Thu, 8 Mar 2018 21:15:58 +0000 (13:15 -0800)
Ticket:CM-19914

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
lib/if.c
lib/if.h
ospfd/ospf_interface.c

index c00418bac1711f6a6dc0f46352b6a49e1c8da174..2541e6e45affd5893f278a532c06c54eb8c298ec 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -476,6 +476,12 @@ int if_is_loopback(struct interface *ifp)
        return (ifp->flags & (IFF_LOOPBACK | IFF_NOXMIT | IFF_VIRTUAL));
 }
 
+/* Check interface is VRF */
+int if_is_vrf(struct interface *ifp)
+{
+       return CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
+}
+
 /* Does this interface support broadcast ? */
 int if_is_broadcast(struct interface *ifp)
 {
index 30d7b4e37f7fdb5762fc2f3e1a5576cc0ccb9de9..7e23932a16bf917d5988300888df024035528db0 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -288,6 +288,7 @@ struct interface {
 
        QOBJ_FIELDS
 };
+
 RB_HEAD(if_name_head, interface);
 RB_PROTOTYPE(if_name_head, interface, name_entry, if_cmp_func);
 RB_HEAD(if_index_head, interface);
@@ -491,6 +492,7 @@ extern int if_is_running(struct interface *);
 extern int if_is_operative(struct interface *);
 extern int if_is_no_ptm_operative(struct interface *);
 extern int if_is_loopback(struct interface *);
+extern int if_is_vrf(struct interface *ifp);
 extern int if_is_broadcast(struct interface *);
 extern int if_is_pointopoint(struct interface *);
 extern int if_is_multicast(struct interface *);
index e19bfe7f553d9a91846277bdbb2b49a0be47f5e6..0305305b81917631d578603508a0fd6838e55165 100644 (file)
@@ -459,7 +459,7 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
                if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
                        continue;
 
-               if (if_is_loopback(oi->ifp))
+               if (if_is_loopback(oi->ifp) || if_is_vrf(oi->ifp))
                        continue;
 
                if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
@@ -703,7 +703,7 @@ static int ospf_if_delete_hook(struct interface *ifp)
 
 int ospf_if_is_enable(struct ospf_interface *oi)
 {
-       if (!if_is_loopback(oi->ifp))
+       if (!(if_is_loopback(oi->ifp) || if_is_vrf(oi->ifp)))
                if (if_is_up(oi->ifp))
                        return 1;
 
@@ -1206,7 +1206,7 @@ u_char ospf_default_iftype(struct interface *ifp)
 {
        if (if_is_pointopoint(ifp))
                return OSPF_IFTYPE_POINTOPOINT;
-       else if (if_is_loopback(ifp))
+       else if (if_is_loopback(ifp) || if_is_vrf(ifp))
                return OSPF_IFTYPE_LOOPBACK;
        else
                return OSPF_IFTYPE_BROADCAST;