Re: static const, not const static

2022-08-28 Thread Theo Buehler
On Mon, Aug 29, 2022 at 01:26:49PM +1000, Jonathan Gray wrote:
> c99 6.11.5:
> "The placement of a storage-class specifier other than at the beginning
> of the declaration specifiers in a declaration is an obsolescent
> feature."

ok tb



static const, not const static

2022-08-28 Thread Jonathan Gray
c99 6.11.5:
"The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature."

diff --git lib/libcrypto/ec/ecp_nistz256.c lib/libcrypto/ec/ecp_nistz256.c
index 05a16b8c074..4b2ab497327 100644
--- lib/libcrypto/ec/ecp_nistz256.c
+++ lib/libcrypto/ec/ecp_nistz256.c
@@ -573,12 +573,12 @@ ecp_nistz256_windowed_mul(const EC_GROUP *group, 
P256_POINT *r,
 }
 
 /* Coordinates of G, for which we have precomputed tables */
-const static BN_ULONG def_xG[P256_LIMBS] = {
+static const BN_ULONG def_xG[P256_LIMBS] = {
TOBN(0x79e730d4, 0x18a9143c), TOBN(0x75ba95fc, 0x5fedb601),
TOBN(0x79fb732b, 0x77622510), TOBN(0x18905f76, 0xa53755c6)
 };
 
-const static BN_ULONG def_yG[P256_LIMBS] = {
+static const BN_ULONG def_yG[P256_LIMBS] = {
TOBN(0xddf25357, 0xce95560a), TOBN(0x8b4ab8e4, 0xba19e45c),
TOBN(0xd2e88688, 0xdd21f325), TOBN(0x8571ff18, 0x25885d85)
 };
diff --git sys/arch/alpha/alpha/trap.c sys/arch/alpha/alpha/trap.c
index c80e0141d91..a4dd2040969 100644
--- sys/arch/alpha/alpha/trap.c
+++ sys/arch/alpha/alpha/trap.c
@@ -693,7 +693,7 @@ ast(framep)
userret(p);
 }
 
-const static int reg_to_framereg[32] = {
+static const int reg_to_framereg[32] = {
FRAME_V0,   FRAME_T0,   FRAME_T1,   FRAME_T2,
FRAME_T3,   FRAME_T4,   FRAME_T5,   FRAME_T6,
FRAME_T7,   FRAME_S0,   FRAME_S1,   FRAME_S2,
diff --git sys/arch/i386/pci/ali1543.c sys/arch/i386/pci/ali1543.c
index 298e07eed9d..24bc502242c 100644
--- sys/arch/i386/pci/ali1543.c
+++ sys/arch/i386/pci/ali1543.c
@@ -122,10 +122,10 @@ const struct pciintr_icu ali1543_icu = {
  * Linux source code (linux/arch/i386/kernel/pci-irq.c) says that the
  * irq order of ALi PCI ICU is shuffled.
  */
-const static int ali1543_intr_shuffle_get[16] = {
+static const int ali1543_intr_shuffle_get[16] = {
0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15
 };
-const static int ali1543_intr_shuffle_set[16] = {
+static const int ali1543_intr_shuffle_set[16] = {
0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15
 };
 
diff --git sys/crypto/sha2.c sys/crypto/sha2.c
index 769b73262ca..ec866c2ce70 100644
--- sys/crypto/sha2.c
+++ sys/crypto/sha2.c
@@ -152,7 +152,7 @@ void SHA512Transform(u_int64_t *, const u_int8_t *);
 
 /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS /
 /* Hash constant words K for SHA-256: */
-const static u_int32_t K256[64] = {
+static const u_int32_t K256[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
@@ -172,7 +172,7 @@ const static u_int32_t K256[64] = {
 };
 
 /* Initial hash value H for SHA-256: */
-const static u_int32_t sha256_initial_hash_value[8] = {
+static const u_int32_t sha256_initial_hash_value[8] = {
0x6a09e667UL,
0xbb67ae85UL,
0x3c6ef372UL,
@@ -184,7 +184,7 @@ const static u_int32_t sha256_initial_hash_value[8] = {
 };
 
 /* Hash constant words K for SHA-384 and SHA-512: */
-const static u_int64_t K512[80] = {
+static const u_int64_t K512[80] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
@@ -228,7 +228,7 @@ const static u_int64_t K512[80] = {
 };
 
 /* Initial hash value H for SHA-384 */
-const static u_int64_t sha384_initial_hash_value[8] = {
+static const u_int64_t sha384_initial_hash_value[8] = {
0xcbbb9d5dc1059ed8ULL,
0x629a292a367cd507ULL,
0x9159015a3070dd17ULL,
@@ -240,7 +240,7 @@ const static u_int64_t sha384_initial_hash_value[8] = {
 };
 
 /* Initial hash value H for SHA-512 */
-const static u_int64_t sha512_initial_hash_value[8] = {
+static const u_int64_t sha512_initial_hash_value[8] = {
0x6a09e667f3bcc908ULL,
0xbb67ae8584caa73bULL,
0x3c6ef372fe94f82bULL,
diff --git sys/dev/ic/adwlib.c sys/dev/ic/adwlib.c
index 2e346d52dd0..54a4ffefdd4 100644
--- sys/dev/ic/adwlib.c
+++ sys/dev/ic/adwlib.c
@@ -95,7 +95,7 @@ void AdwDelayMicroSecond(u_int32_t);
  * Additional structure information can be found in adwlib.h where
  * the structure is defined.
  */
-const static ADW_EEPROM adw_3550_Default_EEPROM = {
+static const ADW_EEPROM adw_3550_Default_EEPROM = {
ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
0x, /* 01 cfg_msw */
0x, /* 02 disc_enable */
@@ -132,7 +132,7 @@ const static ADW_EEPROM adw_3550_Default_EEPROM = {
0   /* 35 saved_adw_err_addr */
 };
 
-const static ADW_EEPROM adw_38C0800_Default_EEPROM = {
+static const ADW_EEPROM adw_38C0800_Default_EEPROM = {
ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
0x, /* 01 cfg_msw */
0x, /* 02 disc_enable */
@@ -178,7 

Re: libfido2 update

2022-08-28 Thread Damien Miller
On Sun, 28 Aug 2022, Stuart Henderson wrote:

> On 2022/08/24 17:09, Damien Miller wrote:
> > Hi,
> > 
> > https://www.mindrot.org/misc/libfido2-1.11.0.diff contains an update
> > for src/libfido2 from 1.8 to 1.11 (about 10 months of upstream
> > development).
> > 
> > I've tested it with OpenSSH, which is the only thing in src/ that
> > uses it as well as compiling www/chromium and performing a FIDO login
> > with it.
> > 
> > ok?
> > 
> > -d
> > 
> 
> Works for me, OK sthen@.

Thanks!

> Would you mind adding NEWS from upstream so we can see a quick summary
> of what's changed please?

done



Re: use volatile not __volatile

2022-08-28 Thread Philip Guenther
On Sat, Aug 27, 2022 at 6:31 PM Jonathan Gray  wrote:

> directly use ansi volatile keyword not __volatile from cdefs.h
>

Yay!
ok guenther@


Re: use volatile not __volatile__

2022-08-28 Thread Philip Guenther
On Sat, Aug 27, 2022 at 6:41 PM Jonathan Gray  wrote:

> directly use ansi volatile keyword not __volatile__ builtin
>

Yes, please.  ok guenther@


Re: static inline, not inline static

2022-08-28 Thread Philip Guenther
On Sun, Aug 28, 2022 at 2:11 PM Anders Andersson  wrote:

> On Sun, Aug 28, 2022 at 3:15 PM Jonathan Gray  wrote:
> >
> > diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
> > index ea50c5ae1b6..14c7f0c466d 100644
> > --- lib/libc/locale/wctoint.h
> > +++ lib/libc/locale/wctoint.h
> > @@ -30,7 +30,7 @@
> >   */
> >
> >
> > -inline static int
> > +static inline int
> >  wctoint(wchar_t wc)
> >  {
> > int n;
> > [...]
>
> Why this change? As far as I can see, the standard allows for any order.
>

C99 standard stated:
"The placement of a storage-class specifier other than at the beginning
of the declaration
 specifiers in a declaration is an obsolescent feature.

My recall is that it was officially removed in C11.

ok guenther@


Re: static inline, not inline static

2022-08-28 Thread Anders Andersson
On Sun, Aug 28, 2022 at 3:15 PM Jonathan Gray  wrote:
>
> diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
> index ea50c5ae1b6..14c7f0c466d 100644
> --- lib/libc/locale/wctoint.h
> +++ lib/libc/locale/wctoint.h
> @@ -30,7 +30,7 @@
>   */
>
>
> -inline static int
> +static inline int
>  wctoint(wchar_t wc)
>  {
> int n;
> [...]

Why this change? As far as I can see, the standard allows for any order.



move PRU_RCVOOB request to (*pru_rcvoob)()

2022-08-28 Thread Vitaliy Makkoveev
Index: sys/kern/uipc_usrreq.c
===
RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.178
diff -u -p -r1.178 uipc_usrreq.c
--- sys/kern/uipc_usrreq.c  28 Aug 2022 21:35:11 -  1.178
+++ sys/kern/uipc_usrreq.c  28 Aug 2022 22:12:04 -
@@ -247,7 +247,6 @@ uipc_usrreq(struct socket *so, int req, 
}
break;
 
-   case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
Index: sys/net/pfkeyv2.c
===
RCS file: /cvs/src/sys/net/pfkeyv2.c,v
retrieving revision 1.246
diff -u -p -r1.246 pfkeyv2.c
--- sys/net/pfkeyv2.c   28 Aug 2022 21:35:11 -  1.246
+++ sys/net/pfkeyv2.c   28 Aug 2022 22:12:05 -
@@ -426,7 +426,6 @@ pfkeyv2_usrreq(struct socket *so, int re
nam->m_len = pfkey_addr.sa_len;
break;
 
-   case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
Index: sys/net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.346
diff -u -p -r1.346 rtsock.c
--- sys/net/rtsock.c28 Aug 2022 21:35:12 -  1.346
+++ sys/net/rtsock.c28 Aug 2022 22:12:05 -
@@ -251,7 +251,6 @@ route_usrreq(struct socket *so, int req,
nam->m_len = route_src.sa_len;
break;
 
-   case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
Index: sys/netinet/ip_divert.c
===
RCS file: /cvs/src/sys/netinet/ip_divert.c,v
retrieving revision 1.80
diff -u -p -r1.80 ip_divert.c
--- sys/netinet/ip_divert.c 28 Aug 2022 21:35:12 -  1.80
+++ sys/netinet/ip_divert.c 28 Aug 2022 22:12:05 -
@@ -285,7 +285,6 @@ divert_usrreq(struct socket *so, int req
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
-   case PRU_RCVOOB:
error =  EOPNOTSUPP;
break;
 
Index: sys/netinet/raw_ip.c
===
RCS file: /cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.141
diff -u -p -r1.141 raw_ip.c
--- sys/netinet/raw_ip.c28 Aug 2022 21:35:12 -  1.141
+++ sys/netinet/raw_ip.c28 Aug 2022 22:12:05 -
@@ -486,7 +486,6 @@ rip_usrreq(struct socket *so, int req, s
 * Not supported.
 */
case PRU_SENDOOB:
-   case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
 
Index: sys/netinet/tcp_usrreq.c
===
RCS file: /cvs/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.198
diff -u -p -r1.198 tcp_usrreq.c
--- sys/netinet/tcp_usrreq.c28 Aug 2022 21:35:12 -  1.198
+++ sys/netinet/tcp_usrreq.c28 Aug 2022 22:12:05 -
@@ -125,6 +125,7 @@ const struct pr_usrreqs tcp_usrreqs = {
.pru_send   = tcp_send,
.pru_abort  = tcp_abort,
.pru_sense  = tcp_sense,
+   .pru_rcvoob = tcp_rcvoob,
 };
 
 static int pr_slowhz = PR_SLOWHZ;
@@ -228,24 +229,6 @@ tcp_usrreq(struct socket *so, int req, s
error = EOPNOTSUPP;
break;
 
-   case PRU_RCVOOB:
-   if ((so->so_oobmark == 0 &&
-   (so->so_state & SS_RCVATMARK) == 0) ||
-   so->so_options & SO_OOBINLINE ||
-   tp->t_oobflags & TCPOOB_HADDATA) {
-   error = EINVAL;
-   break;
-   }
-   if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) {
-   error = EWOULDBLOCK;
-   break;
-   }
-   m->m_len = 1;
-   *mtod(m, caddr_t) = tp->t_iobc;
-   if (((long)nam & MSG_PEEK) == 0)
-   tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
-   break;
-
case PRU_SENDOOB:
if (sbspace(so, >so_snd) < -512) {
m_freem(m);
@@ -998,6 +981,39 @@ tcp_sense(struct socket *so, struct stat
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_SENSE, 0);
return (0);
+}
+
+int
+tcp_rcvoob(struct socket *so, struct mbuf *m, int flags)
+{
+   struct inpcb *inp;
+   struct tcpcb *tp;
+   int error;
+
+   soassertlocked(so);
+
+   if ((error = tcp_sogetpcb(so, , )))
+   return (error);
+
+   if ((so->so_oobmark == 0 &&
+   (so->so_state & SS_RCVATMARK) == 0) ||
+   so->so_options & SO_OOBINLINE ||
+   tp->t_oobflags & TCPOOB_HADDATA) {
+   error = EINVAL;
+   goto out;
+   }
+   if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) 

Re: move PRU_SENSE request to (*pru_sense)()

2022-08-28 Thread Alexander Bluhm
On Mon, Aug 29, 2022 at 12:18:49AM +0300, Vitaliy Makkoveev wrote:
> On Sun, Aug 28, 2022 at 10:42:11PM +0200, Alexander Bluhm wrote:
> > On Sun, Aug 28, 2022 at 10:51:31PM +0300, Vitaliy Makkoveev wrote:
> > > Another candidate for future refactoring. Except the tcp(4) and unix(4)
> > > cases we do nothing with passed `ub', but in all cases we return no
> > > error.
> > 
> > Instead of adding all these return(0) functions, we should return(0)
> > in pru_sense() if .pru_sense == NULL.
> 
> No problem. Updated diff.

> --- sys/sys/unpcb.h   28 Aug 2022 18:44:17 -  1.36
> +++ sys/sys/unpcb.h   28 Aug 2022 21:16:14 -
...
> +int  uipc_sense(struct socket *, struct stat *u);

Do not put variable name in prototype.  Remove the u

OK bluhm@



Re: move PRU_SENSE request to (*pru_sense)()

2022-08-28 Thread Vitaliy Makkoveev
On Sun, Aug 28, 2022 at 10:42:11PM +0200, Alexander Bluhm wrote:
> On Sun, Aug 28, 2022 at 10:51:31PM +0300, Vitaliy Makkoveev wrote:
> > Another candidate for future refactoring. Except the tcp(4) and unix(4)
> > cases we do nothing with passed `ub', but in all cases we return no
> > error.
> 
> Instead of adding all these return(0) functions, we should return(0)
> in pru_sense() if .pru_sense == NULL.
> 

No problem. Updated diff.

Index: sys/kern/uipc_usrreq.c
===
RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.177
diff -u -p -r1.177 uipc_usrreq.c
--- sys/kern/uipc_usrreq.c  28 Aug 2022 18:44:16 -  1.177
+++ sys/kern/uipc_usrreq.c  28 Aug 2022 21:16:13 -
@@ -139,6 +139,7 @@ const struct pr_usrreqs uipc_usrreqs = {
.pru_rcvd   = uipc_rcvd,
.pru_send   = uipc_send,
.pru_abort  = uipc_abort,
+   .pru_sense  = uipc_sense,
 };
 
 void
@@ -246,25 +247,6 @@ uipc_usrreq(struct socket *so, int req, 
}
break;
 
-   case PRU_SENSE: {
-   struct stat *sb = (struct stat *)m;
-
-   sb->st_blksize = so->so_snd.sb_hiwat;
-   sb->st_dev = NODEV;
-   mtx_enter(_ino_mtx);
-   if (unp->unp_ino == 0)
-   unp->unp_ino = unp_ino++;
-   mtx_leave(_ino_mtx);
-   sb->st_atim.tv_sec =
-   sb->st_mtim.tv_sec =
-   sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
-   sb->st_atim.tv_nsec =
-   sb->st_mtim.tv_nsec =
-   sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
-   sb->st_ino = unp->unp_ino;
-   break;
-   }
-
case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
@@ -593,6 +575,28 @@ uipc_abort(struct socket *so)
 
unp_detach(unp);
sofree(so, 0);
+
+   return (0);
+}
+
+int
+uipc_sense(struct socket *so, struct stat *sb)
+{
+   struct unpcb *unp = sotounpcb(so);
+
+   sb->st_blksize = so->so_snd.sb_hiwat;
+   sb->st_dev = NODEV;
+   mtx_enter(_ino_mtx);
+   if (unp->unp_ino == 0)
+   unp->unp_ino = unp_ino++;
+   mtx_leave(_ino_mtx);
+   sb->st_atim.tv_sec =
+   sb->st_mtim.tv_sec =
+   sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
+   sb->st_atim.tv_nsec =
+   sb->st_mtim.tv_nsec =
+   sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
+   sb->st_ino = unp->unp_ino;
 
return (0);
 }
Index: sys/net/pfkeyv2.c
===
RCS file: /cvs/src/sys/net/pfkeyv2.c,v
retrieving revision 1.244
diff -u -p -r1.244 pfkeyv2.c
--- sys/net/pfkeyv2.c   28 Aug 2022 18:44:16 -  1.244
+++ sys/net/pfkeyv2.c   28 Aug 2022 21:16:14 -
@@ -419,10 +419,6 @@ pfkeyv2_usrreq(struct socket *so, int re
error = EOPNOTSUPP;
break;
 
-   case PRU_SENSE:
-   /* stat: don't bother with a blocksize. */
-   break;
-
/* minimal support, just implement a fake peer address */
case PRU_SOCKADDR:
error = EINVAL;
Index: sys/net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.344
diff -u -p -r1.344 rtsock.c
--- sys/net/rtsock.c28 Aug 2022 18:44:16 -  1.344
+++ sys/net/rtsock.c28 Aug 2022 21:16:14 -
@@ -243,10 +243,6 @@ route_usrreq(struct socket *so, int req,
error = EOPNOTSUPP;
break;
 
-   case PRU_SENSE:
-   /* stat: don't bother with a blocksize. */
-   break;
-
/* minimal support, just implement a fake peer address */
case PRU_SOCKADDR:
error = EINVAL;
Index: sys/netinet/ip_divert.c
===
RCS file: /cvs/src/sys/netinet/ip_divert.c,v
retrieving revision 1.79
diff -u -p -r1.79 ip_divert.c
--- sys/netinet/ip_divert.c 28 Aug 2022 18:44:16 -  1.79
+++ sys/netinet/ip_divert.c 28 Aug 2022 21:16:14 -
@@ -279,9 +279,6 @@ divert_usrreq(struct socket *so, int req
in_setpeeraddr(inp, addr);
break;
 
-   case PRU_SENSE:
-   break;
-
case PRU_CONNECT2:
case PRU_SENDOOB:
case PRU_FASTTIMO:
Index: sys/netinet/raw_ip.c
===
RCS file: /cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.140
diff -u -p -r1.140 raw_ip.c
--- sys/netinet/raw_ip.c28 Aug 2022 18:44:16 -  1.140
+++ sys/netinet/raw_ip.c28 Aug 2022 21:16:14 -
@@ -482,12 +482,6 @@ rip_usrreq(struct socket *so, int req, s
error = EOPNOTSUPP;
break;
 
-   case PRU_SENSE:
-   /*
- 

Re: move PRU_SENSE request to (*pru_sense)()

2022-08-28 Thread Alexander Bluhm
On Sun, Aug 28, 2022 at 10:51:31PM +0300, Vitaliy Makkoveev wrote:
> Another candidate for future refactoring. Except the tcp(4) and unix(4)
> cases we do nothing with passed `ub', but in all cases we return no
> error.

Instead of adding all these return(0) functions, we should return(0)
in pru_sense() if .pru_sense == NULL.

> Index: sys/kern/uipc_usrreq.c
> ===
> RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
> retrieving revision 1.177
> diff -u -p -r1.177 uipc_usrreq.c
> --- sys/kern/uipc_usrreq.c28 Aug 2022 18:44:16 -  1.177
> +++ sys/kern/uipc_usrreq.c28 Aug 2022 19:46:18 -
> @@ -139,6 +139,7 @@ const struct pr_usrreqs uipc_usrreqs = {
>   .pru_rcvd   = uipc_rcvd,
>   .pru_send   = uipc_send,
>   .pru_abort  = uipc_abort,
> + .pru_sense  = uipc_sense,
>  };
>  
>  void
> @@ -246,25 +247,6 @@ uipc_usrreq(struct socket *so, int req, 
>   }
>   break;
>  
> - case PRU_SENSE: {
> - struct stat *sb = (struct stat *)m;
> -
> - sb->st_blksize = so->so_snd.sb_hiwat;
> - sb->st_dev = NODEV;
> - mtx_enter(_ino_mtx);
> - if (unp->unp_ino == 0)
> - unp->unp_ino = unp_ino++;
> - mtx_leave(_ino_mtx);
> - sb->st_atim.tv_sec =
> - sb->st_mtim.tv_sec =
> - sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
> - sb->st_atim.tv_nsec =
> - sb->st_mtim.tv_nsec =
> - sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
> - sb->st_ino = unp->unp_ino;
> - break;
> - }
> -
>   case PRU_RCVOOB:
>   case PRU_SENDOOB:
>   error = EOPNOTSUPP;
> @@ -593,6 +575,28 @@ uipc_abort(struct socket *so)
>  
>   unp_detach(unp);
>   sofree(so, 0);
> +
> + return (0);
> +}
> +
> +int
> +uipc_sense(struct socket *so, struct stat *sb)
> +{
> + struct unpcb *unp = sotounpcb(so);
> +
> + sb->st_blksize = so->so_snd.sb_hiwat;
> + sb->st_dev = NODEV;
> + mtx_enter(_ino_mtx);
> + if (unp->unp_ino == 0)
> + unp->unp_ino = unp_ino++;
> + mtx_leave(_ino_mtx);
> + sb->st_atim.tv_sec =
> + sb->st_mtim.tv_sec =
> + sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
> + sb->st_atim.tv_nsec =
> + sb->st_mtim.tv_nsec =
> + sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
> + sb->st_ino = unp->unp_ino;
>  
>   return (0);
>  }
> Index: sys/net/pfkeyv2.c
> ===
> RCS file: /cvs/src/sys/net/pfkeyv2.c,v
> retrieving revision 1.244
> diff -u -p -r1.244 pfkeyv2.c
> --- sys/net/pfkeyv2.c 28 Aug 2022 18:44:16 -  1.244
> +++ sys/net/pfkeyv2.c 28 Aug 2022 19:46:20 -
> @@ -176,6 +176,7 @@ int pfkeyv2_shutdown(struct socket *);
>  int pfkeyv2_send(struct socket *, struct mbuf *, struct mbuf *,
>  struct mbuf *);
>  int pfkeyv2_abort(struct socket *);
> +int pfkeyv2_sense(struct socket *, struct stat *);
>  int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
>  struct mbuf *, struct proc *);
>  int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *,
> @@ -212,6 +213,7 @@ const struct pr_usrreqs pfkeyv2_usrreqs 
>   .pru_shutdown   = pfkeyv2_shutdown,
>   .pru_send   = pfkeyv2_send,
>   .pru_abort  = pfkeyv2_abort,
> + .pru_sense  = pfkeyv2_sense,
>  };
>  
>  const struct protosw pfkeysw[] = {
> @@ -391,6 +393,13 @@ pfkeyv2_abort(struct socket *so)
>  }
>  
>  int
> +pfkeyv2_sense(struct socket *so, struct stat *ub)
> +{
> + /* stat: don't bother with a blocksize. */
> + return (0);
> +}
> +
> +int
>  pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m,
>  struct mbuf *nam, struct mbuf *control, struct proc *p)
>  {
> @@ -417,10 +426,6 @@ pfkeyv2_usrreq(struct socket *so, int re
>   /* no connect, bind, accept. Socket is connected from the start */
>   case PRU_CONNECT2:
>   error = EOPNOTSUPP;
> - break;
> -
> - case PRU_SENSE:
> - /* stat: don't bother with a blocksize. */
>   break;
>  
>   /* minimal support, just implement a fake peer address */
> Index: sys/net/rtsock.c
> ===
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.344
> diff -u -p -r1.344 rtsock.c
> --- sys/net/rtsock.c  28 Aug 2022 18:44:16 -  1.344
> +++ sys/net/rtsock.c  28 Aug 2022 19:46:21 -
> @@ -120,6 +120,7 @@ int   route_rcvd(struct socket *);
>  int  route_send(struct socket *, struct mbuf *, struct mbuf *,
>   struct mbuf *);
>  int  route_abort(struct socket *);
> +int  route_sense(struct socket *, struct stat *);
>  void route_input(struct mbuf *m0, struct socket *, sa_family_t);
>  int  route_arp_conflict(struct rtentry *, struct 

i386/lapic.c: sync with amd64/lapic.c

2022-08-28 Thread Scott Cheloha
As promised off-list: in anticipation of merging the clock interrupt
code, let's sync up the lapic timer parts of i386/lapic.c with the
corresponding parts in amd64/lapic.c.  They will need identical
changes to use the new code, so the more alike they are the better.

Notable differences remaining in the timer code:

- We use i82489_readreg() and i82489_writereg() on i386 instead of
  lapic_readreg() and lapic_writereg().

- lapic_clockintr() is just plain different on i386, I'm not
  touching it yet.

- No way to skip_calibration on i386.

We can do synchronized cleanup in a later patch.

Does this compile and boot on i386?  If so, ok?

Index: i386/i386/lapic.c
===
RCS file: /cvs/src/sys/arch/i386/i386/lapic.c,v
retrieving revision 1.50
diff -u -p -r1.50 lapic.c
--- i386/i386/lapic.c   25 Aug 2022 17:38:16 -  1.50
+++ i386/i386/lapic.c   28 Aug 2022 20:24:55 -
@@ -244,11 +244,41 @@ u_int32_t lapic_tval;
 /*
  * this gets us up to a 4GHz busclock
  */
-u_int32_t lapic_per_second;
+u_int32_t lapic_per_second = 0;
 u_int32_t lapic_frac_usec_per_cycle;
 u_int64_t lapic_frac_cycle_per_usec;
 u_int32_t lapic_delaytab[26];
 
+void lapic_timer_oneshot(uint32_t, uint32_t);
+void lapic_timer_periodic(uint32_t, uint32_t);
+
+/*
+ * Start the local apic countdown timer.
+ *
+ * First set the mode, mask, and vector.  Then set the
+ * divisor.  Last, set the cycle count: this restarts
+ * the countdown.
+ */
+static inline void
+lapic_timer_start(uint32_t mode, uint32_t mask, uint32_t cycles)
+{
+   i82489_writereg(LAPIC_LVTT, mode | mask | LAPIC_TIMER_VECTOR);
+   i82489_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
+   i82489_writereg(LAPIC_ICR_TIMER, cycles);
+}
+
+void
+lapic_timer_oneshot(uint32_t mask, uint32_t cycles)
+{
+   lapic_timer_start(LAPIC_LVTT_TM_ONESHOT, mask, cycles);
+}
+
+void
+lapic_timer_periodic(uint32_t mask, uint32_t cycles)
+{
+   lapic_timer_start(LAPIC_LVTT_TM_PERIODIC, mask, cycles);
+}
+
 void
 lapic_clockintr(void *arg)
 {
@@ -262,17 +292,7 @@ lapic_clockintr(void *arg)
 void
 lapic_startclock(void)
 {
-   /*
-* Start local apic countdown timer running, in repeated mode.
-*
-* Mask the clock interrupt and set mode,
-* then set divisor,
-* then unmask and set the vector.
-*/
-   i82489_writereg(LAPIC_LVTT, LAPIC_LVTT_TM|LAPIC_LVTT_M);
-   i82489_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
-   i82489_writereg(LAPIC_ICR_TIMER, lapic_tval);
-   i82489_writereg(LAPIC_LVTT, LAPIC_LVTT_TM|LAPIC_TIMER_VECTOR);
+   lapic_timer_periodic(0, lapic_tval);
 }
 
 void
@@ -284,6 +304,7 @@ lapic_initclocks(void)
 }
 
 extern int gettick(void);  /* XXX put in header file */
+extern u_long rtclock_tval; /* XXX put in header file */
 
 static __inline void
 wait_next_cycle(void)
@@ -325,38 +346,45 @@ lapic_calibrate_timer(struct cpu_info *c
 * Configure timer to one-shot, interrupt masked,
 * large positive number.
 */
-   i82489_writereg(LAPIC_LVTT, LAPIC_LVTT_M);
-   i82489_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
-   i82489_writereg(LAPIC_ICR_TIMER, 0x8000);
+   lapic_timer_oneshot(LAPIC_LVTT_M, 0x8000);
 
-   s = intr_disable();
+   if (delay_func == i8254_delay) {
+   s = intr_disable();
 
-   /* wait for current cycle to finish */
-   wait_next_cycle();
+   /* wait for current cycle to finish */
+   wait_next_cycle();
 
-   startapic = lapic_gettick();
+   startapic = lapic_gettick();
 
-   /* wait the next hz cycles */
-   for (i = 0; i < hz; i++)
-   wait_next_cycle();
+   /* wait the next hz cycles */
+   for (i = 0; i < hz; i++)
+   wait_next_cycle();
 
-   endapic = lapic_gettick();
+   endapic = lapic_gettick();
 
-   intr_restore(s);
+   intr_restore(s);
 
-   dtick = hz * TIMER_DIV(hz);
-   dapic = startapic-endapic;
+   dtick = hz * rtclock_tval;
+   dapic = startapic-endapic;
 
-   /*
-* there are TIMER_FREQ ticks per second.
-* in dtick ticks, there are dapic bus clocks.
-*/
-   tmp = (TIMER_FREQ * dapic) / dtick;
+   /*
+* there are TIMER_FREQ ticks per second.
+* in dtick ticks, there are dapic bus clocks.
+*/
+   tmp = (TIMER_FREQ * dapic) / dtick;
 
-   lapic_per_second = tmp;
+   lapic_per_second = tmp;
+   } else {
+   s = intr_disable();
+   startapic = lapic_gettick();
+   delay(1 * 1000 * 1000);
+   endapic = lapic_gettick();
+   intr_restore(s);
+   lapic_per_second = startapic - endapic;
+   }
 
-   printf("%s: apic clock running at %lldMHz\n",
-   

move PRU_SENSE request to (*pru_sense)()

2022-08-28 Thread Vitaliy Makkoveev
Another candidate for future refactoring. Except the tcp(4) and unix(4)
cases we do nothing with passed `ub', but in all cases we return no
error.

Index: sys/kern/uipc_usrreq.c
===
RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.177
diff -u -p -r1.177 uipc_usrreq.c
--- sys/kern/uipc_usrreq.c  28 Aug 2022 18:44:16 -  1.177
+++ sys/kern/uipc_usrreq.c  28 Aug 2022 19:46:18 -
@@ -139,6 +139,7 @@ const struct pr_usrreqs uipc_usrreqs = {
.pru_rcvd   = uipc_rcvd,
.pru_send   = uipc_send,
.pru_abort  = uipc_abort,
+   .pru_sense  = uipc_sense,
 };
 
 void
@@ -246,25 +247,6 @@ uipc_usrreq(struct socket *so, int req, 
}
break;
 
-   case PRU_SENSE: {
-   struct stat *sb = (struct stat *)m;
-
-   sb->st_blksize = so->so_snd.sb_hiwat;
-   sb->st_dev = NODEV;
-   mtx_enter(_ino_mtx);
-   if (unp->unp_ino == 0)
-   unp->unp_ino = unp_ino++;
-   mtx_leave(_ino_mtx);
-   sb->st_atim.tv_sec =
-   sb->st_mtim.tv_sec =
-   sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
-   sb->st_atim.tv_nsec =
-   sb->st_mtim.tv_nsec =
-   sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
-   sb->st_ino = unp->unp_ino;
-   break;
-   }
-
case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
@@ -593,6 +575,28 @@ uipc_abort(struct socket *so)
 
unp_detach(unp);
sofree(so, 0);
+
+   return (0);
+}
+
+int
+uipc_sense(struct socket *so, struct stat *sb)
+{
+   struct unpcb *unp = sotounpcb(so);
+
+   sb->st_blksize = so->so_snd.sb_hiwat;
+   sb->st_dev = NODEV;
+   mtx_enter(_ino_mtx);
+   if (unp->unp_ino == 0)
+   unp->unp_ino = unp_ino++;
+   mtx_leave(_ino_mtx);
+   sb->st_atim.tv_sec =
+   sb->st_mtim.tv_sec =
+   sb->st_ctim.tv_sec = unp->unp_ctime.tv_sec;
+   sb->st_atim.tv_nsec =
+   sb->st_mtim.tv_nsec =
+   sb->st_ctim.tv_nsec = unp->unp_ctime.tv_nsec;
+   sb->st_ino = unp->unp_ino;
 
return (0);
 }
Index: sys/net/pfkeyv2.c
===
RCS file: /cvs/src/sys/net/pfkeyv2.c,v
retrieving revision 1.244
diff -u -p -r1.244 pfkeyv2.c
--- sys/net/pfkeyv2.c   28 Aug 2022 18:44:16 -  1.244
+++ sys/net/pfkeyv2.c   28 Aug 2022 19:46:20 -
@@ -176,6 +176,7 @@ int pfkeyv2_shutdown(struct socket *);
 int pfkeyv2_send(struct socket *, struct mbuf *, struct mbuf *,
 struct mbuf *);
 int pfkeyv2_abort(struct socket *);
+int pfkeyv2_sense(struct socket *, struct stat *);
 int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
 struct mbuf *, struct proc *);
 int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *,
@@ -212,6 +213,7 @@ const struct pr_usrreqs pfkeyv2_usrreqs 
.pru_shutdown   = pfkeyv2_shutdown,
.pru_send   = pfkeyv2_send,
.pru_abort  = pfkeyv2_abort,
+   .pru_sense  = pfkeyv2_sense,
 };
 
 const struct protosw pfkeysw[] = {
@@ -391,6 +393,13 @@ pfkeyv2_abort(struct socket *so)
 }
 
 int
+pfkeyv2_sense(struct socket *so, struct stat *ub)
+{
+   /* stat: don't bother with a blocksize. */
+   return (0);
+}
+
+int
 pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m,
 struct mbuf *nam, struct mbuf *control, struct proc *p)
 {
@@ -417,10 +426,6 @@ pfkeyv2_usrreq(struct socket *so, int re
/* no connect, bind, accept. Socket is connected from the start */
case PRU_CONNECT2:
error = EOPNOTSUPP;
-   break;
-
-   case PRU_SENSE:
-   /* stat: don't bother with a blocksize. */
break;
 
/* minimal support, just implement a fake peer address */
Index: sys/net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.344
diff -u -p -r1.344 rtsock.c
--- sys/net/rtsock.c28 Aug 2022 18:44:16 -  1.344
+++ sys/net/rtsock.c28 Aug 2022 19:46:21 -
@@ -120,6 +120,7 @@ int route_rcvd(struct socket *);
 introute_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *);
 introute_abort(struct socket *);
+introute_sense(struct socket *, struct stat *);
 void   route_input(struct mbuf *m0, struct socket *, sa_family_t);
 introute_arp_conflict(struct rtentry *, struct rt_addrinfo *);
 introute_cleargateway(struct rtentry *, void *, unsigned int);
@@ -243,10 +244,6 @@ route_usrreq(struct socket *so, int req,
error = EOPNOTSUPP;
break;
 
-   case PRU_SENSE:
-   /* stat: don't bother with a blocksize. */
-   break;

Re: remove pr_output

2022-08-28 Thread Vitaliy Makkoveev
> On 28 Aug 2022, at 20:48, Alexander Bluhm  wrote:
> 
> Hi,
> 
> Since we have no raw_usrreq anymore, we can retire pr_output.
> pfkeyv2 and route can call ther output functions directly.
> 
> ok?
> 

ok mvs@

> bluhm
> 
> Index: net/pfkeyv2.c
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkeyv2.c,v
> retrieving revision 1.243
> diff -u -p -r1.243 pfkeyv2.c
> --- net/pfkeyv2.c 27 Aug 2022 20:28:01 -  1.243
> +++ net/pfkeyv2.c 28 Aug 2022 16:50:24 -
> @@ -177,8 +177,7 @@ int pfkeyv2_send(struct socket *, struct
> struct mbuf *);
> int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
> struct mbuf *, struct proc *);
> -int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *,
> -struct mbuf *);
> +int pfkeyv2_output(struct mbuf *, struct socket *);
> int pfkey_sendup(struct pkpcb *, struct mbuf *, int);
> int pfkeyv2_sa_flush(struct tdb *, void *, int);
> int pfkeyv2_policy_flush(struct ipsec_policy *, void *, unsigned int);
> @@ -218,7 +217,6 @@ const struct protosw pfkeysw[] = {
>   .pr_domain= ,
>   .pr_protocol  = PF_KEY_V2,
>   .pr_flags = PR_ATOMIC | PR_ADDR,
> -  .pr_output= pfkeyv2_output,
>   .pr_usrreqs   = _usrreqs,
>   .pr_sysctl= pfkeyv2_sysctl,
> }
> @@ -371,7 +369,7 @@ pfkeyv2_send(struct socket *so, struct m
>   goto out;
>   }
> 
> - error = (*so->so_proto->pr_output)(m, so, NULL, NULL);
> + error = pfkeyv2_output(m, so);
>   m = NULL;
> 
> out:
> @@ -443,8 +441,7 @@ pfkeyv2_usrreq(struct socket *so, int re
> }
> 
> int
> -pfkeyv2_output(struct mbuf *mbuf, struct socket *so,
> -struct sockaddr *dstaddr, struct mbuf *control)
> +pfkeyv2_output(struct mbuf *mbuf, struct socket *so)
> {
>   void *message;
>   int error = 0;
> Index: net/rtsock.c
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.343
> diff -u -p -r1.343 rtsock.c
> --- net/rtsock.c  27 Aug 2022 20:28:01 -  1.343
> +++ net/rtsock.c  28 Aug 2022 16:50:51 -
> @@ -109,8 +109,7 @@ struct walkarg {
> void  route_prinit(void);
> void  rcb_ref(void *, void *);
> void  rcb_unref(void *, void *);
> -int  route_output(struct mbuf *, struct socket *, struct sockaddr *,
> - struct mbuf *);
> +int  route_output(struct mbuf *, struct socket *);
> int   route_ctloutput(int, struct socket *, int, int, struct mbuf *);
> int   route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
>   struct mbuf *, struct proc *);
> @@ -395,7 +394,7 @@ route_send(struct socket *so, struct mbu
>   goto out;
>   }
> 
> - error = (*so->so_proto->pr_output)(m, so, NULL, NULL);
> + error = route_output(m, so);
>   m = NULL;
> 
> out:
> @@ -722,8 +721,7 @@ rtm_report(struct rtentry *rt, u_char ty
> }
> 
> int
> -route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
> -struct mbuf *control)
> +route_output(struct mbuf *m, struct socket *so)
> {
>   struct rt_msghdr*rtm = NULL;
>   struct rtentry  *rt = NULL;
> @@ -2455,7 +2453,6 @@ const struct protosw routesw[] = {
>   .pr_type= SOCK_RAW,
>   .pr_domain  = ,
>   .pr_flags   = PR_ATOMIC|PR_ADDR|PR_WANTRCVD,
> -  .pr_output = route_output,
>   .pr_ctloutput   = route_ctloutput,
>   .pr_usrreqs = _usrreqs,
>   .pr_init= route_prinit,
> Index: sys/protosw.h
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/sys/protosw.h,v
> retrieving revision 1.45
> diff -u -p -r1.45 protosw.h
> --- sys/protosw.h 27 Aug 2022 20:28:01 -  1.45
> +++ sys/protosw.h 28 Aug 2022 16:52:02 -
> @@ -43,8 +43,8 @@
>  * every 500ms through the pr_slowtimo for timer based actions.
>  *
>  * Protocols pass data between themselves as chains of mbufs using
> - * the pr_input and pr_output hooks.  Pr_input passes data up (towards
> - * UNIX) and pr_output passes it down (towards the imps); control
> + * the pr_input and pr_send hooks.  Pr_input passes data up (towards
> + * UNIX) and pr_send passes it down (towards the imps); control
>  * information passes up and down on pr_ctlinput and pr_ctloutput.
>  * The protocol is responsible for the space occupied by any the
>  * arguments to these entries and must dispose it.
> @@ -86,9 +86,6 @@ struct protosw {
> /* protocol-protocol hooks */
>   /* input to protocol (from below) */
>   int (*pr_input)(struct mbuf **, int *, int, int);
> - /* output to protocol (from above) */
> - int (*pr_output)(struct mbuf *, struct socket *, struct sockaddr *,
> - struct mbuf *);
>   /* control input (from below) */
>   void(*pr_ctlinput)(int, struct sockaddr *, u_int, 

remove pr_output

2022-08-28 Thread Alexander Bluhm
Hi,

Since we have no raw_usrreq anymore, we can retire pr_output.
pfkeyv2 and route can call ther output functions directly.

ok?

bluhm

Index: net/pfkeyv2.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkeyv2.c,v
retrieving revision 1.243
diff -u -p -r1.243 pfkeyv2.c
--- net/pfkeyv2.c   27 Aug 2022 20:28:01 -  1.243
+++ net/pfkeyv2.c   28 Aug 2022 16:50:24 -
@@ -177,8 +177,7 @@ int pfkeyv2_send(struct socket *, struct
 struct mbuf *);
 int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
 struct mbuf *, struct proc *);
-int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *,
-struct mbuf *);
+int pfkeyv2_output(struct mbuf *, struct socket *);
 int pfkey_sendup(struct pkpcb *, struct mbuf *, int);
 int pfkeyv2_sa_flush(struct tdb *, void *, int);
 int pfkeyv2_policy_flush(struct ipsec_policy *, void *, unsigned int);
@@ -218,7 +217,6 @@ const struct protosw pfkeysw[] = {
   .pr_domain= ,
   .pr_protocol  = PF_KEY_V2,
   .pr_flags = PR_ATOMIC | PR_ADDR,
-  .pr_output= pfkeyv2_output,
   .pr_usrreqs   = _usrreqs,
   .pr_sysctl= pfkeyv2_sysctl,
 }
@@ -371,7 +369,7 @@ pfkeyv2_send(struct socket *so, struct m
goto out;
}
 
-   error = (*so->so_proto->pr_output)(m, so, NULL, NULL);
+   error = pfkeyv2_output(m, so);
m = NULL;
 
 out:
@@ -443,8 +441,7 @@ pfkeyv2_usrreq(struct socket *so, int re
 }
 
 int
-pfkeyv2_output(struct mbuf *mbuf, struct socket *so,
-struct sockaddr *dstaddr, struct mbuf *control)
+pfkeyv2_output(struct mbuf *mbuf, struct socket *so)
 {
void *message;
int error = 0;
Index: net/rtsock.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.343
diff -u -p -r1.343 rtsock.c
--- net/rtsock.c27 Aug 2022 20:28:01 -  1.343
+++ net/rtsock.c28 Aug 2022 16:50:51 -
@@ -109,8 +109,7 @@ struct walkarg {
 void   route_prinit(void);
 void   rcb_ref(void *, void *);
 void   rcb_unref(void *, void *);
-introute_output(struct mbuf *, struct socket *, struct sockaddr *,
-   struct mbuf *);
+introute_output(struct mbuf *, struct socket *);
 introute_ctloutput(int, struct socket *, int, int, struct mbuf *);
 introute_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct proc *);
@@ -395,7 +394,7 @@ route_send(struct socket *so, struct mbu
goto out;
}
 
-   error = (*so->so_proto->pr_output)(m, so, NULL, NULL);
+   error = route_output(m, so);
m = NULL;
 
 out:
@@ -722,8 +721,7 @@ rtm_report(struct rtentry *rt, u_char ty
 }
 
 int
-route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
-struct mbuf *control)
+route_output(struct mbuf *m, struct socket *so)
 {
struct rt_msghdr*rtm = NULL;
struct rtentry  *rt = NULL;
@@ -2455,7 +2453,6 @@ const struct protosw routesw[] = {
   .pr_type = SOCK_RAW,
   .pr_domain   = ,
   .pr_flags= PR_ATOMIC|PR_ADDR|PR_WANTRCVD,
-  .pr_output   = route_output,
   .pr_ctloutput= route_ctloutput,
   .pr_usrreqs  = _usrreqs,
   .pr_init = route_prinit,
Index: sys/protosw.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/protosw.h,v
retrieving revision 1.45
diff -u -p -r1.45 protosw.h
--- sys/protosw.h   27 Aug 2022 20:28:01 -  1.45
+++ sys/protosw.h   28 Aug 2022 16:52:02 -
@@ -43,8 +43,8 @@
  * every 500ms through the pr_slowtimo for timer based actions.
  *
  * Protocols pass data between themselves as chains of mbufs using
- * the pr_input and pr_output hooks.  Pr_input passes data up (towards
- * UNIX) and pr_output passes it down (towards the imps); control
+ * the pr_input and pr_send hooks.  Pr_input passes data up (towards
+ * UNIX) and pr_send passes it down (towards the imps); control
  * information passes up and down on pr_ctlinput and pr_ctloutput.
  * The protocol is responsible for the space occupied by any the
  * arguments to these entries and must dispose it.
@@ -86,9 +86,6 @@ struct protosw {
 /* protocol-protocol hooks */
/* input to protocol (from below) */
int (*pr_input)(struct mbuf **, int *, int, int);
-   /* output to protocol (from above) */
-   int (*pr_output)(struct mbuf *, struct socket *, struct sockaddr *,
-   struct mbuf *);
/* control input (from below) */
void(*pr_ctlinput)(int, struct sockaddr *, u_int, void *);
/* control output (from above) */



Re: move PRU_ABORT request to (*pru_abort)()

2022-08-28 Thread Alexander Bluhm
On Sun, Aug 28, 2022 at 01:05:41AM +0300, Vitaliy Makkoveev wrote:
> PRU_ABORT is another candidate to change return type to void. Also
> actually we abort only the sockets which are linked to `so_q' or `so_q0'
> queues of listening socket. Such sockets have no corresponding file
> descriptor and are not accessed from userland, so PRU_ABORT used to
> destroy them on listening socket destruction.
> 
> Currently all our sockets support PRU_ABORT request, but actually it
> required only for tcp(4) and unix(4) sockets, so we could make it
> optional. However, the attached diff keeps PRU_ABORT requests. Should I
> remove them with separate diff, or rework this one?

separate diff

> Also, we should destroy socket on PRU_ABORT requset, but route and key
> management sockets keep it alive. I fixed this, but it doesn't make
> sense because this code never called.

Just leave the wrong soisdisconnected(so) logic and remove
the function in the next diff.

OK bluhm@

> Index: sys/kern/uipc_usrreq.c
> ===
> RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v
> retrieving revision 1.176
> diff -u -p -r1.176 uipc_usrreq.c
> --- sys/kern/uipc_usrreq.c27 Aug 2022 20:28:01 -  1.176
> +++ sys/kern/uipc_usrreq.c27 Aug 2022 21:49:18 -
> @@ -138,6 +138,7 @@ const struct pr_usrreqs uipc_usrreqs = {
>   .pru_shutdown   = uipc_shutdown,
>   .pru_rcvd   = uipc_rcvd,
>   .pru_send   = uipc_send,
> + .pru_abort  = uipc_abort,
>  };
>  
>  void
> @@ -245,11 +246,6 @@ uipc_usrreq(struct socket *so, int req, 
>   }
>   break;
>  
> - case PRU_ABORT:
> - unp_detach(unp);
> - sofree(so, 0);
> - break;
> -
>   case PRU_SENSE: {
>   struct stat *sb = (struct stat *)m;
>  
> @@ -588,6 +584,17 @@ out:
>   m_freem(m);
>  
>   return (error);
> +}
> +
> +int
> +uipc_abort(struct socket *so)
> +{
> + struct unpcb *unp = sotounpcb(so);
> +
> + unp_detach(unp);
> + sofree(so, 0);
> +
> + return (0);
>  }
>  
>  int
> Index: sys/net/pfkeyv2.c
> ===
> RCS file: /cvs/src/sys/net/pfkeyv2.c,v
> retrieving revision 1.243
> diff -u -p -r1.243 pfkeyv2.c
> --- sys/net/pfkeyv2.c 27 Aug 2022 20:28:01 -  1.243
> +++ sys/net/pfkeyv2.c 27 Aug 2022 21:49:18 -
> @@ -175,6 +175,7 @@ int pfkeyv2_disconnect(struct socket *);
>  int pfkeyv2_shutdown(struct socket *);
>  int pfkeyv2_send(struct socket *, struct mbuf *, struct mbuf *,
>  struct mbuf *);
> +int pfkeyv2_abort(struct socket *);
>  int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
>  struct mbuf *, struct proc *);
>  int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *,
> @@ -210,6 +211,7 @@ const struct pr_usrreqs pfkeyv2_usrreqs 
>   .pru_disconnect = pfkeyv2_disconnect,
>   .pru_shutdown   = pfkeyv2_shutdown,
>   .pru_send   = pfkeyv2_send,
> + .pru_abort  = pfkeyv2_abort,
>  };
>  
>  const struct protosw pfkeysw[] = {
> @@ -382,6 +384,15 @@ out:
>  }
>  
>  int
> +pfkeyv2_abort(struct socket *so)
> +{
> + pfkeyv2_detach(so);
> + so->so_state |= SS_NOFDREF;
> + sofree(so, 0);
> + return (0);
> +}
> +
> +int
>  pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m,
>  struct mbuf *nam, struct mbuf *control, struct proc *p)
>  {
> @@ -410,9 +421,6 @@ pfkeyv2_usrreq(struct socket *so, int re
>   error = EOPNOTSUPP;
>   break;
>  
> - case PRU_ABORT:
> - soisdisconnected(so);
> - break;
>   case PRU_SENSE:
>   /* stat: don't bother with a blocksize. */
>   break;
> Index: sys/net/rtsock.c
> ===
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.343
> diff -u -p -r1.343 rtsock.c
> --- sys/net/rtsock.c  27 Aug 2022 20:28:01 -  1.343
> +++ sys/net/rtsock.c  27 Aug 2022 21:49:18 -
> @@ -119,6 +119,7 @@ int   route_shutdown(struct socket *);
>  int  route_rcvd(struct socket *);
>  int  route_send(struct socket *, struct mbuf *, struct mbuf *,
>   struct mbuf *);
> +int  route_abort(struct socket *);
>  void route_input(struct mbuf *m0, struct socket *, sa_family_t);
>  int  route_arp_conflict(struct rtentry *, struct rt_addrinfo *);
>  int  route_cleargateway(struct rtentry *, void *, unsigned int);
> @@ -242,9 +243,6 @@ route_usrreq(struct socket *so, int req,
>   error = EOPNOTSUPP;
>   break;
>  
> - case PRU_ABORT:
> - soisdisconnected(so);
> - break;
>   case PRU_SENSE:
>   /* stat: don't bother with a blocksize. */
>   break;
> @@ -406,6 +404,15 @@ out:
>  }
>  
>  int
> +route_abort(struct socket *so)
> +{
> + route_detach(so);
> + so->so_state |= SS_NOFDREF;
> + 

Re: Don't scheck `so_pcb' with PR_WANTRCVD flag

2022-08-28 Thread Alexander Bluhm
On Sat, Aug 27, 2022 at 11:37:14PM +0300, Vitaliy Makkoveev wrote:
> tcp(4) sockets are the only sockets which could have NULL `so_pcb' and
> we handle this case within tcp_rcvd() handler.

OK bluhm@

> Index: sys/kern/uipc_socket.c
> ===
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.285
> diff -u -p -r1.285 uipc_socket.c
> --- sys/kern/uipc_socket.c26 Aug 2022 16:17:38 -  1.285
> +++ sys/kern/uipc_socket.c27 Aug 2022 20:32:50 -
> @@ -1155,7 +1155,7 @@ dontblock:
>   }
>   SBLASTRECORDCHK(>so_rcv, "soreceive 4");
>   SBLASTMBUFCHK(>so_rcv, "soreceive 4");
> - if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
> + if (pr->pr_flags & PR_WANTRCVD)
>   pru_rcvd(so);
>   }
>   if (orig_resid == uio->uio_resid && orig_resid &&
> @@ -1520,7 +1520,7 @@ somove(struct socket *so, int wait)
>   m = m->m_next;
>   if (m == NULL) {
>   sbdroprecord(so, >so_rcv);
> - if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb)
> + if (so->so_proto->pr_flags & PR_WANTRCVD)
>   pru_rcvd(so);
>   goto nextpkt;
>   }
> @@ -1626,7 +1626,7 @@ somove(struct socket *so, int wait)
>   }
>  
>   /* Send window update to source peer as receive buffer has changed. */
> - if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb)
> + if (so->so_proto->pr_flags & PR_WANTRCVD)
>   pru_rcvd(so);
>  
>   /* Receive buffer did shrink by len bytes, adjust oob. */



static inline, not inline static

2022-08-28 Thread Jonathan Gray
diff --git lib/libc/locale/wctoint.h lib/libc/locale/wctoint.h
index ea50c5ae1b6..14c7f0c466d 100644
--- lib/libc/locale/wctoint.h
+++ lib/libc/locale/wctoint.h
@@ -30,7 +30,7 @@
  */
 
 
-inline static int
+static inline int
 wctoint(wchar_t wc)
 {
int n;
diff --git sys/arch/amd64/include/pmap.h sys/arch/amd64/include/pmap.h
index 04d3a3f3bde..87145870e56 100644
--- sys/arch/amd64/include/pmap.h
+++ sys/arch/amd64/include/pmap.h
@@ -434,7 +434,7 @@ pmap_remove_all(struct pmap *pmap)
  * if hardware doesn't support one-page flushing)
  */
 
-inline static void
+static inline void
 pmap_update_pg(vaddr_t va)
 {
invlpg(va);
@@ -449,7 +449,7 @@ pmap_update_pg(vaddr_t va)
  * unprotecting a page is done on-demand at fault time.
  */
 
-inline static void
+static inline void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -469,7 +469,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
  * unprotecting a page is done on-demand at fault time.
  */
 
-inline static void
+static inline void
 pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
diff --git sys/arch/i386/include/cpu.h sys/arch/i386/include/cpu.h
index d9a965dbdd0..4fd4bbee57b 100644
--- sys/arch/i386/include/cpu.h
+++ sys/arch/i386/include/cpu.h
@@ -217,7 +217,7 @@ extern struct cpu_info *cpu_info_list;
 
 static struct cpu_info *curcpu(void);
 
-__inline static struct cpu_info *
+static __inline struct cpu_info *
 curcpu(void)
 {
struct cpu_info *ci;
diff --git sys/arch/i386/include/pmap.h sys/arch/i386/include/pmap.h
index c79a2849223..0ece59819ea 100644
--- sys/arch/i386/include/pmap.h
+++ sys/arch/i386/include/pmap.h
@@ -392,7 +392,7 @@ void pmap_flush_page_pae(paddr_t);
  * Unprotecting a page is done on-demand at fault time.
  */
 
-__inline static void
+static __inline void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -412,7 +412,7 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
  * Unprotecting a page is done on-demand at fault time.
  */
 
-__inline static void
+static __inline void
 pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
if ((prot & PROT_WRITE) == 0) {
@@ -429,25 +429,25 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, 
vm_prot_t prot)
  * modules from both uvm_pmap.h and pmap.h. Since uvm_pmap.h defines these
  * as functions, inline them here to suppress linker warnings.
  */
-__inline static vaddr_t
+static __inline vaddr_t
 pmap_growkernel(vaddr_t maxkvaddr)
 {
return (*pmap_growkernel_p)(maxkvaddr);
 }
 
-__inline static int
+static __inline int
 pmap_enter(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int 
flags)
 {
return (*pmap_enter_p)(pmap, va, pa, prot, flags);
 }
 
-__inline static void
+static __inline void
 pmap_enter_special(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int32_t flags)
 {
(*pmap_enter_special_p)(va, pa, prot, flags);
 }
 
-__inline static int
+static __inline int
 pmap_extract(struct pmap *pmap, vaddr_t va, paddr_t *pa)
 {
return (*pmap_extract_p)(pmap, va, pa);
diff --git sys/arch/luna88k/dev/mb89352.c sys/arch/luna88k/dev/mb89352.c
index 5e2f07fedd0..b2e20bfa3e2 100644
--- sys/arch/luna88k/dev/mb89352.c
+++ sys/arch/luna88k/dev/mb89352.c
@@ -5,7 +5,7 @@
 #ifdef DDB
 #defineintegrate
 #else
-#defineintegrate   __inline static
+#defineintegrate   static __inline 
 #endif
 
 /*-
diff --git sys/uvm/uvm_aobj.c sys/uvm/uvm_aobj.c
index 5e7098adbb2..6b9b269a9e6 100644
--- sys/uvm/uvm_aobj.c
+++ sys/uvm/uvm_aobj.c
@@ -241,7 +241,7 @@ uao_find_swhash_elt(struct uvm_aobj *aobj, int pageidx, 
boolean_t create)
 /*
  * uao_find_swslot: find the swap slot number for an aobj/pageidx
  */
-inline static int
+static inline int
 uao_find_swslot(struct uvm_object *uobj, int pageidx)
 {
struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
diff --git sys/uvm/uvm_page.c sys/uvm/uvm_page.c
index 4af64e2d4ca..abc7c01517a 100644
--- sys/uvm/uvm_page.c
+++ sys/uvm/uvm_page.c
@@ -130,7 +130,7 @@ int uvm_page_owner_locked_p(struct vm_page *);
  * => call should have already set pg's object and offset pointers
  *and bumped the version counter
  */
-inline static void
+static inline void
 uvm_pageinsert(struct vm_page *pg)
 {
struct vm_page  *dupe;
diff --git usr.sbin/npppd/npppd/npppd_pool.c usr.sbin/npppd/npppd/npppd_pool.c
index 8ae54b77695..09f31d68574 100644
--- usr.sbin/npppd/npppd/npppd_pool.c
+++ usr.sbin/npppd/npppd/npppd_pool.c
@@ -338,7 +338,7 @@ npppd_pool_get_dynamic(npppd_pool *_this, npppd_ppp *ppp)
return (uint32_t)0;
 }
 
-inline static int
+static inline int
 npppd_is_ifcace_ip4addr(npppd *_this, uint32_t ip4addr)
 {
int i;



Re: When did PCs stop using ISA Timer 1?

2022-08-28 Thread Daniel Dickman
On Sat, Aug 27, 2022 at 7:15 AM Jonathan Gray  wrote:
>
> On Fri, Aug 26, 2022 at 10:21:32PM -0500, Scott Cheloha wrote:
> > I noticed that on non-LAPIC systems we program channel 0 in periodic
> > mode with an initial count of 11932 to effect a 100hz clock interrupt.
> > And then we also use that same channel to count time, but because we
> > aren't using the full 16-bit range we need to do all this checking and
> > incrementing to handle premature overflow to make it appear as though
> > the full counter is being used.
> >
> > And I had this whimsical idea: gee, wouldn't it be so much easier to
> > use channel 0 for clock interrupts and a different channel for
> > counting time?
> >
> > But then I started reading and saw that channel 1 had a dedicated
> > purpose in the bad old days.
> >
> > So I was left wondering when channel 1 stopped performing that task,
> > and whether those systems (a) predate the APIC and (b) can even run
> > OpenBSD at all.
>
> Attempting to use counter 1 would be more trouble than it is worth.

Hi Scott, we discussed this off-list, but just to share here.

There is a good writeup of how it all used to work here:
https://retrocomputing.stackexchange.com/questions/1212/where-are-the-memory-controllers-for-ibm-5150-or-altair-8800

Quoting that site:

"RAM refresh was done by a cyclic inserted DMA request using DMA
channel 4 of the 8237 DMA controller, triggered by Timer 1 of the 8253
Programmable Interval Timer."

That being said, later on channel 1 was used by video bios and some
bioses, so really it can't be used by OS safely for anything.

See:
https://www.brokenthorn.com/Resources/OSDevPit.html

"Many video cards and the BIOS may reprogram the second channel for
their own uses. This channel was originally used for generating a
timing pulse signal to signal the memory controller to refresh the
DRAM memory. In modern times, this is no longer needed as the refresh
is done by the memory controller. Because of this, there is no
guarantee at what devices may use this counter."

My guess is that any system with 32mb of RAM or more would be unlikely
to to be a place where we have to worry about channel 1 being used for
DRAM refresh.

>
> >
> > > The PCH datasheets from 100 series and later only document counter 0
> > > and counter 2.
> > >

Right, these days some chipsets don't even provide channel 1 anymore.

So either the system has channel 1 and it should be considered
reserved, or the system may not have channel 1 in which case it's not
available for use by the OS.

In either case, the OS should not use this channel.

p.s. we should probably update the comment in usr.sbin/vmd/i8253.c
which currently states:

40: * Channels 1 and 2 can be used by the guest OS as regular timers,



Re: libfido2 update

2022-08-28 Thread Stuart Henderson
On 2022/08/24 17:09, Damien Miller wrote:
> Hi,
> 
> https://www.mindrot.org/misc/libfido2-1.11.0.diff contains an update
> for src/libfido2 from 1.8 to 1.11 (about 10 months of upstream
> development).
> 
> I've tested it with OpenSSH, which is the only thing in src/ that
> uses it as well as compiling www/chromium and performing a FIDO login
> with it.
> 
> ok?
> 
> -d
> 

Works for me, OK sthen@.

Would you mind adding NEWS from upstream so we can see a quick summary
of what's changed please?



installboot: efi: fix passing explicit stage files

2022-08-28 Thread Klemens Nanni
Every platform ought to set `stages', `stage1' and optionally `stage2'
in md_init(), otherwise passing explicit files results won't work as
`stages' is zero-initialised and no default path is set:

# installboot -v sd0 /root/BOOTAA64.EFI
usage: installboot [-npv] [-r root] disk [stage1]

This is correct synopsis and ought to work, but efi_installboot.c has
an empty md_init().

Set stage bits for EFI platforms (armv7, arm64 and riscv64) to fix this:

# ./obj/installboot -nv sd0 /root/BOOTAA64.EFI
Using / as root
would install bootstrap on /dev/rsd0c
using first-stage /root/BOOTAA64.EFI
would copy /root/BOOTAA64.EFI to 
/tmp/installboot.2bGhLGT1eF/efi/boot/bootaa64.efi
would write /tmp/installboot.2bGhLGT1eF/efi/boot/startup.nsh

/usr/src/distrib/ uses `-r /mnt' without explicit stage files, which is
install media work despite this bug.

These usages keep working with this diff (/mnt is another root install):
# ./obj/installboot sd4 /usr/mdec/BOOTAA64.EFI
# ./obj/installboot -r /mnt sd4 /usr/mdec/BOOTAA64.EFI
# ./obj/installboot -r /mnt sd4

And arm64 miniroot keeps booting and installs/ugprades fine with this.

I've only tested this on arm64 but it should be the same for other EFIs
(armv7 and riscv64);  this just looks like an oversight.

Feedback? OK?


Index: efi_installboot.c
===
RCS file: /cvs/src/usr.sbin/installboot/efi_installboot.c,v
retrieving revision 1.2
diff -u -p -r1.2 efi_installboot.c
--- efi_installboot.c   3 Feb 2022 10:25:14 -   1.2
+++ efi_installboot.c   28 Aug 2022 10:20:52 -
@@ -76,6 +76,8 @@ static intfindmbrfat(int, struct diskla
 void
 md_init(void)
 {
+   stages = 1;
+   stage1 = "/usr/mdec/" BOOTEFI_SRC;
 }
 
 void



installboot: softraid: make verbose message -n/nowrite aware

2022-08-28 Thread Klemens Nanni
Using installboot in dry-run mode aka. -vn (verbose + nowrite) and first
reading "would install" followed by an "installing" made me uneasy.

Luckily, nothing was written in dry-run mode, it's just that the
softraid specific code fails to honour -n/nowrite.

So make sure it does and pull the printf out of `if (!nowrite)' so we
see the "would install" messages in dry-run mode in the first place.

Here are the output diffs from all three supported softraid platforms,
i.e. EFI/arm64, i386/amd64 and sparc64, illustrate the change.

Feedback? OK?

|-# installboot -nv sd1
|+# ./obj/installboot -nv sd1
| would install bootstrap on /dev/rsd1c
| using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
| sd1: softraid volume with 1 disk(s)
|+sd1: would install boot loader on softraid volume
| /usr/mdec/boot is 6 blocks x 16384 bytes
|-sd0a: installing boot blocks on /dev/rsd0c, part offset 144
|+sd0a: would install boot blocks on /dev/rsd0c, part offset 144
| master boot record (MBR) at sector 0
|   partition 3: type 0xA6 offset 64 size 488392001
| /usr/mdec/biosboot will be written at sector 64

|-# installboot -nv sd6
|+# ./obj/installboot -nv sd6
| using first-stage /usr/mdec/bootblk, second-stage /usr/mdec/ofwboot
| boot block is 6888 bytes (14 blocks @ 512 bytes = 7168 bytes)
| sd6: softraid volume with 4 disk(s)
|-sd2a: installing boot blocks on /dev/rsd2c
|+sd6: would install boot loader on softraid volume
|+sd2a: would install boot blocks on /dev/rsd2c
| would write boot block to disk /dev/rsd2c
|-sd3a: installing boot blocks on /dev/rsd3c
|+sd3a: would install boot blocks on /dev/rsd3c
| would write boot block to disk /dev/rsd3c
| softraid chunk 2 not online - skipping...
| softraid chunk 3 not online - skipping...

|-# installboot -nv sd4
|+# ./obj/installboot -nv sd4
| Using / as root
| would install bootstrap on /dev/rsd4c
| sd4: softraid volume with 3 disk(s)
|-sd1a: installing boot blocks on /dev/rsd1c
|-would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.6CIpogjEIX/efi/boot/bootaa64.efi
|-would write /tmp/installboot.6CIpogjEIX/efi/boot/startup.nsh
|-sd2a: installing boot blocks on /dev/rsd2c
|-would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.iavORNgJs8/efi/boot/bootaa64.efi
|-would write /tmp/installboot.iavORNgJs8/efi/boot/startup.nsh
|-sd3a: installing boot blocks on /dev/rsd3c
|-would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.vhlivYeWae/efi/boot/bootaa64.efi
|-would write /tmp/installboot.vhlivYeWae/efi/boot/startup.nsh
|+sd1a: would install boot blocks on /dev/rsd1c
|+would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.GH19kPb4Lg/efi/boot/bootaa64.efi
|+would write /tmp/installboot.GH19kPb4Lg/efi/boot/startup.nsh
|+sd2a: would install boot blocks on /dev/rsd2c
|+would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.EzcdxwQjsb/efi/boot/bootaa64.efi
|+would write /tmp/installboot.EzcdxwQjsb/efi/boot/startup.nsh
|+sd3a: would install boot blocks on /dev/rsd3c
|+would copy /usr/mdec/BOOTAA64.EFI to 
/tmp/installboot.sQOCDpqxHn/efi/boot/bootaa64.efi
|+would write /tmp/installboot.sQOCDpqxHn/efi/boot/startup.nsh

Index: efi_softraid.c
===
RCS file: /cvs/src/usr.sbin/installboot/efi_softraid.c,v
retrieving revision 1.1
diff -u -p -r1.1 efi_softraid.c
--- efi_softraid.c  15 Aug 2022 17:06:43 -  1.1
+++ efi_softraid.c  28 Aug 2022 08:39:05 -
@@ -67,8 +67,8 @@ sr_install_bootblk(int devfd, int vol, i
err(1, "open: %s", realdev);
 
if (verbose)
-   fprintf(stderr, "%s%c: installing boot blocks on %s\n",
-   bd.bd_vendor, part, realdev);
+   fprintf(stderr, "%s%c: %s boot blocks on %s\n", bd.bd_vendor,
+   part, (nowrite ? "would install" : "installing"), realdev);
 
/* Write boot blocks to device. */
md_installboot(diskfd, realdev);
Index: i386_softraid.c
===
RCS file: /cvs/src/usr.sbin/installboot/i386_softraid.c,v
retrieving revision 1.18
diff -u -p -r1.18 i386_softraid.c
--- i386_softraid.c 24 Oct 2021 21:24:18 -  1.18
+++ i386_softraid.c 28 Aug 2022 08:40:33 -
@@ -102,8 +102,9 @@ sr_install_bootblk(int devfd, int vol, i
sym_set_value(pbr_symbols, "_p_offset", poffset);
 
if (verbose)
-   fprintf(stderr, "%s%c: installing boot blocks on %s, "
-   "part offset %u\n", bd.bd_vendor, part, dev, poffset);
+   fprintf(stderr, "%s%c: %s boot blocks on %s, part offset %u\n",
+   bd.bd_vendor, part,
+   (nowrite ? "would install" : "installing"), dev, poffset);
 
/* Write boot blocks to device. */
write_bootblocks(diskfd, dev, );
@@ -172,10 +173,10 @@ sr_install_bootldr(int devfd, char *dev)
bb.bb_bootblk = "XXX";
bb.bb_bootblk_size = sizeof("XXX");
strncpy(bb.bb_dev, dev, sizeof(bb.bb_dev));
+  

Re: dhcpleased.8: add lease files to FILES

2022-08-28 Thread Florian Obser
On 2022-08-18 20:34 UTC, Klemens Nanni  wrote:
> On Thu, Aug 18, 2022 at 08:53:51PM +0100, Jason McIntyre wrote:
>> On Thu, Aug 18, 2022 at 07:29:42PM +, Klemens Nanni wrote:
>> > There is dhcpleasectl(8) -l but that only works for currently
>> > configured leases/interfaces and does not print all information
>> > contained in the lease file (mostly tailored to fit the installer's
>> > needs).
>> > 
>> > Feedback? OK?
>> > 
>> 
>> hi.
>> 
>> - in general i like this. i didn;t know about it, and am currently
>>   having to run dhcpleasectl to get the info (and generating a temp
>>   file so a script can read it!)
>> 
>> - when you say dhcpleasectl only works "for currently configured
>>   leases/interfaces" how does this differ? you mean it shows you the
>>   last lease, even if one is not currently in use?
>
> Lease file stay behind until manually removed or overwritten with fresh
> leases, so you need to know what's what when parsing them:
>   $ ls /var/db/dhcpleased/
>   athn0cdce0em0  trunk0   urndis0
>
> For example, there is no cdce0 or urndis0 right now on my box, those are
> from past tethering situations and those lease files are useless now.

They are used when cdce0 or urndis0 come back and made autoconf
interfaces. dhcpleased then goes throught the REBOOTING state, which is
faster and gives you your old IP back, if available.
So I don't think "useless" is the right word in the general case.

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



Re: tetris(6) "Random Generator" and advanced controls

2022-08-28 Thread Stuart Henderson
On 2022/08/27 19:58, Tom MTT. wrote:
> Apparently, as some people pointed it out, DMARC doesn't influence spam score.

Depends on the mail server doing filtering.

> I thought that since my e-mail failed both SPF and DKIM and my DMARC
> policy was set to quarantine my mail would've been trashed instantly.

openbsd.org lists *strip* dkim headers anyway, so recipients with a strict
dmarc setup are unlikely to receive mail from sending domains with p=reject 
policy.

> I'm really sorry for the inconvenience, I won't do the same mistake twice.
> 
> ~ tmtt
>