ospfd: Treat vrf interface as loopback type

Ticket:CM-19914

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
Chirag Shah 2018-03-06 12:55:59 -08:00
parent b0fa6f6a10
commit 0c74bbe03e
3 changed files with 11 additions and 3 deletions

View File

@ -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)
{

View File

@ -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 *);

View 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;