From a959d2beead5bfd8a8fc4c5163566108a1343d56 Mon Sep 17 00:00:00 2001 From: purplerain Date: Fri, 6 Oct 2023 03:27:58 +0000 Subject: [PATCH] sync code with last improvements from OpenBSD --- distrib/notes/amd64/features | 5 ++++- distrib/notes/arm64/features | 5 ++++- distrib/notes/armv7/features | 5 ++++- distrib/notes/i386/features | 5 ++++- distrib/notes/m4.common | 8 ++++++-- etc/skel/dot.version | 2 +- regress/lib/libcrypto/asn1/asn1time.c | 17 ++++++++++++----- sys/net/ifq.c | 10 +++++++++- sys/net/ifq.h | 12 ++++++------ usr.sbin/dhcpd/dhcpd.8 | 8 +++++--- usr.sbin/dhcpd/dhcpd.c | 27 +++++++++++++++------------ 11 files changed, 70 insertions(+), 34 deletions(-) diff --git a/distrib/notes/amd64/features b/distrib/notes/amd64/features index 1b7a4de65..7bd8e2a69 100644 --- a/distrib/notes/amd64/features +++ b/distrib/notes/amd64/features @@ -1,4 +1,4 @@ -dnl $OpenBSD: features,v 1.3 2021/03/15 09:29:51 jsg Exp $ +dnl $OpenBSD: features,v 1.4 2023/10/05 11:58:34 kn Exp $ dnl dnl This file lists almost all the conditional features of this port, dnl which are used to provide accurate installation notes. @@ -38,3 +38,6 @@ define({:-MDXAPERTURE-:},1)dnl dnl dnl define if the X server can start without a configuration file define({:-MDXDM-:},1)dnl +dnl +dnl define if boot loaders support softraid(4) volumes +define({:-MDBOOTSR-:},1)dnl diff --git a/distrib/notes/arm64/features b/distrib/notes/arm64/features index e4aa7b766..fadec7e94 100644 --- a/distrib/notes/arm64/features +++ b/distrib/notes/arm64/features @@ -1,4 +1,4 @@ -dnl $OpenBSD: features,v 1.4 2023/03/16 18:04:08 miod Exp $ +dnl $OpenBSD: features,v 1.5 2023/10/05 11:58:34 kn Exp $ dnl dnl This file lists almost all the conditional features of this port, dnl which are used to provide accurate installation notes. @@ -38,3 +38,6 @@ define({:-MDXAPERTURE-:},)dnl dnl dnl define if the X server can start without a configuration file define({:-MDXDM-:},1)dnl +dnl +dnl define if boot loaders support softraid(4) volumes +define({:-MDBOOTSR-:},1)dnl diff --git a/distrib/notes/armv7/features b/distrib/notes/armv7/features index b4c72be02..996df109b 100644 --- a/distrib/notes/armv7/features +++ b/distrib/notes/armv7/features @@ -1,4 +1,4 @@ -dnl $OpenBSD: features,v 1.3 2021/03/15 09:29:51 jsg Exp $ +dnl $OpenBSD: features,v 1.4 2023/10/05 11:58:34 kn Exp $ dnl dnl This file lists almost all the conditional features of this port, dnl which are used to provide accurate installation notes. @@ -38,3 +38,6 @@ define({:-MDXAPERTURE-:},)dnl dnl dnl define if the X server can start without a configuration file define({:-MDXDM-:},)dnl +dnl +dnl define if boot loaders support softraid(4) volumes +define({:-MDBOOTSR-:},)dnl diff --git a/distrib/notes/i386/features b/distrib/notes/i386/features index 6f8303a3b..b040b20d0 100644 --- a/distrib/notes/i386/features +++ b/distrib/notes/i386/features @@ -1,4 +1,4 @@ -dnl $OpenBSD: features,v 1.3 2021/03/15 09:29:51 jsg Exp $ +dnl $OpenBSD: features,v 1.4 2023/10/05 11:58:34 kn Exp $ dnl dnl This file lists almost all the conditional features of this port, dnl which are used to provide accurate installation notes. @@ -38,3 +38,6 @@ define({:-MDXAPERTURE-:},1)dnl dnl dnl define if the X server can start without a configuration file define({:-MDXDM-:},1)dnl +dnl +dnl define if boot loaders support softraid(4) volumes +define({:-MDBOOTSR-:},1)dnl diff --git a/distrib/notes/m4.common b/distrib/notes/m4.common index 38d64f1f9..59903f832 100644 --- a/distrib/notes/m4.common +++ b/distrib/notes/m4.common @@ -1,5 +1,5 @@ dnl -dnl $OpenBSD: m4.common,v 1.135 2022/10/10 10:42:42 jsg Exp $ +dnl $OpenBSD: m4.common,v 1.136 2023/10/05 11:58:34 kn Exp $ dnl dnl Copyright (c) 2004 Todd T. Fries dnl @@ -432,7 +432,11 @@ dnl install.sh ask whether to use DUIDs before the md_prep_disklabel loop The installation program will now tell you which disks it can install on, and ask you which it should use. - Reply with the name of your root disk.-:})dnl + Reply with the name of your root disk.ifelse(MDBOOTSR,,,{:- + + You will be given the possibility to encrypt the contents of that + disk with a passphrase.-:})dnl +-:})dnl dnl install.sh md_prep_disklabel loop dnl dnl OpenBSDInstallMBRPart1 diff --git a/etc/skel/dot.version b/etc/skel/dot.version index 7e03aed98..2f0c57775 100644 --- a/etc/skel/dot.version +++ b/etc/skel/dot.version @@ -1 +1 @@ -# SecBSD 1.4-37f6beb: Wed Oct 4 04:28:37 UTC 2023 (Tezcatlipoca) +# SecBSD 1.4-7869b2f: Fri Oct 6 03:12:48 UTC 2023 (Tezcatlipoca) diff --git a/regress/lib/libcrypto/asn1/asn1time.c b/regress/lib/libcrypto/asn1/asn1time.c index bb58f6172..10533d62e 100644 --- a/regress/lib/libcrypto/asn1/asn1time.c +++ b/regress/lib/libcrypto/asn1/asn1time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1time.c,v 1.20 2023/10/02 11:14:15 tb Exp $ */ +/* $OpenBSD: asn1time.c,v 1.21 2023/10/05 07:59:41 tb Exp $ */ /* * Copyright (c) 2015 Joel Sing * @@ -21,6 +21,8 @@ #include #include +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); + struct asn1_time_test { const char *str; const char *data; @@ -527,10 +529,15 @@ asn1_time_compare_families(const struct asn1_time_test *fam1, size_t fam1_size, comparison_failure |= 1; } - /* - * XXX - add ASN1_UTCTIME_cmp_time_t later. Don't want - * to mess with LIBRESSL_INTERNAL right before lock. - */ + time_cmp = ASN1_UTCTIME_cmp_time_t(t1, att2->time); + if (t1->type != V_ASN1_UTCTIME) + asn1_cmp = -2; + if (time_cmp != asn1_cmp) { + fprintf(stderr, "%s vs. %lld: want %d, got %d\n", + att1->str, (long long)att2->time, + asn1_cmp, time_cmp); + comparison_failure |= 1; + } } } diff --git a/sys/net/ifq.c b/sys/net/ifq.c index 986cb2b55..54ecfa5df 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.50 2023/07/30 05:39:52 dlg Exp $ */ +/* $OpenBSD: ifq.c,v 1.51 2023/10/05 11:08:56 bluhm Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -529,6 +529,14 @@ ifq_hdatalen(struct ifqueue *ifq) return (len); } +void +ifq_set_maxlen(struct ifqueue *ifq, unsigned int maxlen) +{ + mtx_enter(&ifq->ifq_mtx); + ifq->ifq_maxlen = maxlen; + mtx_leave(&ifq->ifq_mtx); +} + unsigned int ifq_purge(struct ifqueue *ifq) { diff --git a/sys/net/ifq.h b/sys/net/ifq.h index c32a635a8..d15af37b4 100644 --- a/sys/net/ifq.h +++ b/sys/net/ifq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.h,v 1.38 2023/07/30 05:39:52 dlg Exp $ */ +/* $OpenBSD: ifq.h,v 1.39 2023/10/05 11:08:56 bluhm Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -435,6 +435,7 @@ void ifq_deq_commit(struct ifqueue *, struct mbuf *); void ifq_deq_rollback(struct ifqueue *, struct mbuf *); struct mbuf *ifq_dequeue(struct ifqueue *); int ifq_hdatalen(struct ifqueue *); +void ifq_set_maxlen(struct ifqueue *, unsigned int); void ifq_mfreem(struct ifqueue *, struct mbuf *); void ifq_mfreeml(struct ifqueue *, struct mbuf_list *); unsigned int ifq_purge(struct ifqueue *); @@ -448,9 +449,8 @@ int ifq_deq_sleep(struct ifqueue *, struct mbuf **, int, int, const char *, volatile unsigned int *, volatile unsigned int *); -#define ifq_len(_ifq) ((_ifq)->ifq_len) -#define ifq_empty(_ifq) (ifq_len(_ifq) == 0) -#define ifq_set_maxlen(_ifq, _l) ((_ifq)->ifq_maxlen = (_l)) +#define ifq_len(_ifq) READ_ONCE((_ifq)->ifq_len) +#define ifq_empty(_ifq) (ifq_len(_ifq) == 0) static inline int ifq_is_priq(struct ifqueue *ifq) @@ -490,8 +490,8 @@ int ifiq_input(struct ifiqueue *, struct mbuf_list *); int ifiq_enqueue(struct ifiqueue *, struct mbuf *); void ifiq_add_data(struct ifiqueue *, struct if_data *); -#define ifiq_len(_ifiq) ml_len(&(_ifiq)->ifiq_ml) -#define ifiq_empty(_ifiq) ml_empty(&(_ifiq)->ifiq_ml) +#define ifiq_len(_ifiq) READ_ONCE(ml_len(&(_ifiq)->ifiq_ml)) +#define ifiq_empty(_ifiq) (ifiq_len(_ifiq) == 0) #endif /* _KERNEL */ diff --git a/usr.sbin/dhcpd/dhcpd.8 b/usr.sbin/dhcpd/dhcpd.8 index d40e3feaf..c98a953b9 100644 --- a/usr.sbin/dhcpd/dhcpd.8 +++ b/usr.sbin/dhcpd/dhcpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhcpd.8,v 1.33 2023/09/04 16:11:00 jmc Exp $ +.\" $OpenBSD: dhcpd.8,v 1.34 2023/10/05 18:46:14 mvs Exp $ .\" .\" Copyright (c) 1995, 1996 The Internet Software Consortium. .\" All rights reserved. @@ -36,7 +36,7 @@ .\" see ``http://www.isc.org/''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. .\" -.Dd $Mdocdate: September 4 2023 $ +.Dd $Mdocdate: October 5 2023 $ .Dt DHCPD 8 .Os .Sh NAME @@ -45,7 +45,7 @@ .Sh SYNOPSIS .Nm dhcpd .Bk -words -.Op Fl dfn +.Op Fl dfnv .Op Fl A Ar abandoned_ip_table .Op Fl C Ar changed_ip_table .Op Fl c Ar config-file @@ -239,6 +239,8 @@ is specified, .Nm will bind to that address; otherwise the limited broadcast address (255.255.255.255) is used as the default. +.It Fl v +Produce more verbose output. .It Fl Y Ar synctarget Add target .Ar synctarget diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c index b3562dce3..f5f8fd101 100644 --- a/usr.sbin/dhcpd/dhcpd.c +++ b/usr.sbin/dhcpd/dhcpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.c,v 1.57 2019/08/06 11:07:37 krw Exp $ */ +/* $OpenBSD: dhcpd.c,v 1.58 2023/10/05 18:46:14 mvs Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -87,7 +87,8 @@ char *leased_tab = NULL; int main(int argc, char *argv[]) { - int ch, cftest = 0, daemonize = 1, rdomain = -1, udpsockmode = 0; + int ch, cftest = 0, rdomain = -1, udpsockmode = 0; + int debug = 0, verbose = 0; char *sync_iface = NULL; char *sync_baddr = NULL; u_short sync_port = 0; @@ -98,7 +99,7 @@ main(int argc, char *argv[]) log_setverbose(1); opterr = 0; - while ((ch = getopt(argc, argv, "A:C:L:c:dfl:nu::Y:y:")) != -1) + while ((ch = getopt(argc, argv, "A:C:L:c:dfl:nu::vY:y:")) != -1) switch (ch) { case 'Y': syncsend = 1; @@ -117,7 +118,7 @@ main(int argc, char *argv[]) udpaddr.s_addr = htonl(INADDR_BROADCAST); optreset = optind = opterr = 1; - while ((ch = getopt(argc, argv, "A:C:L:c:dfl:nu::Y:y:")) != -1) + while ((ch = getopt(argc, argv, "A:C:L:c:dfl:nu::vY:y:")) != -1) switch (ch) { case 'A': abandoned_tab = optarg; @@ -132,16 +133,15 @@ main(int argc, char *argv[]) path_dhcpd_conf = optarg; break; case 'd': - daemonize = 0; - break; + /* FALLTHROUGH */ case 'f': - daemonize = 0; + debug = 1; break; case 'l': path_dhcpd_db = optarg; break; case 'n': - daemonize = 0; + debug = 1; cftest = 1; break; case 'u': @@ -152,6 +152,9 @@ main(int argc, char *argv[]) "address: %s", optarg); } break; + case 'v': + verbose = 1; + break; case 'Y': if (sync_addhost(optarg, sync_port) != 0) sync_iface = optarg; @@ -206,11 +209,11 @@ main(int argc, char *argv[]) err(1, "sync init"); } - if (daemonize) - daemon(0, 0); + log_init(debug, LOG_DAEMON); + log_setverbose(verbose); - log_init(0, LOG_DAEMON); /* stop logging to stderr */ - log_setverbose(0); + if (!debug) + daemon(0, 0); if ((pw = getpwnam("_dhcp")) == NULL) fatalx("user \"_dhcp\" not found");