return 0;
}
-static int
-handle_rename(struct dhcpcd_ctx *ctx, unsigned int ifindex, const char *ifname)
-{
- struct interface *ifp;
-
- TAILQ_FOREACH(ifp, ctx->ifaces, next) {
- if (ifp->index == ifindex && strcmp(ifp->name, ifname)) {
- dhcpcd_handleinterface(ctx, -1, ifp->name);
- /* Let dev announce the interface for renaming */
- if (!dev_listening(ctx))
- dhcpcd_handleinterface(ctx, 1, ifname);
- return 1;
- }
- }
- return 0;
-}
-
#ifdef INET6
static int
link_neigh(struct dhcpcd_ctx *ctx, __unused struct interface *ifp,
return 0;
}
- /* Check for interface name change */
- if (handle_rename(ctx, (unsigned int)ifi->ifi_index, ifn))
- return 0;
-
/* Check for a new interface */
- if ((ifp = if_find(ctx->ifaces, ifn)) == NULL) {
+ ifp = if_findindex(ctx->ifaces, (unsigned int)ifi->ifi_index);
+ if (ifp == NULL) {
/* If are listening to a dev manager, let that announce
* the interface rather than the kernel. */
if (dev_listening(ctx) < 1)
return 0;
}
+ /* Handle interface being renamed */
+ if (strcmp(ifp->name, ifn) != 0) {
+ dhcpcd_handleinterface(ctx, -1, ifn);
+ dhcpcd_handleinterface(ctx, 1, ifn);
+ return 0;
+ }
+
/* Re-read hardware address and friends */
if (!(ifi->ifi_flags & IFF_UP) && hwaddr) {
uint8_t l;