]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only ignore address messages from ourself for deletion.
authorRoy Marples <roy@marples.name>
Mon, 20 Jan 2020 11:59:06 +0000 (11:59 +0000)
committerRoy Marples <roy@marples.name>
Mon, 20 Jan 2020 11:59:06 +0000 (11:59 +0000)
We need to process addition for flag changes.

src/if-bsd.c
src/if-linux.c

index 513b4aea3210294e3545fb86a0e2daa4d4c1d9c6..4d455791d8a0721d1d7741f5e1e3cabf50929519 100644 (file)
@@ -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;
index 2c260d327ba8d5260442e412ca1d5e6fa9c8ad8b..0242fd12ba02445e5be933ee91e97ffba9d8f0d0 100644 (file)
@@ -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) {