From 27c0b01164ac7f4ad697f8eaf9d009c0237ff2fb Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 26 Apr 2023 14:15:07 +0100 Subject: [PATCH] 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. --- src/if-bsd.c | 5 +++++ 1 file changed, 5 insertions(+) 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: { -- 2.47.2