static struct if_addr *if_addr_lookup(struct if_addr_head *, struct kaddr *);
static int if_start(struct iface *, int);
static int if_reset(struct iface *, int);
-static void if_update_af(struct iface_af *, int);
+static void if_update_af(struct iface_af *);
static int if_hello_timer(struct thread *);
static void if_start_hello_timer(struct iface_af *);
static void if_stop_hello_timer(struct iface_af *);
/* get index and flags */
iface->ifindex = kif->ifindex;
- iface->flags = kif->flags;
+ iface->operative = kif->operative;
}
struct iface_af *
}
static void
-if_update_af(struct iface_af *ia, int link_ok)
+if_update_af(struct iface_af *ia)
{
int addr_ok = 0, socket_ok, rtr_id_ok;
struct if_addr *if_addr;
rtr_id_ok = 0;
if (ia->state == IF_STA_DOWN) {
- if (!ia->enabled || !link_ok || !addr_ok || !socket_ok ||
- !rtr_id_ok)
+ if (!ia->enabled || !ia->iface->operative || !addr_ok ||
+ !socket_ok || !rtr_id_ok)
return;
ia->state = IF_STA_ACTIVE;
if_start(ia->iface, ia->af);
} else if (ia->state == IF_STA_ACTIVE) {
- if (ia->enabled && link_ok && addr_ok && socket_ok && rtr_id_ok)
+ if (ia->enabled && ia->iface->operative && addr_ok &&
+ socket_ok && rtr_id_ok)
return;
ia->state = IF_STA_DOWN;
void
ldp_if_update(struct iface *iface, int af)
{
- int link_ok;
-
- link_ok = (iface->flags & IFF_UP) && (iface->flags & IFF_RUNNING);
-
if (af == AF_INET || af == AF_UNSPEC)
- if_update_af(&iface->ipv4, link_ok);
+ if_update_af(&iface->ipv4);
if (af == AF_INET6 || af == AF_UNSPEC)
- if_update_af(&iface->ipv6, link_ok);
+ if_update_af(&iface->ipv6);
}
void
memcpy(ictl.name, ia->iface->name, sizeof(ictl.name));
ictl.ifindex = ia->iface->ifindex;
ictl.state = ia->state;
- ictl.flags = ia->iface->flags;
ictl.type = ia->iface->type;
ictl.hello_holdtime = if_get_hello_holdtime(ia);
ictl.hello_interval = if_get_hello_interval(ia);
l2vpn_if_update_info(struct l2vpn_if *lif, struct kif *kif)
{
lif->ifindex = kif->ifindex;
- lif->flags = kif->flags;
+ lif->operative = kif->operative;
memcpy(lif->mac, kif->mac, sizeof(lif->mac));
}
struct map fec;
struct nbr *nbr;
- if ((lif->flags & IFF_UP) && (lif->flags & IFF_RUNNING))
+ if (lif->operative)
return;
RB_FOREACH(pw, l2vpn_pw_head, &l2vpn->pw_tree) {
memset(kif, 0, sizeof(*kif));
strlcpy(kif->ifname, ifp->name, sizeof(kif->ifname));
kif->ifindex = ifp->ifindex;
- kif->flags = ifp->flags;
+ kif->operative = if_is_operative(ifp);
if (ifp->ll_type == ZEBRA_LLT_ETHER)
memcpy(kif->mac, ifp->hw_addr, ETHER_ADDR_LEN);
}
struct connected *ifc;
struct kif kif;
struct kaddr ka;
- int link_new;
/*
* zebra_interface_state_read() updates interface structure in
ifp2kif(ifp, &kif);
main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
- link_new = (ifp->flags & IFF_UP) && (ifp->flags & IFF_RUNNING);
- if (link_new) {
+ if (if_is_operative(ifp)) {
for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
ifc2kaddr(ifp, ifc, &ka);
main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,