summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2018-03-10 04:03:41 +0000
committervivek <vivek@cumulusnetworks.com>2018-03-10 04:03:41 +0000
commit4e262455a252c700f81df75fb8107d112062bba8 (patch)
treefbd55c66eebe78ccb60424e560548d1613aa403a /lib/if.c
parentbfd498f0dab9a1937c6036cd35ed020b64a69e8f (diff)
parent58e7db106d5907cb129fcc316f02ce0bf34e3885 (diff)
Merge branch 'master' of https://github.com/frrouting/frr into evpn-ipv6-tenant-routing
Conflicts: bgpd/bgp_evpn.c
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/if.c b/lib/if.c
index 3a83de46ae..2541e6e45a 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -48,8 +48,8 @@ RB_GENERATE(if_index_head, interface, index_entry, if_cmp_index_func);
DEFINE_QOBJ_TYPE(interface)
-DEFINE_HOOK(if_add, (struct interface *ifp), (ifp))
-DEFINE_KOOH(if_del, (struct interface *ifp), (ifp))
+DEFINE_HOOK(if_add, (struct interface * ifp), (ifp))
+DEFINE_KOOH(if_del, (struct interface * ifp), (ifp))
/* List of interfaces in only the default VRF */
int ptm_enable = 0;
@@ -152,7 +152,7 @@ struct interface *if_create(const char *name, vrf_id_t vrf_id)
SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
QOBJ_REG(ifp, interface);
- hook_call(if_add, ifp);
+ hook_call(if_add, ifp);
return ifp;
}
@@ -181,7 +181,7 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id)
/* Delete interface structure. */
void if_delete_retain(struct interface *ifp)
{
- hook_call(if_del, ifp);
+ hook_call(if_del, ifp);
QOBJ_UNREG(ifp);
/* Free connected address list */
@@ -225,7 +225,7 @@ struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id)
if (vrf_id == VRF_UNKNOWN) {
struct interface *ifp;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
ifp = if_lookup_by_index(ifindex, vrf->vrf_id);
if (ifp)
return ifp;
@@ -404,8 +404,7 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, int vty)
* this should not be considered as an update
* then create the new interface
*/
- if (ifp->vrf_id != vrf_id &&
- vrf_is_mapped_on_netns(vrf_id))
+ if (ifp->vrf_id != vrf_id && vrf_is_mapped_on_netns(vrf_id))
return if_create(name, vrf_id);
/* If it came from the kernel
* or by way of zclient, believe it and update
@@ -477,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)
{