From: Roy Marples Date: Wed, 26 Apr 2023 13:15:07 +0000 (+0100) Subject: BSD: When we get RTM_NEWADDR the interface must have IFF_UP. X-Git-Tag: v10.0.2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27c0b01164ac7f4ad697f8eaf9d009c0237ff2fb;p=thirdparty%2Fdhcpcd.git BSD: When we get RTM_NEWADDR the interface must have IFF_UP. 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. --- diff --git a/src/if-bsd.c b/src/if-bsd.c index eb3a4380..39fb263f 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -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: {