diff options
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -436,13 +436,13 @@ void if_set_index(struct interface *ifp, ifindex_t ifindex) } /* Does interface up ? */ -int if_is_up(struct interface *ifp) +int if_is_up(const struct interface *ifp) { return ifp->flags & IFF_UP; } /* Is interface running? */ -int if_is_running(struct interface *ifp) +int if_is_running(const struct interface *ifp) { return ifp->flags & IFF_RUNNING; } @@ -450,7 +450,7 @@ int if_is_running(struct interface *ifp) /* Is the interface operative, eg. either UP & RUNNING or UP & !ZEBRA_INTERFACE_LINK_DETECTION and if ptm checking is enabled, then ptm check has passed */ -int if_is_operative(struct interface *ifp) +int if_is_operative(const struct interface *ifp) { return ((ifp->flags & IFF_UP) && (((ifp->flags & IFF_RUNNING) @@ -461,7 +461,7 @@ int if_is_operative(struct interface *ifp) /* 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) +int if_is_no_ptm_operative(const struct interface *ifp) { return ((ifp->flags & IFF_UP) && ((ifp->flags & IFF_RUNNING) @@ -470,7 +470,7 @@ int if_is_no_ptm_operative(struct interface *ifp) } /* Is this loopback interface ? */ -int if_is_loopback(struct interface *ifp) +int if_is_loopback(const struct interface *ifp) { /* XXX: Do this better, eg what if IFF_WHATEVER means X on platform M * but Y on platform N? @@ -479,12 +479,12 @@ int if_is_loopback(struct interface *ifp) } /* Check interface is VRF */ -int if_is_vrf(struct interface *ifp) +int if_is_vrf(const struct interface *ifp) { return CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK); } -bool if_is_loopback_or_vrf(struct interface *ifp) +bool if_is_loopback_or_vrf(const struct interface *ifp) { if (if_is_loopback(ifp) || if_is_vrf(ifp)) return true; @@ -493,19 +493,19 @@ bool if_is_loopback_or_vrf(struct interface *ifp) } /* Does this interface support broadcast ? */ -int if_is_broadcast(struct interface *ifp) +int if_is_broadcast(const struct interface *ifp) { return ifp->flags & IFF_BROADCAST; } /* Does this interface support broadcast ? */ -int if_is_pointopoint(struct interface *ifp) +int if_is_pointopoint(const struct interface *ifp) { return ifp->flags & IFF_POINTOPOINT; } /* Does this interface support multicast ? */ -int if_is_multicast(struct interface *ifp) +int if_is_multicast(const struct interface *ifp) { return ifp->flags & IFF_MULTICAST; } @@ -1303,7 +1303,7 @@ static int lib_interface_create(enum nb_event event, #else ifp = if_get_by_name(ifname, vrf->vrf_id); #endif /* SUNOS_5 */ - yang_dnode_set_entry(dnode, ifp); + nb_running_set_entry(dnode, ifp); break; } @@ -1315,10 +1315,10 @@ static int lib_interface_destroy(enum nb_event event, { struct interface *ifp; - ifp = yang_dnode_get_entry(dnode, true); switch (event) { case NB_EV_VALIDATE: + ifp = nb_running_get_entry(dnode, NULL, true); if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) { zlog_warn("%s: only inactive interfaces can be deleted", __func__); @@ -1329,6 +1329,7 @@ static int lib_interface_destroy(enum nb_event event, case NB_EV_ABORT: break; case NB_EV_APPLY: + ifp = nb_running_unset_entry(dnode); if_delete(ifp); break; } @@ -1349,7 +1350,7 @@ static int lib_interface_description_modify(enum nb_event event, if (event != NB_EV_APPLY) return NB_OK; - ifp = yang_dnode_get_entry(dnode, true); + ifp = nb_running_get_entry(dnode, NULL, true); XFREE(MTYPE_TMP, ifp->desc); description = yang_dnode_get_string(dnode, NULL); ifp->desc = XSTRDUP(MTYPE_TMP, description); @@ -1365,7 +1366,7 @@ static int lib_interface_description_destroy(enum nb_event event, if (event != NB_EV_APPLY) return NB_OK; - ifp = yang_dnode_get_entry(dnode, true); + ifp = nb_running_get_entry(dnode, NULL, true); XFREE(MTYPE_TMP, ifp->desc); return NB_OK; |
