sync with OpenBSD -current
This commit is contained in:
parent
bd69b5651c
commit
f7289b5181
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: SYS.h,v 1.15 2016/05/16 16:25:06 guenther Exp $ */
|
/* $OpenBSD: SYS.h,v 1.16 2023/12/06 06:15:33 miod Exp $ */
|
||||||
/* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */
|
/* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -65,6 +65,9 @@
|
|||||||
_END(_HIDDEN(x))
|
_END(_HIDDEN(x))
|
||||||
#define END_WEAK(x) END_STRONG(x); .weak x
|
#define END_WEAK(x) END_STRONG(x); .weak x
|
||||||
|
|
||||||
|
#define CALLSYS_NOERROR(name) \
|
||||||
|
ldiq v0, ___CONCAT(SYS_,name); \
|
||||||
|
call_pal PAL_OSF1_callsys
|
||||||
|
|
||||||
#define CALLSYS_ERROR(name) \
|
#define CALLSYS_ERROR(name) \
|
||||||
CALLSYS_NOERROR(name); \
|
CALLSYS_NOERROR(name); \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: SYS.h,v 1.2 2019/02/03 02:20:36 guenther Exp $ */
|
/* $OpenBSD: SYS.h,v 1.3 2023/12/06 06:15:33 miod Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Niklas Hallqvist
|
* Copyright (c) 2001 Niklas Hallqvist
|
||||||
@ -63,7 +63,8 @@
|
|||||||
|
|
||||||
#define DL_SYSCALL(c) \
|
#define DL_SYSCALL(c) \
|
||||||
LEAF_NOPROFILE(_dl_##c, irrelevant); \
|
LEAF_NOPROFILE(_dl_##c, irrelevant); \
|
||||||
CALLSYS_NOERROR(c); \
|
ldiq v0, SYS_##c; \
|
||||||
|
call_pal PAL_OSF1_callsys; \
|
||||||
beq a3, 1f; \
|
beq a3, 1f; \
|
||||||
subq zero, v0, v0; /* return -errno */ \
|
subq zero, v0, v0; /* return -errno */ \
|
||||||
1: \
|
1: \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# $OpenBSD: Makefile,v 1.8 2020/12/17 14:16:10 bluhm Exp $
|
# $OpenBSD: Makefile,v 1.9 2023/12/06 14:41:52 bluhm Exp $
|
||||||
|
|
||||||
SUBDIR += arp autoport
|
SUBDIR += arp autoport
|
||||||
SUBDIR += broadcast_bind
|
SUBDIR += bindconnect broadcast_bind
|
||||||
SUBDIR += carp
|
SUBDIR += carp
|
||||||
SUBDIR += frag
|
SUBDIR += frag
|
||||||
SUBDIR += in_pcbbind ipsec
|
SUBDIR += in_pcbbind ipsec
|
||||||
|
28
regress/sys/netinet/bindconnect/Makefile
Normal file
28
regress/sys/netinet/bindconnect/Makefile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# $OpenBSD: Makefile,v 1.1 2023/12/06 14:41:52 bluhm Exp $
|
||||||
|
|
||||||
|
PROG= bindconnect
|
||||||
|
LDADD= -lpthread
|
||||||
|
DPADD= ${LIBPTHREAD}
|
||||||
|
WARNINGS= yes
|
||||||
|
|
||||||
|
CLEANFILES= ktrace.out
|
||||||
|
|
||||||
|
${REGRESS_TARGETS}: ${PROG}
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-default
|
||||||
|
run-default:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG}
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-bind
|
||||||
|
run-bind:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 5 -c 0
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-connect
|
||||||
|
run-connect:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 0 -c 5
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-bind-connect
|
||||||
|
run-bind-connect:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 3 -c 3
|
||||||
|
|
||||||
|
.include <bsd.regress.mk>
|
18
regress/sys/netinet/bindconnect/README
Normal file
18
regress/sys/netinet/bindconnect/README
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Stress test bind(2) and connect(2) system calls in OpenBSD regress.
|
||||||
|
|
||||||
|
bindconnect [-b bind] [-c connect] [-n num] [-o close] [-s socket] [-t time]
|
||||||
|
-b bind threads binding sockets, default 1
|
||||||
|
-c connect threads connecting sockets, default 1
|
||||||
|
-n num number of file descriptors, default 100
|
||||||
|
-o close threads closing sockets, default 1
|
||||||
|
-s socket threads creating sockets, default 1
|
||||||
|
-t time run time in seconds, default 10
|
||||||
|
|
||||||
|
Separate threads are started to run socket(2), close(2), bind(2),
|
||||||
|
and connect(2) system calls concurrently. The number of sockets
|
||||||
|
is controlled by the process limit of open file descriptors. All
|
||||||
|
system calls operate on random file descriptors. By setting the
|
||||||
|
number of threads for each system call and the number of available
|
||||||
|
file descriptors, the focus for the stress test can be changed.
|
||||||
|
|
||||||
|
Currently only IPv4 UDP sockets with 127.0.0.1 are supported.
|
279
regress/sys/netinet/bindconnect/bindconnect.c
Normal file
279
regress/sys/netinet/bindconnect/bindconnect.c
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
/* $OpenBSD: bindconnect.c,v 1.1 2023/12/06 14:41:52 bluhm Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Alexander Bluhm <bluhm@openbsd.org>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
|
int fd_base;
|
||||||
|
unsigned int fd_num = 100;
|
||||||
|
unsigned int run_time = 10;
|
||||||
|
unsigned int socket_num = 1, close_num = 1, bind_num = 1, connect_num = 1;
|
||||||
|
|
||||||
|
static void __dead
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"bindconnect [-b bind] [-c connect] [-n num] [-o close]\n"
|
||||||
|
"[-s socket] [-t time]\n"
|
||||||
|
" -b bind threads binding sockets, default %u\n"
|
||||||
|
" -c connect threads connecting sockets, default %u\n"
|
||||||
|
" -n num number of file descriptors, default %u\n"
|
||||||
|
" -o close threads closing sockets, default %u\n"
|
||||||
|
" -s socket threads creating sockets, default %u\n"
|
||||||
|
" -t time run time in seconds, default %u\n",
|
||||||
|
bind_num, connect_num, fd_num, close_num, socket_num, run_time);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct sockaddr *
|
||||||
|
sintosa(struct sockaddr_in *sin)
|
||||||
|
{
|
||||||
|
return ((struct sockaddr *)(sin));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
thread_socket(void *arg)
|
||||||
|
{
|
||||||
|
volatile int *run = arg;
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
for (count = 0; *run; count++) {
|
||||||
|
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
thread_close(void *arg)
|
||||||
|
{
|
||||||
|
volatile int *run = arg;
|
||||||
|
unsigned long count;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
for (count = 0; *run; count++) {
|
||||||
|
fd = fd_base + arc4random_uniform(fd_num);
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
thread_bind(void *arg)
|
||||||
|
{
|
||||||
|
volatile int *run = arg;
|
||||||
|
unsigned long count;
|
||||||
|
int fd;
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
|
||||||
|
memset(&sin, 0, sizeof(sin));
|
||||||
|
sin.sin_len = sizeof(sin);
|
||||||
|
sin.sin_family = AF_INET;
|
||||||
|
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
|
|
||||||
|
for (count = 0; *run; count++) {
|
||||||
|
fd = fd_base + arc4random_uniform(fd_num);
|
||||||
|
bind(fd, sintosa(&sin), sizeof(sin));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
thread_connect(void *arg)
|
||||||
|
{
|
||||||
|
volatile int *run = arg;
|
||||||
|
unsigned long count;
|
||||||
|
int fd;
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
|
||||||
|
memset(&sin, 0, sizeof(sin));
|
||||||
|
sin.sin_len = sizeof(sin);
|
||||||
|
sin.sin_family = AF_INET;
|
||||||
|
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
|
sin.sin_port = arc4random();
|
||||||
|
|
||||||
|
for (count = 0; *run; count++) {
|
||||||
|
fd = fd_base + arc4random_uniform(fd_num);
|
||||||
|
connect(fd, sintosa(&sin), sizeof(sin));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct rlimit rlim;
|
||||||
|
pthread_t *tsocket, *tclose, *tbind, *tconnect;
|
||||||
|
const char *errstr;
|
||||||
|
int ch, run;
|
||||||
|
unsigned int n;
|
||||||
|
unsigned long socket_count, close_count, bind_count, connect_count;
|
||||||
|
|
||||||
|
fd_base = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (fd_base < 0)
|
||||||
|
err(1, "socket fd_base");
|
||||||
|
|
||||||
|
while ((ch = getopt(argc, argv, "b:c:n:o:s:t:")) != -1) {
|
||||||
|
switch (ch) {
|
||||||
|
case 'b':
|
||||||
|
bind_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "bind is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
connect_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "connect is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
fd_num = strtonum(optarg, 1, INT_MAX - fd_base,
|
||||||
|
&errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "num is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
close_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "close is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
socket_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "socket is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
run_time = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "time is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
if (argc > 0)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
if (closefrom(fd_base) < 0)
|
||||||
|
err(1, "closefrom %d", fd_base);
|
||||||
|
|
||||||
|
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
|
||||||
|
err(1, "getrlimit");
|
||||||
|
rlim.rlim_max = MAX(rlim.rlim_max, fd_base + fd_num);
|
||||||
|
rlim.rlim_cur = fd_base + fd_num;
|
||||||
|
if (setrlimit(RLIMIT_NOFILE, &rlim) < 0)
|
||||||
|
err(1, "setrlimit %llu", rlim.rlim_cur);
|
||||||
|
|
||||||
|
run = 1;
|
||||||
|
tsocket = calloc(socket_num, sizeof(pthread_t));
|
||||||
|
if (tsocket == NULL)
|
||||||
|
err(1, "tsocket");
|
||||||
|
for (n = 0; n < socket_num; n++) {
|
||||||
|
errno = pthread_create(&tsocket[n], NULL, thread_socket, &run);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_create socket %u", n);
|
||||||
|
}
|
||||||
|
tclose = calloc(close_num, sizeof(pthread_t));
|
||||||
|
if (tclose == NULL)
|
||||||
|
err(1, "tclose");
|
||||||
|
for (n = 0; n < close_num; n++) {
|
||||||
|
errno = pthread_create(&tclose[n], NULL, thread_close, &run);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_create close %u", n);
|
||||||
|
}
|
||||||
|
tbind = calloc(bind_num, sizeof(pthread_t));
|
||||||
|
if (tbind == NULL)
|
||||||
|
err(1, "tbind");
|
||||||
|
for (n = 0; n < bind_num; n++) {
|
||||||
|
errno = pthread_create(&tbind[n], NULL, thread_bind, &run);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_create bind %u", n);
|
||||||
|
}
|
||||||
|
tconnect = calloc(connect_num, sizeof(pthread_t));
|
||||||
|
if (tconnect == NULL)
|
||||||
|
err(1, "tconnect");
|
||||||
|
for (n = 0; n < connect_num; n++) {
|
||||||
|
errno = pthread_create(&tconnect[n], NULL, thread_connect,
|
||||||
|
&run);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_create connect %u", n);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (run_time > 0) {
|
||||||
|
if (sleep(run_time) < 0)
|
||||||
|
err(1, "sleep %u", run_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
run = 0;
|
||||||
|
socket_count = 0;
|
||||||
|
for (n = 0; n < socket_num; n++) {
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
errno = pthread_join(tsocket[n], (void **)&count);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_join socket %u", n);
|
||||||
|
socket_count += count;
|
||||||
|
}
|
||||||
|
close_count = 0;
|
||||||
|
for (n = 0; n < close_num; n++) {
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
errno = pthread_join(tclose[n], (void **)&count);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_join close %u", n);
|
||||||
|
close_count += count;
|
||||||
|
}
|
||||||
|
bind_count = 0;
|
||||||
|
for (n = 0; n < bind_num; n++) {
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
errno = pthread_join(tbind[n], (void **)&count);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_join bind %u", n);
|
||||||
|
bind_count += count;
|
||||||
|
}
|
||||||
|
connect_count = 0;
|
||||||
|
for (n = 0; n < connect_num; n++) {
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
errno = pthread_join(tconnect[n], (void **)&count);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_join connect %u", n);
|
||||||
|
connect_count += count;
|
||||||
|
}
|
||||||
|
printf("count: socket %lu, close %lu, bind %lu, connect %lu\n",
|
||||||
|
socket_count, close_count, bind_count, connect_count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ukbd.c,v 1.88 2022/10/04 19:38:20 miod Exp $ */
|
/* $OpenBSD: ukbd.c,v 1.89 2023/12/05 20:49:31 miod Exp $ */
|
||||||
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
|
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -180,6 +180,17 @@ const struct cfattach ukbd_ca = {
|
|||||||
void ukbd_gdium_munge(void *, uint8_t *, u_int);
|
void ukbd_gdium_munge(void *, uint8_t *, u_int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const struct usb_devno ukbd_never_console[] = {
|
||||||
|
/* Apple HID-proxy is always detected before any real USB keyboard */
|
||||||
|
{ USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HCI },
|
||||||
|
/* ugold(4) devices, which also present themselves as ukbd */
|
||||||
|
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPER },
|
||||||
|
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPERHUM },
|
||||||
|
{ USB_VENDOR_PCSENSORS, USB_PRODUCT_PCSENSORS_TEMPER },
|
||||||
|
{ USB_VENDOR_RDING, USB_PRODUCT_RDING_TEMPER },
|
||||||
|
{ USB_VENDOR_WCH2, USB_PRODUCT_WCH2_TEMPER },
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
ukbd_match(struct device *parent, void *match, void *aux)
|
ukbd_match(struct device *parent, void *match, void *aux)
|
||||||
{
|
{
|
||||||
@ -225,11 +236,9 @@ ukbd_attach(struct device *parent, struct device *self, void *aux)
|
|||||||
sc->sc_hdev.sc_fsize = hid_report_size(desc, dlen, hid_feature, repid);
|
sc->sc_hdev.sc_fsize = hid_report_size(desc, dlen, hid_feature, repid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since the HID-Proxy is always detected before any
|
* Do not allow unwanted devices to claim the console.
|
||||||
* real keyboard, do not let it grab the console.
|
|
||||||
*/
|
*/
|
||||||
if (uha->uaa->vendor == USB_VENDOR_APPLE &&
|
if (usb_lookup(ukbd_never_console, uha->uaa->vendor, uha->uaa->product))
|
||||||
uha->uaa->product == USB_PRODUCT_APPLE_BLUETOOTH_HCI)
|
|
||||||
console = 0;
|
console = 0;
|
||||||
|
|
||||||
quirks = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags;
|
quirks = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ip_mroute.c,v 1.139 2023/06/14 14:30:08 mvs Exp $ */
|
/* $OpenBSD: ip_mroute.c,v 1.140 2023/12/06 09:27:17 bluhm Exp $ */
|
||||||
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
|
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1048,11 +1048,18 @@ del_mfc(struct socket *so, struct mbuf *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in *src)
|
socket_send(struct socket *so, struct mbuf *mm, struct sockaddr_in *src)
|
||||||
{
|
{
|
||||||
if (s != NULL) {
|
if (so != NULL) {
|
||||||
if (sbappendaddr(s, &s->so_rcv, sintosa(src), mm, NULL) != 0) {
|
struct inpcb *inp = sotoinpcb(so);
|
||||||
sorwakeup(s);
|
int ret;
|
||||||
|
|
||||||
|
mtx_enter(&inp->inp_mtx);
|
||||||
|
ret = sbappendaddr(so, &so->so_rcv, sintosa(src), mm, NULL);
|
||||||
|
mtx_leave(&inp->inp_mtx);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
sorwakeup(so);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ip6_mroute.c,v 1.137 2023/06/14 14:30:08 mvs Exp $ */
|
/* $OpenBSD: ip6_mroute.c,v 1.138 2023/12/06 09:27:17 bluhm Exp $ */
|
||||||
/* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */
|
/* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */
|
||||||
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
|
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
|
||||||
|
|
||||||
@ -853,11 +853,18 @@ del_m6fc(struct socket *so, struct mf6cctl *mfccp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
socket6_send(struct socket *s, struct mbuf *mm, struct sockaddr_in6 *src)
|
socket6_send(struct socket *so, struct mbuf *mm, struct sockaddr_in6 *src)
|
||||||
{
|
{
|
||||||
if (s) {
|
if (so != NULL) {
|
||||||
if (sbappendaddr(s, &s->so_rcv, sin6tosa(src), mm, NULL) != 0) {
|
struct inpcb *inp = sotoinpcb(so);
|
||||||
sorwakeup(s);
|
int ret;
|
||||||
|
|
||||||
|
mtx_enter(&inp->inp_mtx);
|
||||||
|
ret = sbappendaddr(so, &so->so_rcv, sin6tosa(src), mm, NULL);
|
||||||
|
mtx_leave(&inp->inp_mtx);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
sorwakeup(so);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: constraint.c,v 1.54 2022/11/27 13:19:00 otto Exp $ */
|
/* $OpenBSD: constraint.c,v 1.55 2023/12/06 15:51:53 otto Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
|
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
|
||||||
@ -554,7 +554,6 @@ constraint_close(u_int32_t id)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go on and try the next resolved address for this constraint */
|
|
||||||
return (constraint_init(cstr));
|
return (constraint_init(cstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,7 +926,7 @@ httpsdate_init(const char *addr, const char *port, const char *hostname,
|
|||||||
* version is based on our wallclock, which may well be inaccurate...
|
* version is based on our wallclock, which may well be inaccurate...
|
||||||
*/
|
*/
|
||||||
if (!synced) {
|
if (!synced) {
|
||||||
log_debug("constraints: skipping time in certificate validation");
|
log_debug("constraints: using received time in certificate validation");
|
||||||
tls_config_insecure_noverifytime(httpsdate->tls_config);
|
tls_config_insecure_noverifytime(httpsdate->tls_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ntp.c,v 1.170 2022/11/27 13:19:00 otto Exp $ */
|
/* $OpenBSD: ntp.c,v 1.171 2023/12/06 15:51:53 otto Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||||
@ -75,6 +75,7 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
|
|||||||
int nullfd, pipe_dns[2], idx_clients;
|
int nullfd, pipe_dns[2], idx_clients;
|
||||||
int ctls;
|
int ctls;
|
||||||
int fd_ctl;
|
int fd_ctl;
|
||||||
|
int clear_cdns;
|
||||||
u_int pfd_elms = 0, idx2peer_elms = 0;
|
u_int pfd_elms = 0, idx2peer_elms = 0;
|
||||||
u_int listener_cnt, new_cnt, sent_cnt, trial_cnt;
|
u_int listener_cnt, new_cnt, sent_cnt, trial_cnt;
|
||||||
u_int ctl_cnt;
|
u_int ctl_cnt;
|
||||||
@ -89,7 +90,7 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
|
|||||||
struct stat stb;
|
struct stat stb;
|
||||||
struct ctl_conn *cc;
|
struct ctl_conn *cc;
|
||||||
time_t nextaction, last_sensor_scan = 0, now;
|
time_t nextaction, last_sensor_scan = 0, now;
|
||||||
time_t last_action = 0, interval;
|
time_t last_action = 0, interval, last_cdns_reset = 0;
|
||||||
void *newp;
|
void *newp;
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, PF_UNSPEC,
|
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, PF_UNSPEC,
|
||||||
@ -326,9 +327,11 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
|
|||||||
(peer_cnt == 0 && sensors_cnt == 0)))
|
(peer_cnt == 0 && sensors_cnt == 0)))
|
||||||
priv_settime(0, "no valid peers configured");
|
priv_settime(0, "no valid peers configured");
|
||||||
|
|
||||||
|
clear_cdns = 1;
|
||||||
TAILQ_FOREACH(cstr, &conf->constraints, entry) {
|
TAILQ_FOREACH(cstr, &conf->constraints, entry) {
|
||||||
if (constraint_query(cstr, conf->status.synced) == -1)
|
constraint_query(cstr, conf->status.synced);
|
||||||
continue;
|
if (cstr->state <= STATE_QUERY_SENT)
|
||||||
|
clear_cdns = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibuf_main->w.queued > 0)
|
if (ibuf_main->w.queued > 0)
|
||||||
@ -346,6 +349,13 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
|
|||||||
ctls = i;
|
ctls = i;
|
||||||
|
|
||||||
now = getmonotime();
|
now = getmonotime();
|
||||||
|
if (conf->constraint_median == 0 && clear_cdns &&
|
||||||
|
now - last_cdns_reset > CONSTRAINT_SCAN_INTERVAL) {
|
||||||
|
log_debug("Reset constraint info");
|
||||||
|
constraint_reset();
|
||||||
|
last_cdns_reset = now;
|
||||||
|
nextaction = now + CONSTRAINT_RETRY_INTERVAL;
|
||||||
|
}
|
||||||
timeout = nextaction - now;
|
timeout = nextaction - now;
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user