summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-02 21:52:09 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-05-02 21:52:09 +0200
commit05ba625af7cbeb08322a1ea761732521816245bd (patch)
treeb5501ff31d67ec53a0da4935f59a17478b637255 /ldpd
parentMerge remote-tracking branch 'origin/stable/2.0' (diff)
parentupdate doc of ubuntu 12.04 (diff)
downloadfrr-05ba625af7cbeb08322a1ea761732521816245bd.tar.xz
frr-05ba625af7cbeb08322a1ea761732521816245bd.zip
Merge remote-tracking branch 'origin/stable/3.0'
Diffstat (limited to 'ldpd')
-rw-r--r--ldpd/interface.c26
-rw-r--r--ldpd/l2vpn.c4
-rw-r--r--ldpd/ldp_zebra.c21
-rw-r--r--ldpd/ldpd.h7
4 files changed, 29 insertions, 29 deletions
diff --git a/ldpd/interface.c b/ldpd/interface.c
index 767815247..440bb2dca 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 *
@@ -209,7 +209,7 @@ if_addr_add(struct kaddr *ka)
}
}
- iface = if_lookup(leconf, ka->ifindex);
+ iface = if_lookup_name(leconf, ka->ifname);
if (iface) {
if (ka->af == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&ka->addr.v6))
iface->linklocal = ka->addr.v6;
@@ -229,7 +229,7 @@ if_addr_del(struct kaddr *ka)
struct if_addr *if_addr;
struct nbr *nbr;
- iface = if_lookup(leconf, ka->ifindex);
+ iface = if_lookup_name(leconf, ka->ifname);
if (iface) {
if (ka->af == AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&iface->linklocal, &ka->addr.v6))
@@ -328,7 +328,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;
@@ -366,13 +366,14 @@ 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;
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;
if_reset(ia->iface, ia->af);
@@ -382,14 +383,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
@@ -464,7 +461,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);
diff --git a/ldpd/l2vpn.c b/ldpd/l2vpn.c
index 92d865210..27948f5a1 100644
--- a/ldpd/l2vpn.c
+++ b/ldpd/l2vpn.c
@@ -142,7 +142,7 @@ void
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));
}
@@ -154,7 +154,7 @@ l2vpn_if_update(struct l2vpn_if *lif)
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) {
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 241603b8e..3320238a0 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -64,7 +64,7 @@ ifp2kif(struct interface *ifp, struct kif *kif)
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);
}
@@ -73,6 +73,7 @@ static void
ifc2kaddr(struct interface *ifp, struct connected *ifc, struct kaddr *ka)
{
memset(ka, 0, sizeof(*ka));
+ strlcpy(ka->ifname, ifp->name, sizeof(ka->ifname));
ka->ifindex = ifp->ifindex;
ka->af = ifc->address->family;
ka->prefixlen = ifc->address->prefixlen;
@@ -232,6 +233,7 @@ ldp_interface_delete(int command, struct zclient *zclient, zebra_size_t length,
vrf_id_t vrf_id)
{
struct interface *ifp;
+ struct kif kif;
/* zebra_interface_state_read() updates interface structure in iflist */
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
@@ -243,7 +245,10 @@ ldp_interface_delete(int command, struct zclient *zclient, zebra_size_t length,
/* To support pseudo interface do not free interface structure. */
/* if_delete(ifp); */
- ifp->ifindex = IFINDEX_INTERNAL;
+ ifp->ifindex = IFINDEX_DELETED;
+
+ ifp2kif(ifp, &kif);
+ main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
return (0);
}
@@ -257,7 +262,6 @@ ldp_interface_status_change(int command, struct zclient *zclient,
struct connected *ifc;
struct kif kif;
struct kaddr ka;
- int link_new;
/*
* zebra_interface_state_read() updates interface structure in
@@ -272,8 +276,7 @@ ldp_interface_status_change(int command, struct zclient *zclient,
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,
@@ -309,8 +312,8 @@ ldp_interface_address_add(int command, struct zclient *zclient,
if (bad_addr(ka.af, &ka.addr))
return (0);
- debug_zebra_in("address add %s/%u", log_addr(ka.af, &ka.addr),
- ka.prefixlen);
+ debug_zebra_in("address add %s/%u interface %s",
+ log_addr(ka.af, &ka.addr), ka.prefixlen, ifp->name);
/* notify ldpe about new address */
main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
@@ -338,8 +341,8 @@ ldp_interface_address_delete(int command, struct zclient *zclient,
if (bad_addr(ka.af, &ka.addr))
return (0);
- debug_zebra_in("address delete %s/%u", log_addr(ka.af, &ka.addr),
- ka.prefixlen);
+ debug_zebra_in("address delete %s/%u interface %s",
+ log_addr(ka.af, &ka.addr), ka.prefixlen, ifp->name);
/* notify ldpe about removed address */
main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka, sizeof(ka));
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h
index cba1939d9..3acc4fbe2 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -305,7 +305,7 @@ struct iface {
struct if_addr_head addr_list;
struct in6_addr linklocal;
enum iface_type type;
- uint16_t flags;
+ int operative;
struct iface_af ipv4;
struct iface_af ipv6;
QOBJ_FIELDS
@@ -387,7 +387,7 @@ struct l2vpn_if {
struct l2vpn *l2vpn;
char ifname[IF_NAMESIZE];
unsigned int ifindex;
- uint16_t flags;
+ int operative;
uint8_t mac[ETHER_ADDR_LEN];
QOBJ_FIELDS
};
@@ -553,6 +553,7 @@ struct kpw {
};
struct kaddr {
+ char ifname[IF_NAMESIZE];
unsigned short ifindex;
int af;
union ldpd_addr addr;
@@ -564,6 +565,7 @@ struct kif {
char ifname[IF_NAMESIZE];
unsigned short ifindex;
int flags;
+ int operative;
uint8_t mac[ETHER_ADDR_LEN];
int mtu;
};
@@ -581,7 +583,6 @@ struct ctl_iface {
char name[IF_NAMESIZE];
unsigned int ifindex;
int state;
- uint16_t flags;
enum iface_type type;
uint16_t hello_holdtime;
uint16_t hello_interval;