Friday, October 02, 2020

Re: dhcpcd: update to 9.2.0 with cherry-picked pppoe(4) fix

On Fri, Oct 02, 2020 at 11:16:38AM +0100, Stuart Henderson wrote:
> Please use standard ports-tree patches for the individual files rather
> than a handrolled jumbo patch. (no need for linux/sun parts I think).
Sure, like that?

> The code in git head ("BSD: struct if_data->ifi_link_state is the single
> source of truth") looks better but this is an easier patch until a new
> release is made.
Yes and yes, but the commit I used was the first one I tried after going
through all of them since 9.2.0 releaes and it immediately worked, so
I sticked with it.

Hopefully 9.2.1 is around the corner anyway.

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/dhcpcd/Makefile,v
retrieving revision 1.80
diff -u -p -r1.80 Makefile
--- Makefile 8 Sep 2020 15:02:32 -0000 1.80
+++ Makefile 1 Oct 2020 23:04:41 -0000
@@ -2,7 +2,7 @@

COMMENT= DHCPv4/IPv4LL/IPv6RS/DHCPv6 quad stack client

-DISTNAME= dhcpcd-9.1.4
+DISTNAME= dhcpcd-9.2.0
EPOCH= 0

CATEGORIES= net
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/dhcpcd/distinfo,v
retrieving revision 1.48
diff -u -p -r1.48 distinfo
--- distinfo 8 Sep 2020 15:02:32 -0000 1.48
+++ distinfo 1 Oct 2020 23:04:46 -0000
@@ -1,2 +1,2 @@
-SHA256 (dhcpcd-9.1.4.tar.xz) = X+Ez5Ul9ivbSa9bmuN1IqxLRJNbMTO/m3mU2/5f3aCA=
-SIZE (dhcpcd-9.1.4.tar.xz) = 249648
+SHA256 (dhcpcd-9.2.0.tar.xz) = /LLRlnLURbv9OGeP3uT1Vu+Wej6mvYEJLRBUXfLLlmY=
+SIZE (dhcpcd-9.2.0.tar.xz) = 250584
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 2 Oct 2020 19:13:24 -0000
@@ -0,0 +1,43 @@
+$OpenBSD$
+
+22.09.2020 e675d4dde0 "BSD: Detect initial link state in ifa_data"
+fixes dhcpcd on pppoe(4), remove with next release.
+
+Index: src/if-bsd.c
+--- src/if-bsd.c.orig
++++ src/if-bsd.c
+@@ -363,11 +363,32 @@ if_carrier(struct interface *ifp)
+ return LINK_UNKNOWN;
+
+ strlcpy(ifmr.ifm_name, ifp->name, sizeof(ifmr.ifm_name));
+- if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFMEDIA, &ifmr) == -1 ||
+- !(ifmr.ifm_status & IFM_AVALID))
++ if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFMEDIA, &ifmr) == -1)
+ return LINK_UNKNOWN;
+
++ if (!(ifmr.ifm_status & IFM_AVALID))
++ return LINK_UNKNOWN;
++
+ return (ifmr.ifm_status & IFM_ACTIVE) ? LINK_UP : LINK_DOWN;
++}
++
++int
++if_carrier_ifadata(struct interface *ifp, void *ifadata)
++{
++ int carrier = if_carrier(ifp);
++ struct if_data *ifdata;
++
++ if (carrier != LINK_UNKNOWN || ifadata == NULL)
++ return carrier;
++
++ ifdata = ifadata;
++ switch (ifdata->ifi_link_state) {
++ case LINK_STATE_DOWN:
++ return LINK_DOWN;
++ case LINK_STATE_UP:
++ return LINK_UP;
++ }
++ return LINK_UNKNOWN;
+ }
+
+ static void
Index: patches/patch-src_if_c
===================================================================
RCS file: patches/patch-src_if_c
diff -N patches/patch-src_if_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_if_c 2 Oct 2020 19:13:22 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+22.09.2020 e675d4dde0 "BSD: Detect initial link state in ifa_data"
+fixes dhcpcd on pppoe(4), remove with next release.
+
+Index: src/if.c
+--- src/if.c.orig
++++ src/if.c
+@@ -682,7 +682,7 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **i
+
+ ifp->active = active;
+ if (ifp->active)
+- ifp->carrier = if_carrier(ifp);
++ ifp->carrier = if_carrier_ifadata(ifp, ifa->ifa_data);
+ else
+ ifp->carrier = LINK_UNKNOWN;
+ TAILQ_INSERT_TAIL(ifs, ifp, next);
Index: patches/patch-src_if_h
===================================================================
RCS file: patches/patch-src_if_h
diff -N patches/patch-src_if_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_if_h 2 Oct 2020 19:13:21 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+22.09.2020 e675d4dde0 "BSD: Detect initial link state in ifa_data"
+fixes dhcpcd on pppoe(4), remove with next release.
+
+Index: src/if.h
+--- src/if.h.orig
++++ src/if.h
+@@ -160,6 +160,7 @@ int if_domtu(const struct interface *, short int);
+ #define if_getmtu(ifp) if_domtu((ifp), 0)
+ #define if_setmtu(ifp, mtu) if_domtu((ifp), (mtu))
+ int if_carrier(struct interface *);
++int if_carrier_ifadata(struct interface *, void *);
+ int if_pollinit(struct interface *ifp);
+
+ #ifdef ALIAS_ADDR

No comments:

Post a Comment