On 2019/11/17 14:44, Sebastien Marie wrote:
> Hi,
>
> After updating to -current my gateway, I have a problem with dhcpcd.
>
> I am sending the report to bugs@ because reverting changes in kernel solves
> the
> problem. But it could be userland related too (even if it worked previously).
>
> Nov 17 07:25:52 alf dhcpcd[49928]: if_learnaddrs: if_addrflags6: Invalid
> argument
> Nov 17 07:25:52 alf last message repeated 6 times
> Nov 17 07:25:52 alf dhcpcd[49928]: if_ifa: if_addrflags6: Invalid argument
>
> jca@ pointed to me that sys/netinet6/in6.c has recently changed and that
> + if (sa->sa_len != sizeof(struct sockaddr_in6))
> + return EINVAL;
> looks suspicious
>
> I patched it out, and dhcpcd started working again.
>
> The related code in dhcpcd should be:
>
> dhcpcd-8.1.2/src/if-bsd.c
> 1034 int
> 1035 if_addrflags6(const struct interface *ifp, const struct in6_addr *addr,
> 1036 __unused const char *alias)
> 1037 {
> 1038 int flags;
> 1039 struct in6_ifreq ifr6;
> 1040 struct priv *priv;
> 1041
> 1042 memset(&ifr6, 0, sizeof(ifr6));
> 1043 strlcpy(ifr6.ifr_name, ifp->name, sizeof(ifr6.ifr_name));
> 1044 ifr6.ifr_addr.sin6_family = AF_INET6;
> 1045 ifr6.ifr_addr.sin6_addr = *addr;
> 1046 ifa_setscope(&ifr6.ifr_addr, ifp->index);
> 1047 priv = (struct priv *)ifp->ctx->priv;
> 1048 if (ioctl(priv->pf_inet6_fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)
> 1049 flags = ifr6.ifr_ifru.ifru_flags6;
> 1050 else
> 1051 flags = -1;
> 1052 return flags;
> 1053 }
>
> I am unsure if the problem is kernel related or in dhcpcd ...
>
> Thanks.
> --
> Sebastien Marie
>
I think this should do the trick (not tested yet). I wonder how many
more of these are in ports.
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/dhcpcd/Makefile,v
retrieving revision 1.63
diff -u -p -r1.63 Makefile
--- Makefile 13 Nov 2019 12:18:09 -0000 1.63
+++ Makefile 17 Nov 2019 14:15:33 -0000
@@ -3,6 +3,7 @@
COMMENT= DHCPv4/IPv4LL/IPv6RS/DHCPv6 quad stack client
DISTNAME= dhcpcd-8.1.2
+REVISION= 0
CATEGORIES= net
EXTRACT_SUFX= .tar.xz
Index: patches/patch-src_if-bsd_c
===================================================================
RCS file: patches/patch-src_if-bsd_c
diff -N patches/patch-src_if-bsd_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_if-bsd_c 17 Nov 2019 14:15:33 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: src/if-bsd.c
+--- src/if-bsd.c.orig
++++ src/if-bsd.c
+@@ -1043,6 +1043,7 @@ if_addrflags6(const struct interface *ifp, const struc
+ strlcpy(ifr6.ifr_name, ifp->name, sizeof(ifr6.ifr_name));
+ ifr6.ifr_addr.sin6_family = AF_INET6;
+ ifr6.ifr_addr.sin6_addr = *addr;
++ ifr6.ifr_addr.sin6_len = sizeof(ifr6.ifr_addr);
+ ifa_setscope(&ifr6.ifr_addr, ifp->index);
+ priv = (struct priv *)ifp->ctx->priv;
+ if (ioctl(priv->pf_inet6_fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)