summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-04-30 15:26:57 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-05-01 14:37:41 +0200
commit9cf67225be1dcc7fed302ec34fbfad3b040269a6 (patch)
treec597b985d13a6f1e52216c39633c0a38a090fb81
parentzebra: fix detection of interface renames (diff)
downloadfrr-9cf67225be1dcc7fed302ec34fbfad3b040269a6.tar.xz
frr-9cf67225be1dcc7fed302ec34fbfad3b040269a6.zip
ldpd: fixes to handle interface renames properly
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
-rw-r--r--ldpd/interface.c4
-rw-r--r--ldpd/ldp_zebra.c15
-rw-r--r--ldpd/ldpd.h1
3 files changed, 13 insertions, 7 deletions
diff --git a/ldpd/interface.c b/ldpd/interface.c
index b7f473d39..f1c9925e9 100644
--- a/ldpd/interface.c
+++ b/ldpd/interface.c
@@ -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))
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 702b5c5ea..6fcb27337 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -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);
}
@@ -309,8 +314,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 +343,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 d2fc5aa3a..c662a07d5 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -541,6 +541,7 @@ struct kpw {
};
struct kaddr {
+ char ifname[IF_NAMESIZE];
unsigned short ifindex;
int af;
union ldpd_addr addr;