summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/if.c b/lib/if.c
index 3425e3a8b1..b3decf3be9 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -38,6 +38,7 @@
/* Master list of interfaces. */
struct list *iflist;
+int ptm_enable = 0;
/* One for each program. This structure is needed to store hooks. */
struct if_master
@@ -373,12 +374,25 @@ if_is_running (struct interface *ifp)
}
/* Is the interface operative, eg. either UP & RUNNING
- or UP & !ZEBRA_INTERFACE_LINK_DETECTION */
+ or UP & !ZEBRA_INTERFACE_LINK_DETECTION and
+ if ptm checking is enabled, then ptm check has passed */
int
if_is_operative (struct interface *ifp)
{
return ((ifp->flags & IFF_UP) &&
- (ifp->flags & IFF_RUNNING || !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)));
+ (((ifp->flags & IFF_RUNNING) &&
+ (ifp->ptm_status || !ifp->ptm_enable)) ||
+ !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)));
+}
+
+/* Is the interface operative, eg. either UP & RUNNING
+ or UP & !ZEBRA_INTERFACE_LINK_DETECTION, without PTM check */
+int
+if_is_no_ptm_operative (struct interface *ifp)
+{
+ return ((ifp->flags & IFF_UP) &&
+ ((ifp->flags & IFF_RUNNING) ||
+ !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)));
}
/* Is this loopback interface ? */