summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-08-24 04:19:02 +0200
committerGitHub <noreply@github.com>2018-08-24 04:19:02 +0200
commitff0c9e7a0abf46750b40a41464ecd7aabea0e97c (patch)
treed2be957988ae75889b55dd385d45916f7b237c7c /lib
parent3391232343ee5a92b17755bd29d3a246a660f3be (diff)
parentfec4ca191ef4e7d9576feba756f728b21819ec45 (diff)
Merge pull request #2896 from dslicenc/zebra_select_vrf
zebra: if multiple connecteds, select loopback or vrf if present
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c8
-rw-r--r--lib/if.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index 943436f356..2bf0c6e6b5 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -472,6 +472,14 @@ int if_is_vrf(struct interface *ifp)
return CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK);
}
+bool if_is_loopback_or_vrf(struct interface *ifp)
+{
+ if (if_is_loopback(ifp) || if_is_vrf(ifp))
+ return true;
+
+ return false;
+}
+
/* Does this interface support broadcast ? */
int if_is_broadcast(struct interface *ifp)
{
diff --git a/lib/if.h b/lib/if.h
index 3a9c4af848..a861cf2d85 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -497,6 +497,7 @@ 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 bool if_is_loopback_or_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 *);