From: Roy Marples Date: Mon, 20 Jan 2020 11:59:06 +0000 (+0000) Subject: Only ignore address messages from ourself for deletion. X-Git-Tag: v9.0.0~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49e27f8893b61e9db3da362f182e6d0d279bf3f2;p=thirdparty%2Fdhcpcd.git Only ignore address messages from ourself for deletion. We need to process addition for flag changes. --- diff --git a/src/if-bsd.c b/src/if-bsd.c index 513b4aea..4d455791 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1299,16 +1299,21 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam) } #ifdef HAVE_IFAM_PID + /* Ignore address deletions from ourself. + * We need to process address flag changes though. */ + if (ifam->ifam_type == RTM_DELADDR) { #ifdef PRIVSEP - if (ctx->ps_root_pid != 0) { - if (ifam->ifam_pid == ctx->ps_root_pid) - return 0; - } else + if (ctx->ps_root_pid != 0) { + if (ifam->ifam_pid == ctx->ps_root_pid) + return 0; + } else #endif - /* address management is done via ioctl, so SO_USELOOPBACK - * has no effect, so we do need to check the pid. */ - if (ifam->ifam_pid == getpid()) - return 0; + /* address management is done via ioctl, + * so SO_USELOOPBACK has no effect, + * so we do need to check the pid. */ + if (ifam->ifam_pid == getpid()) + return 0; + } pid = ifam->ifam_pid; #else pid = 0; diff --git a/src/if-linux.c b/src/if-linux.c index 2c260d32..0242fd12 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -692,15 +692,18 @@ link_addr(struct dhcpcd_ctx *ctx, struct interface *ifp, struct nlmsghdr *nlm) return -1; } - /* Ignore messages we sent. */ + /* Ignore address deletions from ourself. + * We need to process address flag changes though. */ + if (nlm->nlmsg_type == RTM_DELADDR) { #ifdef PRIVSEP - if (ctx->ps_root_pid != 0 && - nlm->nlmsg_pid == (uint32_t)ctx->ps_root_pid) - return 0; + if (ctx->ps_root_pid != 0 && + nlm->nlmsg_pid == (uint32_t)ctx->ps_root_pid) + return 0; #endif - priv = (struct priv*)ctx->priv; - if (nlm->nlmsg_pid == priv->route_pid) - return 0; + priv = (struct priv*)ctx->priv; + if (nlm->nlmsg_pid == priv->route_pid) + return 0; + } ifa = NLMSG_DATA(nlm); if ((ifp = if_findindex(ctx->ifaces, ifa->ifa_index)) == NULL) {