mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
Merge pull request #1843 from chiragshah6/ospf_vrf_dev
zebra/ospfd: Treat vrf interface similar to loopback
This commit is contained in:
commit
1ffd1bcf86
6
lib/if.c
6
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)
|
||||
{
|
||||
|
2
lib/if.h
2
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 *);
|
||||
|
@ -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;
|
||||
|
@ -73,7 +73,8 @@ static void connected_announce(struct interface *ifp, struct connected *ifc)
|
||||
if (!ifc)
|
||||
return;
|
||||
|
||||
if (!if_is_loopback(ifp) && ifc->address->family == AF_INET) {
|
||||
if (!if_is_loopback(ifp) && ifc->address->family == AF_INET &&
|
||||
!IS_ZEBRA_IF_VRF(ifp)) {
|
||||
if (ifc->address->prefixlen == 32)
|
||||
SET_FLAG(ifc->flags, ZEBRA_IFA_UNNUMBERED);
|
||||
else
|
||||
|
@ -649,8 +649,6 @@ static int netlink_interface(struct sockaddr_nl *snl, struct nlmsghdr *h,
|
||||
ifp = if_get_by_name(name, vrf_id, 0);
|
||||
set_ifindex(ifp, ifi->ifi_index, zns);
|
||||
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
||||
if (IS_ZEBRA_IF_VRF(ifp))
|
||||
SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
|
||||
ifp->mtu6 = ifp->mtu = *(uint32_t *)RTA_DATA(tb[IFLA_MTU]);
|
||||
ifp->metric = 0;
|
||||
ifp->speed = get_iflink_speed(ifp);
|
||||
@ -661,6 +659,8 @@ static int netlink_interface(struct sockaddr_nl *snl, struct nlmsghdr *h,
|
||||
|
||||
/* Set zebra interface type */
|
||||
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
|
||||
if (IS_ZEBRA_IF_VRF(ifp))
|
||||
SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
|
||||
|
||||
/* Update link. */
|
||||
zebra_if_update_link(ifp, link_ifindex);
|
||||
@ -1143,15 +1143,15 @@ int netlink_link_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
|
||||
/* Update interface information. */
|
||||
set_ifindex(ifp, ifi->ifi_index, zns);
|
||||
ifp->flags = ifi->ifi_flags & 0x0000fffff;
|
||||
if (IS_ZEBRA_IF_VRF(ifp))
|
||||
SET_FLAG(ifp->status,
|
||||
ZEBRA_INTERFACE_VRF_LOOPBACK);
|
||||
ifp->mtu6 = ifp->mtu = *(int *)RTA_DATA(tb[IFLA_MTU]);
|
||||
ifp->metric = 0;
|
||||
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
|
||||
|
||||
/* Set interface type */
|
||||
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
|
||||
if (IS_ZEBRA_IF_VRF(ifp))
|
||||
SET_FLAG(ifp->status,
|
||||
ZEBRA_INTERFACE_VRF_LOOPBACK);
|
||||
|
||||
/* Update link. */
|
||||
zebra_if_update_link(ifp, link_ifindex);
|
||||
|
Loading…
Reference in New Issue
Block a user