Re: broadcast simplex checksum

2021-02-06 Thread Alexander Bluhm
On Sat, Feb 06, 2021 at 08:26:35PM +1300, richard.n.proc...@gmail.com wrote:
> I'm ok with your latest diff as-is. I prefer a slightly different 
> direction, see below, but not enough to object. 

I have commited my diff as is.  It is better if you expess your
arguments yourself in the comment when you change the condition.

I would review such a diff benevolently.

bluhm



Re: ifg_refcnt atomic operation

2021-02-06 Thread Vitaliy Makkoveev
> On 6 Feb 2021, at 15:23, Alexander Bluhm  wrote:
> 
> On Sat, Feb 06, 2021 at 05:04:20PM +1000, David Gwynne wrote:
>> refcnt_init starts counting at 1, while the existing code starts at 0. Do
>> the crashes stop because we never fully release all the references and
>> never free it now?
> 
> You are absolutely right.  I was too optimistic.
> 
> Correct diff is below.  It does not fix anything.  Only advantage
> is that carp does not access interface group internals.
> 
> bluhm

I’m not sure it should be atomic. It seems groups require their own
lock and this lock should be held while we perform if_addgroup() and
if_delgroup(). However if_creategroup() should set `ifg_refcnt’ to 1
and carp(4) should not touch groups internals.

> 
> Index: net/if.c
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
> retrieving revision 1.626
> diff -u -p -r1.626 if.c
> --- net/if.c  1 Feb 2021 07:43:33 -   1.626
> +++ net/if.c  6 Feb 2021 12:16:20 -
> @@ -2601,7 +2601,7 @@ if_creategroup(const char *groupname)
>   return (NULL);
> 
>   strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
> - ifg->ifg_refcnt = 0;
> + refcnt_init(>ifg_refcnt);
>   ifg->ifg_carp_demoted = 0;
>   TAILQ_INIT(>ifg_members);
> #if NPF > 0
> @@ -2642,13 +2642,17 @@ if_addgroup(struct ifnet *ifp, const cha
>   if (!strcmp(ifg->ifg_group, groupname))
>   break;
> 
> - if (ifg == NULL && (ifg = if_creategroup(groupname)) == NULL) {
> + if (ifg == NULL)
> + ifg = if_creategroup(groupname);
> + else
> + refcnt_take(>ifg_refcnt);
> +
> + if (ifg == NULL) {
>   free(ifgl, M_TEMP, sizeof(*ifgl));
>   free(ifgm, M_TEMP, sizeof(*ifgm));
>   return (ENOMEM);
>   }
> 
> - ifg->ifg_refcnt++;
>   ifgl->ifgl_group = ifg;
>   ifgm->ifgm_ifp = ifp;
> 
> @@ -2692,7 +2696,7 @@ if_delgroup(struct ifnet *ifp, const cha
>   pfi_group_change(groupname);
> #endif
> 
> - if (--ifgl->ifgl_group->ifg_refcnt == 0) {
> + if (refcnt_rele(>ifgl_group->ifg_refcnt)) {
>   TAILQ_REMOVE(_head, ifgl->ifgl_group, ifg_next);
> #if NPF > 0
>   pfi_detach_ifgroup(ifgl->ifgl_group);
> Index: net/if_var.h
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_var.h,v
> retrieving revision 1.112
> diff -u -p -r1.112 if_var.h
> --- net/if_var.h  29 Jul 2020 12:09:31 -  1.112
> +++ net/if_var.h  6 Feb 2021 12:11:35 -
> @@ -263,7 +263,7 @@ struct ifmaddr {
> 
> struct ifg_group {
>   char ifg_group[IFNAMSIZ];
> - u_intifg_refcnt;
> + struct refcntifg_refcnt;
>   caddr_t  ifg_pf_kif;
>   int  ifg_carp_demoted;
>   TAILQ_HEAD(, ifg_member) ifg_members;
> Index: netinet/ip_carp.c
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.c,v
> retrieving revision 1.351
> diff -u -p -r1.351 ip_carp.c
> --- netinet/ip_carp.c 21 Jan 2021 13:18:07 -  1.351
> +++ netinet/ip_carp.c 6 Feb 2021 12:11:35 -
> @@ -786,10 +786,7 @@ carp_sysctl(int *name, u_int namelen, vo
> void
> carpattach(int n)
> {
> - struct ifg_group*ifg;
> -
> - if ((ifg = if_creategroup("carp")) != NULL)
> - ifg->ifg_refcnt++;  /* keep around even if empty */
> + if_creategroup("carp");  /* keep around even if empty */
>   if_clone_attach(_cloner);
>   carpcounters = counters_alloc(carps_ncounters);
> }
> 



Re: unwind(8): open DNSSEC trustanchor late

2021-02-06 Thread Florian Obser
On Sat, Feb 06, 2021 at 01:23:35AM +0100, Jeremie Courreges-Anglas wrote:
> On Fri, Jan 29 2021, Florian Obser  wrote:
> > Last piece of the puzzle...
> >
> > Re-try to open DNSSEC trust anchor file if /var is not mounted yet.
> > With this we are able to start unwind before the network is up and
> > partitions are mounted.
> 
> Sorry for being late to the party, I just upgraded to the latest snaps
> and DNS broke.  Reverting this diff unbreaks unwind(8) operations.
> 

Could you be more specific what broke?

I was going to revert at least half of that diff anyway because I
think it's just too ugly what we are doing here and I'm persuing a
different solution to the overall problem.

> My unwind.conf:
> 
>   preference { recursor }
> 
> (Can't reproduce this problem with an empty config file.)
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

-- 
I'm not entirely sure you are real.



Re: ifg_refcnt atomic operation

2021-02-06 Thread Alexander Bluhm
On Sat, Feb 06, 2021 at 05:04:20PM +1000, David Gwynne wrote:
> refcnt_init starts counting at 1, while the existing code starts at 0. Do
> the crashes stop because we never fully release all the references and
> never free it now?

You are absolutely right.  I was too optimistic.

Correct diff is below.  It does not fix anything.  Only advantage
is that carp does not access interface group internals.

bluhm

Index: net/if.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
retrieving revision 1.626
diff -u -p -r1.626 if.c
--- net/if.c1 Feb 2021 07:43:33 -   1.626
+++ net/if.c6 Feb 2021 12:16:20 -
@@ -2601,7 +2601,7 @@ if_creategroup(const char *groupname)
return (NULL);
 
strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
-   ifg->ifg_refcnt = 0;
+   refcnt_init(>ifg_refcnt);
ifg->ifg_carp_demoted = 0;
TAILQ_INIT(>ifg_members);
 #if NPF > 0
@@ -2642,13 +2642,17 @@ if_addgroup(struct ifnet *ifp, const cha
if (!strcmp(ifg->ifg_group, groupname))
break;
 
-   if (ifg == NULL && (ifg = if_creategroup(groupname)) == NULL) {
+   if (ifg == NULL)
+   ifg = if_creategroup(groupname);
+   else
+   refcnt_take(>ifg_refcnt);
+
+   if (ifg == NULL) {
free(ifgl, M_TEMP, sizeof(*ifgl));
free(ifgm, M_TEMP, sizeof(*ifgm));
return (ENOMEM);
}
 
-   ifg->ifg_refcnt++;
ifgl->ifgl_group = ifg;
ifgm->ifgm_ifp = ifp;
 
@@ -2692,7 +2696,7 @@ if_delgroup(struct ifnet *ifp, const cha
pfi_group_change(groupname);
 #endif
 
-   if (--ifgl->ifgl_group->ifg_refcnt == 0) {
+   if (refcnt_rele(>ifgl_group->ifg_refcnt)) {
TAILQ_REMOVE(_head, ifgl->ifgl_group, ifg_next);
 #if NPF > 0
pfi_detach_ifgroup(ifgl->ifgl_group);
Index: net/if_var.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_var.h,v
retrieving revision 1.112
diff -u -p -r1.112 if_var.h
--- net/if_var.h29 Jul 2020 12:09:31 -  1.112
+++ net/if_var.h6 Feb 2021 12:11:35 -
@@ -263,7 +263,7 @@ struct ifmaddr {
 
 struct ifg_group {
char ifg_group[IFNAMSIZ];
-   u_intifg_refcnt;
+   struct refcntifg_refcnt;
caddr_t  ifg_pf_kif;
int  ifg_carp_demoted;
TAILQ_HEAD(, ifg_member) ifg_members;
Index: netinet/ip_carp.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.351
diff -u -p -r1.351 ip_carp.c
--- netinet/ip_carp.c   21 Jan 2021 13:18:07 -  1.351
+++ netinet/ip_carp.c   6 Feb 2021 12:11:35 -
@@ -786,10 +786,7 @@ carp_sysctl(int *name, u_int namelen, vo
 void
 carpattach(int n)
 {
-   struct ifg_group*ifg;
-
-   if ((ifg = if_creategroup("carp")) != NULL)
-   ifg->ifg_refcnt++;  /* keep around even if empty */
+   if_creategroup("carp");  /* keep around even if empty */
if_clone_attach(_cloner);
carpcounters = counters_alloc(carps_ncounters);
 }



Re: ifg_refcnt atomic operation

2021-02-06 Thread Alexander Bluhm
On Sat, Feb 06, 2021 at 05:58:35PM +0300, Vitaliy Makkoveev wrote:
> I???m not sure it should be atomic. It seems groups require their own
> lock and this lock should be held while we perform if_addgroup() and
> if_delgroup().

I also think that atomic refcounting is not needed here.  But it
does no harm as adding interface groups is not performance critical.

Question is if we want to use refcnt_... API even if it does more
than required.  Or should we go with a self crafted ++ -- refcounting?

I think the API provides a nicer interface.

bluhm

> However if_creategroup() should set `ifg_refcnt??? to 1
> and carp(4) should not touch groups internals.
> 
> > 
> > Index: net/if.c
> > ===
> > RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
> > retrieving revision 1.626
> > diff -u -p -r1.626 if.c
> > --- net/if.c1 Feb 2021 07:43:33 -   1.626
> > +++ net/if.c6 Feb 2021 12:16:20 -
> > @@ -2601,7 +2601,7 @@ if_creategroup(const char *groupname)
> > return (NULL);
> > 
> > strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
> > -   ifg->ifg_refcnt = 0;
> > +   refcnt_init(>ifg_refcnt);
> > ifg->ifg_carp_demoted = 0;
> > TAILQ_INIT(>ifg_members);
> > #if NPF > 0
> > @@ -2642,13 +2642,17 @@ if_addgroup(struct ifnet *ifp, const cha
> > if (!strcmp(ifg->ifg_group, groupname))
> > break;
> > 
> > -   if (ifg == NULL && (ifg = if_creategroup(groupname)) == NULL) {
> > +   if (ifg == NULL)
> > +   ifg = if_creategroup(groupname);
> > +   else
> > +   refcnt_take(>ifg_refcnt);
> > +
> > +   if (ifg == NULL) {
> > free(ifgl, M_TEMP, sizeof(*ifgl));
> > free(ifgm, M_TEMP, sizeof(*ifgm));
> > return (ENOMEM);
> > }
> > 
> > -   ifg->ifg_refcnt++;
> > ifgl->ifgl_group = ifg;
> > ifgm->ifgm_ifp = ifp;
> > 
> > @@ -2692,7 +2696,7 @@ if_delgroup(struct ifnet *ifp, const cha
> > pfi_group_change(groupname);
> > #endif
> > 
> > -   if (--ifgl->ifgl_group->ifg_refcnt == 0) {
> > +   if (refcnt_rele(>ifgl_group->ifg_refcnt)) {
> > TAILQ_REMOVE(_head, ifgl->ifgl_group, ifg_next);
> > #if NPF > 0
> > pfi_detach_ifgroup(ifgl->ifgl_group);
> > Index: net/if_var.h
> > ===
> > RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_var.h,v
> > retrieving revision 1.112
> > diff -u -p -r1.112 if_var.h
> > --- net/if_var.h29 Jul 2020 12:09:31 -  1.112
> > +++ net/if_var.h6 Feb 2021 12:11:35 -
> > @@ -263,7 +263,7 @@ struct ifmaddr {
> > 
> > struct ifg_group {
> > char ifg_group[IFNAMSIZ];
> > -   u_intifg_refcnt;
> > +   struct refcntifg_refcnt;
> > caddr_t  ifg_pf_kif;
> > int  ifg_carp_demoted;
> > TAILQ_HEAD(, ifg_member) ifg_members;
> > Index: netinet/ip_carp.c
> > ===
> > RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.c,v
> > retrieving revision 1.351
> > diff -u -p -r1.351 ip_carp.c
> > --- netinet/ip_carp.c   21 Jan 2021 13:18:07 -  1.351
> > +++ netinet/ip_carp.c   6 Feb 2021 12:11:35 -
> > @@ -786,10 +786,7 @@ carp_sysctl(int *name, u_int namelen, vo
> > void
> > carpattach(int n)
> > {
> > -   struct ifg_group*ifg;
> > -
> > -   if ((ifg = if_creategroup("carp")) != NULL)
> > -   ifg->ifg_refcnt++;  /* keep around even if empty */
> > +   if_creategroup("carp");  /* keep around even if empty */
> > if_clone_attach(_cloner);
> > carpcounters = counters_alloc(carps_ncounters);
> > }
> > 
> 



Re: ifg_refcnt atomic operation

2021-02-06 Thread Alexander Bluhm
On Sat, Feb 06, 2021 at 04:44:08PM +0100, Alexander Bluhm wrote:
> Or should we go with a self crafted ++ -- refcounting?

This would look like this, also fine with me.  kasserts are also in
refcnt_... API.

ok?

bluhm

Index: net/if.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if.c,v
retrieving revision 1.626
diff -u -p -r1.626 if.c
--- net/if.c1 Feb 2021 07:43:33 -   1.626
+++ net/if.c6 Feb 2021 16:26:51 -
@@ -2601,7 +2601,7 @@ if_creategroup(const char *groupname)
return (NULL);
 
strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
-   ifg->ifg_refcnt = 0;
+   ifg->ifg_refcnt = 1;
ifg->ifg_carp_demoted = 0;
TAILQ_INIT(>ifg_members);
 #if NPF > 0
@@ -2642,13 +2642,18 @@ if_addgroup(struct ifnet *ifp, const cha
if (!strcmp(ifg->ifg_group, groupname))
break;
 
-   if (ifg == NULL && (ifg = if_creategroup(groupname)) == NULL) {
+   if (ifg == NULL)
+   ifg = if_creategroup(groupname);
+   else
+   ifg->ifg_refcnt++;
+   KASSERT(ifg->ifg_refcnt != 0);
+
+   if (ifg == NULL) {
free(ifgl, M_TEMP, sizeof(*ifgl));
free(ifgm, M_TEMP, sizeof(*ifgm));
return (ENOMEM);
}
 
-   ifg->ifg_refcnt++;
ifgl->ifgl_group = ifg;
ifgm->ifgm_ifp = ifp;
 
@@ -2692,6 +2697,7 @@ if_delgroup(struct ifnet *ifp, const cha
pfi_group_change(groupname);
 #endif
 
+   KASSERT(ifgl->ifgl_group->ifg_refcnt != 0);
if (--ifgl->ifgl_group->ifg_refcnt == 0) {
TAILQ_REMOVE(_head, ifgl->ifgl_group, ifg_next);
 #if NPF > 0
Index: netinet/ip_carp.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.351
diff -u -p -r1.351 ip_carp.c
--- netinet/ip_carp.c   21 Jan 2021 13:18:07 -  1.351
+++ netinet/ip_carp.c   6 Feb 2021 14:45:34 -
@@ -786,10 +786,7 @@ carp_sysctl(int *name, u_int namelen, vo
 void
 carpattach(int n)
 {
-   struct ifg_group*ifg;
-
-   if ((ifg = if_creategroup("carp")) != NULL)
-   ifg->ifg_refcnt++;  /* keep around even if empty */
+   if_creategroup("carp");  /* keep around even if empty */
if_clone_attach(_cloner);
carpcounters = counters_alloc(carps_ncounters);
 }



Re: ftp: make use of getline(3)

2021-02-06 Thread Christian Weisgerber
Christian Weisgerber:

> Make use of getline(3) in ftp(1).
> 
> Replace fparseln(3) with getline(3).  This removes the only use
> of libutil.a(fparseln.o) from the ramdisk.
> Replace a complicated fgetln(3) idiom with the much simpler getline(3).

New diff that fixes a bug I introduced in cookie loading.

OK?

Index: distrib/special/ftp/Makefile
===
RCS file: /cvs/src/distrib/special/ftp/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- distrib/special/ftp/Makefile16 May 2019 12:44:17 -  1.14
+++ distrib/special/ftp/Makefile29 Jan 2021 18:05:46 -
@@ -6,7 +6,4 @@ PROG=   ftp
 SRCS=  fetch.c ftp.c main.c small.c util.c
 .PATH: ${.CURDIR}/../../../usr.bin/ftp
 
-LDADD+=-lutil
-DPADD+=${LIBUTIL}
-
 .include 
Index: usr.bin/ftp/Makefile
===
RCS file: /cvs/src/usr.bin/ftp/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- usr.bin/ftp/Makefile27 Jan 2021 22:27:41 -  1.34
+++ usr.bin/ftp/Makefile29 Jan 2021 17:57:31 -
@@ -8,8 +8,8 @@ PROG=   ftp
 SRCS=  cmds.c cmdtab.c complete.c cookie.c domacro.c fetch.c ftp.c \
list.c main.c ruserpass.c small.c stringlist.c util.c
 
-LDADD+=-ledit -lcurses -lutil -ltls -lssl -lcrypto
-DPADD+=${LIBEDIT} ${LIBCURSES} ${LIBUTIL} ${LIBTLS} ${LIBSSL} 
${LIBCRYPTO}
+LDADD+=-ledit -lcurses -ltls -lssl -lcrypto
+DPADD+=${LIBEDIT} ${LIBCURSES} ${LIBTLS} ${LIBSSL} ${LIBCRYPTO}
 
 #COPTS+= -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes
 
Index: usr.bin/ftp/cookie.c
===
RCS file: /cvs/src/usr.bin/ftp/cookie.c,v
retrieving revision 1.9
diff -u -p -r1.9 cookie.c
--- usr.bin/ftp/cookie.c16 May 2019 12:44:17 -  1.9
+++ usr.bin/ftp/cookie.c6 Feb 2021 16:23:32 -
@@ -58,10 +58,10 @@ void
 cookie_load(void)
 {
field_t  field;
-   size_t   len;
time_t   date;
char*line;
-   char*lbuf;
+   char*lbuf = NULL;
+   size_t   lbufsize = 0;
char*param;
const char  *estr;
FILE*fp;
@@ -75,19 +75,9 @@ cookie_load(void)
if (fp == NULL)
err(1, "cannot open cookie file %s", cookiefile);
date = time(NULL);
-   lbuf = NULL;
-   while ((line = fgetln(fp, )) != NULL) {
-   if (line[len - 1] == '\n') {
-   line[len - 1] = '\0';
-   --len;
-   } else {
-   if ((lbuf = malloc(len + 1)) == NULL)
-   err(1, NULL);
-   memcpy(lbuf, line, len);
-   lbuf[len] = '\0';
-   line = lbuf;
-   }
-   line[strcspn(line, "\r")] = '\0';
+   while (getline(, , fp) != -1) {
+   line = lbuf;
+   line[strcspn(line, "\r\n")] = '\0';
 
line += strspn(line, " \t");
if ((*line == '#') || (*line == '\0')) {
Index: usr.bin/ftp/fetch.c
===
RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.200
diff -u -p -r1.200 fetch.c
--- usr.bin/ftp/fetch.c 2 Feb 2021 12:58:42 -   1.200
+++ usr.bin/ftp/fetch.c 2 Feb 2021 13:59:09 -
@@ -56,7 +56,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -76,7 +75,6 @@ static void   aborthttp(int);
 static charhextochar(const char *);
 static char*urldecode(const char *);
 static char*recode_credentials(const char *_userinfo);
-static char*ftp_readline(FILE *, size_t *);
 static voidftp_close(FILE **, struct tls **, int *);
 static const char *sockerror(struct tls *);
 #ifdef SMALL
@@ -330,6 +328,7 @@ url_get(const char *origline, const char
off_t hashbytes;
const char *errstr;
ssize_t len, wlen;
+   size_t bufsize;
char *proxyhost = NULL;
 #ifndef NOSSL
char *sslpath = NULL, *sslhost = NULL;
@@ -805,12 +804,13 @@ noslash:
free(buf);
 #endif /* !NOSSL */
buf = NULL;
+   bufsize = 0;
 
if (fflush(fin) == EOF) {
warnx("Writing HTTP request: %s", sockerror(tls));
goto cleanup_url_get;
}
-   if ((buf = ftp_readline(fin, )) == NULL) {
+   if ((len = getline(, , fin)) == -1) {
warnx("Receiving HTTP reply: %s", sockerror(tls));
goto cleanup_url_get;
}
@@ -885,11 +885,10 @@ noslash:
/*
 * Read the rest of the header.
 */
-   free(buf);
filesize = -1;
 
for (;;) {
-   if ((buf = ftp_readline(fin, )) == NULL) {
+   if ((len = getline(, , fin)) == -1) {
   

unwind(8): improve DNS64 detection

2021-02-06 Thread Florian Obser
I noticed that sometimes DNS64 detection is not working correctly on
boot. Eventually I tracked it down to this:
Feb  6 08:56:22 x1 unwind[7139]: check_dns64_done: bad packet: too short: -1

The problem is that we are checking for dns64 while we might not yet
have a route to the nameserver provided by the router advertisement or
our IPv6 addresses are all tentative. Since we only re-schedule the
check when the network changes we are stuck. Instead we can check for
the presence of DNS64 when we know that DNS works, which is being
rescheduled correctly.

OK?


diff --git resolver.c resolver.c
index 302f381a0dd..95c32369830 100644
--- resolver.c
+++ resolver.c
@@ -1142,6 +1142,8 @@ new_resolver(enum uw_resolver_type type, enum 
uw_resolver_state state)
/* FALLTHROUGH */
case RESOLVING:
resolvers[type]->state = state;
+   if (type == UW_RES_ASR)
+   check_dns64();
break;
}
 }
@@ -2053,7 +2055,6 @@ replace_autoconf_forwarders(struct imsg_rdns_proposal 
*rdns_proposal)
new_resolver(UW_RES_ASR, UNKNOWN);
new_resolver(UW_RES_DHCP, UNKNOWN);
new_resolver(UW_RES_ODOT_DHCP, UNKNOWN);
-   check_dns64();
} else {
while ((tmp = TAILQ_FIRST(_forwarder_list)) != NULL) {
TAILQ_REMOVE(_forwarder_list, tmp, entry);



-- 
I'm not entirely sure you are real.



Re: unwind(8): open DNSSEC trustanchor late

2021-02-06 Thread Jeremie Courreges-Anglas
On Sat, Feb 06 2021, Florian Obser  wrote:
> On Sat, Feb 06, 2021 at 01:23:35AM +0100, Jeremie Courreges-Anglas wrote:
>> On Fri, Jan 29 2021, Florian Obser  wrote:
>> > Last piece of the puzzle...
>> >
>> > Re-try to open DNSSEC trust anchor file if /var is not mounted yet.
>> > With this we are able to start unwind before the network is up and
>> > partitions are mounted.
>> 
>> Sorry for being late to the party, I just upgraded to the latest snaps
>> and DNS broke.  Reverting this diff unbreaks unwind(8) operations.
>> 
>
> Could you be more specific what broke?

Yes, sorry for the lack of details.  I just didn't get any reply from
unwind(8).

Debug output with "preference { recursor }":

--8<--
shannon /usr/src/sbin/unwind$ sudo obj/unwind -dvv &
[1] 22635
shannon /usr/src/sbin/unwind$ fstat | grep unwind
_unwind  unwind 54878 text /usr/obj   103939  -rwxr-xr-x r 11104216
_unwind  unwind 54878   wd /var   155539  drwxr-xr-x r  512
_unwind  unwind 54878 root /var   155539  drwxr-xr-x r  512
_unwind  unwind 548780 /  104248  crw--wrwttyp6
_unwind  unwind 548781 /  104248  crw--wrwttyp6
_unwind  unwind 548782 /  104248  crw--wrwttyp6
_unwind  unwind 548783* unix stream 0x0
_unwind  unwind 548784 kqueue 0x0 0 state: W
_unwind  unwind 548785* unix stream 0x0
_unwind  unwind 548786* internet dgram udp 127.0.0.1:53
_unwind  unwind 548787* internet6 dgram udp [::1]:53
_unwind  unwind 548788* internet stream tcp 0x0 127.0.0.1:53
_unwind  unwind 548789* internet6 stream tcp 0x0 [::1]:53
_unwind  unwind 54878   10* unix stream 0x0 /dev/unwind.sock
_unwind  unwind 54878   11* route raw 0 0x0
_unwind  unwind 54878   12 /var   234193  -rw-r--r--   rwp  376
_unwind  unwind 39065 text /usr/obj   103939  -rwxr-xr-x r 11104216
_unwind  unwind 39065   wd /usr/src   398245  drwxr-xr-x r 4096
_unwind  unwind 390650 /  104248  crw--wrwttyp6
_unwind  unwind 390651 /  104248  crw--wrwttyp6
_unwind  unwind 390652 /  104248  crw--wrwttyp6
_unwind  unwind 390653* unix stream 0x0
_unwind  unwind 390654 kqueue 0x0 0 state: W
_unwind  unwind 390655* unix stream 0x0
root unwind 22635 text /usr/obj   103939  -rwxr-xr-x r 11104216
root unwind 22635   wd /usr/src   398245  drwxr-xr-x r 4096
root unwind 226350 /  104248  crw--wrwttyp6
root unwind 226351 /  104248  crw--wrwttyp6
root unwind 226352 /  104248  crw--wrwttyp6
root unwind 226353* unix stream 0x0
root unwind 226354 kqueue 0x0 0 state: W
root unwind 226355* unix stream 0x0
root unwind 22635   14* route raw 0 0x0
shannon /usr/src/sbin/unwind$ dig openbsd.org @127.0.0.1
from: [127.0.0.1]:14381
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 26482
;; flags: rd ad ; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
openbsd.org.IN  A

;; ANSWER SECTION:

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:
; EDNS: version: 0; flags: ; udp: 4096
;; MSG SIZE  rcvd: 40

[127.0.0.1]:14381: openbsd.org. IN A ?
try_next_resolver: could not find (any more) working resolvers
from: [127.0.0.1]:14381
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 26482
;; flags: rd ad ; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
openbsd.org.IN  A

;; ANSWER SECTION:

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:
; EDNS: version: 0; flags: ; udp: 4096
;; MSG SIZE  rcvd: 40

[127.0.0.1]:14381: openbsd.org. IN A ?
try_next_resolver: could not find (any more) working resolvers
from: [127.0.0.1]:14381
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 26482
;; flags: rd ad ; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
openbsd.org.IN  A

;; ANSWER SECTION:

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:
; EDNS: version: 0; flags: ; udp: 4096
;; MSG SIZE  rcvd: 40

[127.0.0.1]:14381: openbsd.org. IN A ?
try_next_resolver: could not find (any more) working resolvers
[... etc etc]
^C
shannon /usr/src/sbin/unwind$
-->8--


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE