]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: When we get RTM_NEWADDR the interface must have IFF_UP.
authorRoy Marples <roy@marples.name>
Wed, 26 Apr 2023 13:15:07 +0000 (14:15 +0100)
committerRoy Marples <roy@marples.name>
Wed, 26 Apr 2023 13:15:07 +0000 (14:15 +0100)
This is apparently historic behaviour.
It's not always mirrored in RTM_IFINFO either so we need to
replicate the behaviour if we had got it earlier.

This fixes dhcpcd requiring at least something to set the interface
up before starting on OpenBSD.
Other BSD are less impacted because it's a lot harder to get into
this state as we have more control over setting the IPv6 LL address.

src/if-bsd.c

index eb3a4380de18e386592e9f45f262b6c10cdb67c3..39fb263f2c539ebc5c6afd9f1f93cb48f9561e4f 100644 (file)
@@ -1335,6 +1335,11 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
                      ifam->ifam_msglen - sizeof(*ifam), rti_info) == -1)
                return -1;
 
+       /* All BSD's set IFF_UP on the interface when adding an address.
+        * But not all BSD's emit this via RTM_IFINFO when they do this ... */
+       if (ifam->ifam_type == RTM_NEWADDR && !(ifp->flags & IFF_UP))
+               dhcpcd_handlecarrier(ifp, ifp->carrier, ifp->flags | IFF_UP);
+
        switch (rti_info[RTAX_IFA]->sa_family) {
        case AF_LINK:
        {