diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-05-01 14:17:14 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-01 14:17:14 -0400 |
| commit | cae31a9fe06d6df7799b2687f64e90f0757856cb (patch) | |
| tree | 5c835ff7af1b5e4253add067276dcef190e0eca0 /ldpd/interface.c | |
| parent | 3ad3ba1d267efd2c5c66323b5ae0b02bafade6ff (diff) | |
| parent | 988ded8d1258174e2b13e5f1a50ef7279ffe4b65 (diff) | |
Merge pull request #432 from opensourcerouting/ldpd-link-detect
ldpd: respect link-detect configuration
Diffstat (limited to 'ldpd/interface.c')
| -rw-r--r-- | ldpd/interface.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/ldpd/interface.c b/ldpd/interface.c index b7f473d396..7c75f3e084 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -31,7 +31,7 @@ static struct if_addr *if_addr_new(struct kaddr *); 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 *); @@ -139,7 +139,7 @@ if_update_info(struct iface *iface, struct kif *kif) /* get index and flags */ iface->ifindex = kif->ifindex; - iface->flags = kif->flags; + iface->operative = kif->operative; } struct iface_af * @@ -325,7 +325,7 @@ if_reset(struct iface *iface, int 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; @@ -363,14 +363,15 @@ if_update_af(struct iface_af *ia, int link_ok) 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; @@ -381,14 +382,10 @@ if_update_af(struct iface_af *ia, int link_ok) 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 @@ -463,7 +460,6 @@ if_to_ctl(struct iface_af *ia) 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); |
