sync with OpenBSD -current
This commit is contained in:
parent
f7289b5181
commit
880da5e235
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: services,v 1.105 2023/05/25 09:41:46 sthen Exp $
|
# $OpenBSD: services,v 1.106 2023/12/07 14:53:31 sthen Exp $
|
||||||
#
|
#
|
||||||
# Network services, Internet style
|
# Network services, Internet style
|
||||||
# https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
|
# https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
|
||||||
@ -249,6 +249,8 @@ mdnsresponder 5354/tcp # Multicast DNS Responder IPC
|
|||||||
mdnsresponder 5354/udp # Multicast DNS Responder IPC
|
mdnsresponder 5354/udp # Multicast DNS Responder IPC
|
||||||
postgresql 5432/tcp # PostgreSQL
|
postgresql 5432/tcp # PostgreSQL
|
||||||
postgresql 5432/udp # PostgreSQL
|
postgresql 5432/udp # PostgreSQL
|
||||||
|
matter 5540/tcp # Matter IoT
|
||||||
|
matter 5540/udp # Matter IoT
|
||||||
rfb 5900/tcp vnc # Remote Framebuffer
|
rfb 5900/tcp vnc # Remote Framebuffer
|
||||||
syslog-tls 6514/tcp # syslog over TLS
|
syslog-tls 6514/tcp # syslog over TLS
|
||||||
afs3-fileserver 7000/tcp # AFS fileserver
|
afs3-fileserver 7000/tcp # AFS fileserver
|
||||||
|
@ -1 +1 @@
|
|||||||
# SecBSD 1.4-a5839ef: Fri Dec 1 14:35:24 UTC 2023 (Mictlantecuhtli)
|
# SecBSD 1.4-6dd7abc: Thu Dec 7 18:11:47 UTC 2023 (Mictlantecuhtli)
|
||||||
|
@ -1105,6 +1105,7 @@ get_segment_type (unsigned int p_type)
|
|||||||
case PT_OPENBSD_NOBTCFI: pt = "OPENBSD_NOBTCFI"; break;
|
case PT_OPENBSD_NOBTCFI: pt = "OPENBSD_NOBTCFI"; break;
|
||||||
case PT_OPENBSD_BOOTDATA: pt = "OPENBSD_BOOTDATA"; break;
|
case PT_OPENBSD_BOOTDATA: pt = "OPENBSD_BOOTDATA"; break;
|
||||||
case PT_OPENBSD_MUTABLE: pt = "OPENBSD_MUTABLE"; break;
|
case PT_OPENBSD_MUTABLE: pt = "OPENBSD_MUTABLE"; break;
|
||||||
|
case PT_OPENBSD_SYSCALLS: pt = "OPENBSD_SYSCALLS"; break;
|
||||||
default: pt = NULL; break;
|
default: pt = NULL; break;
|
||||||
}
|
}
|
||||||
return pt;
|
return pt;
|
||||||
@ -2654,6 +2655,11 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
|
|||||||
case PT_OPENBSD_MUTABLE:
|
case PT_OPENBSD_MUTABLE:
|
||||||
return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
|
return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
|
||||||
"openbsd_mutable");
|
"openbsd_mutable");
|
||||||
|
|
||||||
|
case PT_OPENBSD_SYSCALLS:
|
||||||
|
return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
|
||||||
|
"openbsd_syscalls");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Check for any processor-specific program segment types. */
|
/* Check for any processor-specific program segment types. */
|
||||||
bed = get_elf_backend_data (abfd);
|
bed = get_elf_backend_data (abfd);
|
||||||
@ -3659,6 +3665,7 @@ map_sections_to_segments (bfd *abfd)
|
|||||||
int tls_count = 0;
|
int tls_count = 0;
|
||||||
asection *first_tls = NULL;
|
asection *first_tls = NULL;
|
||||||
asection *dynsec, *eh_frame_hdr, *randomdata, *mutabledata;
|
asection *dynsec, *eh_frame_hdr, *randomdata, *mutabledata;
|
||||||
|
asection *syscalls;
|
||||||
bfd_size_type amt;
|
bfd_size_type amt;
|
||||||
|
|
||||||
if (elf_tdata (abfd)->segment_map != NULL)
|
if (elf_tdata (abfd)->segment_map != NULL)
|
||||||
@ -4044,6 +4051,24 @@ map_sections_to_segments (bfd *abfd)
|
|||||||
pm = &m->next;
|
pm = &m->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there is a .openbsd.syscalls section, throw in a PT_OPENBSD_SYSCALLS
|
||||||
|
segment. */
|
||||||
|
syscalls = bfd_get_section_by_name (abfd, ".openbsd.syscalls");
|
||||||
|
if (syscalls != NULL && (syscalls->flags & SEC_LOAD) == 0)
|
||||||
|
{
|
||||||
|
amt = sizeof (struct elf_segment_map);
|
||||||
|
m = bfd_zalloc (abfd, amt);
|
||||||
|
if (m == NULL)
|
||||||
|
goto error_return;
|
||||||
|
m->next = NULL;
|
||||||
|
m->p_type = PT_OPENBSD_SYSCALLS;
|
||||||
|
m->count = 1;
|
||||||
|
m->sections[0] = syscalls->output_section;
|
||||||
|
|
||||||
|
*pm = m;
|
||||||
|
pm = &m->next;
|
||||||
|
}
|
||||||
|
|
||||||
if (elf_tdata (abfd)->relro)
|
if (elf_tdata (abfd)->relro)
|
||||||
{
|
{
|
||||||
amt = sizeof (struct elf_segment_map);
|
amt = sizeof (struct elf_segment_map);
|
||||||
@ -4594,6 +4619,12 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
|
|||||||
else if (p->p_type == PT_NOTE
|
else if (p->p_type == PT_NOTE
|
||||||
&& (flags & SEC_HAS_CONTENTS) != 0)
|
&& (flags & SEC_HAS_CONTENTS) != 0)
|
||||||
p->p_filesz += sec->size;
|
p->p_filesz += sec->size;
|
||||||
|
else if (p->p_type == PT_OPENBSD_SYSCALLS)
|
||||||
|
{
|
||||||
|
sec->filepos = off;
|
||||||
|
off += sec->size;
|
||||||
|
p->p_filesz += sec->size;
|
||||||
|
}
|
||||||
|
|
||||||
/* .tbss is special. It doesn't contribute to p_memsz of
|
/* .tbss is special. It doesn't contribute to p_memsz of
|
||||||
normal segments. */
|
normal segments. */
|
||||||
@ -4796,6 +4827,12 @@ get_program_header_size (bfd *abfd)
|
|||||||
++segs;
|
++segs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bfd_get_section_by_name (abfd, ".openbsd.syscalls") != NULL)
|
||||||
|
{
|
||||||
|
/* We need a PT_OPENBSD_SYSCALLS segment. */
|
||||||
|
++segs;
|
||||||
|
}
|
||||||
|
|
||||||
if (elf_tdata (abfd)->eh_frame_hdr)
|
if (elf_tdata (abfd)->eh_frame_hdr)
|
||||||
{
|
{
|
||||||
/* We need a PT_GNU_EH_FRAME segment. */
|
/* We need a PT_GNU_EH_FRAME segment. */
|
||||||
|
@ -2714,6 +2714,8 @@ get_segment_type (unsigned long p_type)
|
|||||||
return "OPENBSD_MUTABLE";
|
return "OPENBSD_MUTABLE";
|
||||||
case PT_OPENBSD_NOBTCFI:
|
case PT_OPENBSD_NOBTCFI:
|
||||||
return "OPENBSD_NOBTCFI";
|
return "OPENBSD_NOBTCFI";
|
||||||
|
case PT_OPENBSD_SYSCALLS:
|
||||||
|
return "OPENBSD_SYSCALLS";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
|
if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
|
||||||
|
@ -316,6 +316,7 @@
|
|||||||
#define PT_OPENBSD_NOBTCFI 0x65a3dbe8 /* no branch target CFI */
|
#define PT_OPENBSD_NOBTCFI 0x65a3dbe8 /* no branch target CFI */
|
||||||
#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* Section for boot arguments */
|
#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* Section for boot arguments */
|
||||||
#define PT_OPENBSD_MUTABLE 0x65a3dbe5 /* Like bss, but not immutable */
|
#define PT_OPENBSD_MUTABLE 0x65a3dbe5 /* Like bss, but not immutable */
|
||||||
|
#define PT_OPENBSD_SYSCALLS 0x65a3dbe9 /* System call sites */
|
||||||
|
|
||||||
/* Program segment permissions, in program header p_flags field. */
|
/* Program segment permissions, in program header p_flags field. */
|
||||||
|
|
||||||
|
@ -1101,6 +1101,8 @@ phdr_type:
|
|||||||
$$ = exp_intop (0x65a41be6);
|
$$ = exp_intop (0x65a41be6);
|
||||||
else if (strcmp (s, "PT_OPENBSD_MUTABLE") == 0)
|
else if (strcmp (s, "PT_OPENBSD_MUTABLE") == 0)
|
||||||
$$ = exp_intop (0x65a3dbe5);
|
$$ = exp_intop (0x65a3dbe5);
|
||||||
|
else if (strcmp (s, "PT_OPENBSD_SYSCALLS") == 0)
|
||||||
|
$$ = exp_intop (0x65a3dbe9);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
einfo (_("\
|
einfo (_("\
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: Makefile,v 1.1 2023/12/06 14:41:52 bluhm Exp $
|
# $OpenBSD: Makefile,v 1.3 2023/12/07 23:47:48 bluhm Exp $
|
||||||
|
|
||||||
PROG= bindconnect
|
PROG= bindconnect
|
||||||
LDADD= -lpthread
|
LDADD= -lpthread
|
||||||
@ -7,22 +7,80 @@ WARNINGS= yes
|
|||||||
|
|
||||||
CLEANFILES= ktrace.out
|
CLEANFILES= ktrace.out
|
||||||
|
|
||||||
${REGRESS_TARGETS}: ${PROG}
|
LOCAL_NET ?=
|
||||||
|
LOCAL_NET6 ?=
|
||||||
|
|
||||||
|
REGRESS_ROOT_TARGETS += setup-maxfiles run-100000 run-localnet-connect-delete
|
||||||
|
|
||||||
|
REGRESS_SETUP_ONCE += setup-maxfiles
|
||||||
|
setup-maxfiles:
|
||||||
|
[[ $$(sysctl -n kern.maxfiles) -ge 110000 ]] || \
|
||||||
|
${SUDO} sysctl kern.maxfiles=110000
|
||||||
|
|
||||||
|
REGRESS_SETUP += ${PROG}
|
||||||
|
|
||||||
REGRESS_TARGETS += run-default
|
REGRESS_TARGETS += run-default
|
||||||
run-default:
|
run-default:
|
||||||
${SUDO} time ${KTRACE} ./${PROG}
|
time ${KTRACE} ./${PROG}
|
||||||
|
|
||||||
REGRESS_TARGETS += run-bind
|
NET_inet = ${LOCAL_NET}
|
||||||
run-bind:
|
NET_inet6 = ${LOCAL_NET6}
|
||||||
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 5 -c 0
|
|
||||||
|
|
||||||
REGRESS_TARGETS += run-connect
|
.for af in inet inet6
|
||||||
run-connect:
|
|
||||||
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 0 -c 5
|
|
||||||
|
|
||||||
REGRESS_TARGETS += run-bind-connect
|
.if ! empty(NET_${af})
|
||||||
run-bind-connect:
|
REGRESS_CLEANUP += cleanup-${af}-delete
|
||||||
${SUDO} time ${KTRACE} ./${PROG} -n 10 -s 2 -o 1 -b 3 -c 3
|
.endif
|
||||||
|
cleanup-${af}-delete:
|
||||||
|
-${SUDO} time ./${PROG} \
|
||||||
|
-f ${af} -s 0 -o 0 -b 0 -c 0 -d 1 -N ${NET_${af}} -t 1
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-bind
|
||||||
|
run-${af}-bind:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 6 -c 0
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-connect
|
||||||
|
run-${af}-connect:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 0 -c 6
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-bind-connect
|
||||||
|
run-${af}-bind-connect:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 3 -c 3
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-100000
|
||||||
|
run-${af}-100000:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 100000 -s 2 -o 1 -b 3 -c 3
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-reuseport
|
||||||
|
run-${af}-reuseport:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 3 -c 3 -r
|
||||||
|
|
||||||
|
.if empty(NET_${af})
|
||||||
|
REGRESS_SKIP_TARGETS += run-${af}-localnet-connect \
|
||||||
|
run-${af}-localnet-bind-connect \
|
||||||
|
run-${af}-localnet-connect-delete
|
||||||
|
.endif
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-localnet-connect
|
||||||
|
run-${af}-localnet-connect:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -c 6 -N ${NET_${af}}
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-localnet-bind-connect
|
||||||
|
run-${af}-localnet-bind-connect:
|
||||||
|
time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 3 -c 3 -N ${NET_${af}}
|
||||||
|
|
||||||
|
REGRESS_TARGETS += run-${af}-localnet-connect-delete
|
||||||
|
run-${af}-localnet-connect-delete:
|
||||||
|
${SUDO} time ${KTRACE} ./${PROG} \
|
||||||
|
-f ${af} -n 16 -s 2 -o 1 -b 0 -c 6 -d 3 -N ${NET_${af}}
|
||||||
|
|
||||||
|
.endfor
|
||||||
|
|
||||||
.include <bsd.regress.mk>
|
.include <bsd.regress.mk>
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
Stress test bind(2) and connect(2) system calls in OpenBSD regress.
|
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]
|
bindconnect [-r] [-b bind] [-c connect] [-d delroute]
|
||||||
-b bind threads binding sockets, default 1
|
[-N addr/net] [-n num] [-o close] [-s socket] [-t time]
|
||||||
-c connect threads connecting sockets, default 1
|
-b bind threads binding sockets, default 1
|
||||||
-n num number of file descriptors, default 100
|
-c connect threads connecting sockets, default 1
|
||||||
-o close threads closing sockets, default 1
|
-d delroute threads deleting cloned routes, default 0
|
||||||
-s socket threads creating sockets, default 1
|
-f family address family inet or inet6, default inet
|
||||||
-t time run time in seconds, default 10
|
-N addr/net connect to any address within network
|
||||||
|
-n num number of file descriptors, default 128
|
||||||
|
-o close threads closing sockets, default 1
|
||||||
|
-r set reuse port socket option
|
||||||
|
-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),
|
Separate threads are started to run socket(2), close(2), bind(2),
|
||||||
and connect(2) system calls concurrently. The number of sockets
|
and connect(2) system calls concurrently. The number of sockets
|
||||||
@ -15,4 +20,9 @@ system calls operate on random file descriptors. By setting the
|
|||||||
number of threads for each system call and the number of available
|
number of threads for each system call and the number of available
|
||||||
file descriptors, the focus for the stress test can be changed.
|
file descriptors, the focus for the stress test can be changed.
|
||||||
|
|
||||||
Currently only IPv4 UDP sockets with 127.0.0.1 are supported.
|
Currently IPv4 and IPv6 UDP sockets are supported. Per default the
|
||||||
|
address to bind and connect is 127.0.0.1 or ::1. LOCAL_NET or
|
||||||
|
LOCAL_NET6 environment variable allows to bind on a local address
|
||||||
|
and connect to all directly attached hosts. This triggers creation
|
||||||
|
of cloned routes during source address selection. To stress test
|
||||||
|
routing table, these routes can be deleted in another thread.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: bindconnect.c,v 1.1 2023/12/06 14:41:52 bluhm Exp $ */
|
/* $OpenBSD: bindconnect.c,v 1.3 2023/12/07 23:47:48 bluhm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Alexander Bluhm <bluhm@openbsd.org>
|
* Copyright (c) 2023 Alexander Bluhm <bluhm@openbsd.org>
|
||||||
@ -19,7 +19,9 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#include <net/route.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -31,31 +33,125 @@
|
|||||||
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
|
#define s6_addr8 __u6_addr.__u6_addr8
|
||||||
|
#define s6_addr16 __u6_addr.__u6_addr16
|
||||||
|
#define s6_addr32 __u6_addr.__u6_addr32
|
||||||
|
|
||||||
|
union sockaddr_union {
|
||||||
|
struct sockaddr su_sa;
|
||||||
|
struct sockaddr_in su_sin;
|
||||||
|
struct sockaddr_in6 su_sin6;
|
||||||
|
};
|
||||||
|
|
||||||
|
union inaddr_union {
|
||||||
|
struct in_addr au_inaddr;
|
||||||
|
struct in6_addr au_in6addr;
|
||||||
|
};
|
||||||
|
|
||||||
int fd_base;
|
int fd_base;
|
||||||
unsigned int fd_num = 100;
|
unsigned int fd_num = 128;
|
||||||
unsigned int run_time = 10;
|
unsigned int run_time = 10;
|
||||||
unsigned int socket_num = 1, close_num = 1, bind_num = 1, connect_num = 1;
|
unsigned int socket_num = 1, close_num = 1, bind_num = 1, connect_num = 1,
|
||||||
|
delroute_num = 0;
|
||||||
|
int reuse_port = 0;
|
||||||
|
const char *family = "inet";
|
||||||
|
union inaddr_union addr, mask;
|
||||||
|
int af, prefix = -1, route_sock = -1;
|
||||||
|
|
||||||
static void __dead
|
static void __dead
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"bindconnect [-b bind] [-c connect] [-n num] [-o close]\n"
|
"bindconnect [-r] [-b bind] [-c connect] [-d delroute]\n"
|
||||||
"[-s socket] [-t time]\n"
|
"[-N addr/net] [-n num] [-o close] [-s socket] [-t time]\n"
|
||||||
" -b bind threads binding sockets, default %u\n"
|
" -b bind threads binding sockets, default %u\n"
|
||||||
" -c connect threads connecting sockets, default %u\n"
|
" -c connect threads connecting sockets, default %u\n"
|
||||||
" -n num number of file descriptors, default %u\n"
|
" -d delroute threads deleting cloned routes, default %u\n"
|
||||||
" -o close threads closing sockets, default %u\n"
|
" -f family address family inet or inet6, default %s\n"
|
||||||
" -s socket threads creating sockets, default %u\n"
|
" -N addr/net connect to any address within network\n"
|
||||||
" -t time run time in seconds, default %u\n",
|
" -n num number of file descriptors, default %u\n"
|
||||||
bind_num, connect_num, fd_num, close_num, socket_num, run_time);
|
" -o close threads closing sockets, default %u\n"
|
||||||
|
" -r set reuse port socket option\n"
|
||||||
|
" -s socket threads creating sockets, default %u\n"
|
||||||
|
" -t time run time in seconds, default %u\n",
|
||||||
|
bind_num, connect_num, delroute_num, family, fd_num, close_num,
|
||||||
|
socket_num, run_time);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct sockaddr *
|
static void
|
||||||
sintosa(struct sockaddr_in *sin)
|
in_prefixlen2mask(struct in_addr *maskp, int plen)
|
||||||
{
|
{
|
||||||
return ((struct sockaddr *)(sin));
|
if (plen == 0)
|
||||||
|
maskp->s_addr = 0;
|
||||||
|
else
|
||||||
|
maskp->s_addr = htonl(0xffffffff << (32 - plen));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
in6_prefixlen2mask(struct in6_addr *maskp, int len)
|
||||||
|
{
|
||||||
|
u_char maskarray[8] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
|
||||||
|
int bytelen, bitlen, i;
|
||||||
|
|
||||||
|
bzero(maskp, sizeof(*maskp));
|
||||||
|
bytelen = len / 8;
|
||||||
|
bitlen = len % 8;
|
||||||
|
for (i = 0; i < bytelen; i++)
|
||||||
|
maskp->s6_addr[i] = 0xff;
|
||||||
|
/* len == 128 is ok because bitlen == 0 then */
|
||||||
|
if (bitlen)
|
||||||
|
maskp->s6_addr[bytelen] = maskarray[bitlen - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_sockaddr(union sockaddr_union *su)
|
||||||
|
{
|
||||||
|
memset(su, 0, sizeof(*su));
|
||||||
|
su->su_sa.sa_family = af;
|
||||||
|
if (af == AF_INET) {
|
||||||
|
su->su_sin.sin_len = sizeof(su->su_sin);
|
||||||
|
if (prefix >= 0)
|
||||||
|
su->su_sin.sin_addr = addr.au_inaddr;
|
||||||
|
else
|
||||||
|
su->su_sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
|
}
|
||||||
|
if (af == AF_INET6) {
|
||||||
|
su->su_sin6.sin6_len = sizeof(su->su_sin6);
|
||||||
|
if (prefix >= 0)
|
||||||
|
su->su_sin6.sin6_addr = addr.au_in6addr;
|
||||||
|
else
|
||||||
|
su->su_sin6.sin6_addr = in6addr_loopback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mask_sockaddr(union sockaddr_union *su)
|
||||||
|
{
|
||||||
|
if (af == AF_INET) {
|
||||||
|
if (prefix >=0 && prefix != 32) {
|
||||||
|
su->su_sin.sin_addr.s_addr &=
|
||||||
|
mask.au_inaddr.s_addr;
|
||||||
|
/* do only 8 bits variation, routes should be reused */
|
||||||
|
su->su_sin.sin_addr.s_addr |= htonl(255) &
|
||||||
|
~mask.au_inaddr.s_addr & arc4random();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (af == AF_INET6) {
|
||||||
|
if (prefix >=0 && prefix != 128) {
|
||||||
|
su->su_sin6.sin6_addr.s6_addr32[0] &=
|
||||||
|
mask.au_in6addr.s6_addr32[0];
|
||||||
|
su->su_sin6.sin6_addr.s6_addr32[1] &=
|
||||||
|
mask.au_in6addr.s6_addr32[1];
|
||||||
|
su->su_sin6.sin6_addr.s6_addr32[2] &=
|
||||||
|
mask.au_in6addr.s6_addr32[2];
|
||||||
|
su->su_sin6.sin6_addr.s6_addr32[3] &=
|
||||||
|
mask.au_in6addr.s6_addr32[3];
|
||||||
|
/* do only 8 bits variation, routes should be reused */
|
||||||
|
su->su_sin6.sin6_addr.s6_addr32[3] |= htonl(255) &
|
||||||
|
~mask.au_in6addr.s6_addr32[3] & arc4random();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -63,9 +159,16 @@ thread_socket(void *arg)
|
|||||||
{
|
{
|
||||||
volatile int *run = arg;
|
volatile int *run = arg;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
|
int fd;
|
||||||
|
|
||||||
for (count = 0; *run; count++) {
|
for (count = 0; *run; count++) {
|
||||||
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
int opt;
|
||||||
|
|
||||||
|
fd = socket(af, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (fd < 0 || !reuse_port)
|
||||||
|
continue;
|
||||||
|
opt = 1;
|
||||||
|
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)count;
|
return (void *)count;
|
||||||
@ -92,16 +195,13 @@ thread_bind(void *arg)
|
|||||||
volatile int *run = arg;
|
volatile int *run = arg;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_in sin;
|
union sockaddr_union su;
|
||||||
|
|
||||||
memset(&sin, 0, sizeof(sin));
|
fill_sockaddr(&su);
|
||||||
sin.sin_len = sizeof(sin);
|
|
||||||
sin.sin_family = AF_INET;
|
|
||||||
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
||||||
|
|
||||||
for (count = 0; *run; count++) {
|
for (count = 0; *run; count++) {
|
||||||
fd = fd_base + arc4random_uniform(fd_num);
|
fd = fd_base + arc4random_uniform(fd_num);
|
||||||
bind(fd, sintosa(&sin), sizeof(sin));
|
bind(fd, &su.su_sa, su.su_sa.sa_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)count;
|
return (void *)count;
|
||||||
@ -113,37 +213,89 @@ thread_connect(void *arg)
|
|||||||
volatile int *run = arg;
|
volatile int *run = arg;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_in sin;
|
union sockaddr_union su;
|
||||||
|
|
||||||
memset(&sin, 0, sizeof(sin));
|
fill_sockaddr(&su);
|
||||||
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++) {
|
for (count = 0; *run; count++) {
|
||||||
fd = fd_base + arc4random_uniform(fd_num);
|
fd = fd_base + arc4random_uniform(fd_num);
|
||||||
connect(fd, sintosa(&sin), sizeof(sin));
|
mask_sockaddr(&su);
|
||||||
|
if (af == AF_INET)
|
||||||
|
su.su_sin.sin_port = arc4random();
|
||||||
|
if (af == AF_INET6)
|
||||||
|
su.su_sin6.sin6_port = arc4random();
|
||||||
|
connect(fd, &su.su_sa, su.su_sa.sa_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)count;
|
return (void *)count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
thread_delroute(void *arg)
|
||||||
|
{
|
||||||
|
volatile int *run = arg;
|
||||||
|
unsigned long count;
|
||||||
|
int seq = 0;
|
||||||
|
struct {
|
||||||
|
struct rt_msghdr m_rtm;
|
||||||
|
char m_space[512];
|
||||||
|
} m_rtmsg;
|
||||||
|
union sockaddr_union su;
|
||||||
|
|
||||||
|
#define rtm \
|
||||||
|
m_rtmsg.m_rtm
|
||||||
|
#define ROUNDUP(a) \
|
||||||
|
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
|
||||||
|
#define ADVANCE(x, n) \
|
||||||
|
(x += ROUNDUP((n)->sa_len))
|
||||||
|
#define NEXTADDR(w, sa) \
|
||||||
|
if (rtm.rtm_addrs & (w)) { \
|
||||||
|
int l = ROUNDUP((sa)->sa_len); \
|
||||||
|
memcpy(cp, (sa), l); \
|
||||||
|
cp += l; \
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&m_rtmsg, 0, sizeof(m_rtmsg));
|
||||||
|
rtm.rtm_type = RTM_DELETE;
|
||||||
|
rtm.rtm_flags = RTF_HOST;
|
||||||
|
rtm.rtm_version = RTM_VERSION;
|
||||||
|
rtm.rtm_addrs = RTA_DST;
|
||||||
|
rtm.rtm_hdrlen = sizeof(rtm);
|
||||||
|
|
||||||
|
fill_sockaddr(&su);
|
||||||
|
|
||||||
|
for (count = 0; *run; count++) {
|
||||||
|
char *cp = m_rtmsg.m_space;
|
||||||
|
|
||||||
|
rtm.rtm_seq = ++seq;
|
||||||
|
mask_sockaddr(&su);
|
||||||
|
NEXTADDR(RTA_DST, &su.su_sa);
|
||||||
|
rtm.rtm_msglen = cp - (char *)&m_rtmsg;
|
||||||
|
write(route_sock, &m_rtmsg, rtm.rtm_msglen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef rtm
|
||||||
|
#undef ROUNDUP
|
||||||
|
#undef ADVANCE
|
||||||
|
#undef NEXTADDR
|
||||||
|
|
||||||
|
return (void *)count;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
pthread_t *tsocket, *tclose, *tbind, *tconnect;
|
pthread_t *tsocket, *tclose, *tbind, *tconnect, *tdelroute;
|
||||||
const char *errstr;
|
const char *errstr, *addr_net = NULL;
|
||||||
|
char buf[128], *p;
|
||||||
int ch, run;
|
int ch, run;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
unsigned long socket_count, close_count, bind_count, connect_count;
|
unsigned long socket_count, close_count, bind_count, connect_count,
|
||||||
|
delroute_count;
|
||||||
|
union sockaddr_union su;
|
||||||
|
|
||||||
fd_base = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
while ((ch = getopt(argc, argv, "b:c:d:f:N:n:o:rs:t:")) != -1) {
|
||||||
if (fd_base < 0)
|
|
||||||
err(1, "socket fd_base");
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "b:c:n:o:s:t:")) != -1) {
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
bind_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
bind_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
@ -155,9 +307,19 @@ main(int argc, char *argv[])
|
|||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
errx(1, "connect is %s: %s", errstr, optarg);
|
errx(1, "connect is %s: %s", errstr, optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
delroute_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
|
if (errstr != NULL)
|
||||||
|
errx(1, "delroute is %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
family = optarg;
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
addr_net = optarg;
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
fd_num = strtonum(optarg, 1, INT_MAX - fd_base,
|
fd_num = strtonum(optarg, 1, INT_MAX, &errstr);
|
||||||
&errstr);
|
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
errx(1, "num is %s: %s", errstr, optarg);
|
errx(1, "num is %s: %s", errstr, optarg);
|
||||||
break;
|
break;
|
||||||
@ -166,6 +328,9 @@ main(int argc, char *argv[])
|
|||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
errx(1, "close is %s: %s", errstr, optarg);
|
errx(1, "close is %s: %s", errstr, optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
reuse_port = 1;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
socket_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
socket_num = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
@ -185,6 +350,58 @@ main(int argc, char *argv[])
|
|||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
if (strcmp(family, "inet") == 0)
|
||||||
|
af = AF_INET;
|
||||||
|
else if (strcmp(family, "inet6") == 0)
|
||||||
|
af = AF_INET6;
|
||||||
|
else
|
||||||
|
errx(1, "bad address family %s", family);
|
||||||
|
|
||||||
|
/* split addr/net into addr, mask, prefix */
|
||||||
|
if (addr_net != NULL) {
|
||||||
|
prefix = inet_net_pton(af, addr_net, &addr, sizeof(addr));
|
||||||
|
if (prefix < 0)
|
||||||
|
err(1, "inet_net_pton %s", addr_net);
|
||||||
|
if (af == AF_INET6) {
|
||||||
|
/*
|
||||||
|
* Man page says inet_net_pton() preserves lower
|
||||||
|
* bits. That is not true, call inet_pton() again.
|
||||||
|
*/
|
||||||
|
if (strlcpy(buf, addr_net, sizeof(buf)) >= sizeof(buf))
|
||||||
|
err(1, "strlcpy %s", addr_net);
|
||||||
|
p = strchr(buf, '/');
|
||||||
|
if (p != NULL ) {
|
||||||
|
*p = '\0';
|
||||||
|
if (inet_pton(af, buf, &addr) < 0)
|
||||||
|
err(1, "inet_pton %s", buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (af == AF_INET)
|
||||||
|
in_prefixlen2mask(&mask.au_inaddr, prefix);
|
||||||
|
if (af == AF_INET6)
|
||||||
|
in6_prefixlen2mask(&mask.au_in6addr, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* preopen route socket before file descriptor limits are set */
|
||||||
|
if (delroute_num > 0) {
|
||||||
|
if (prefix < 0 || prefix == 32)
|
||||||
|
errx(1, "delroute %u needs addr/net", delroute_num);
|
||||||
|
route_sock = socket(AF_ROUTE, SOCK_RAW, af);
|
||||||
|
if (route_sock < 0)
|
||||||
|
err(1, "socket route");
|
||||||
|
if (shutdown(route_sock, SHUT_RD) < 0)
|
||||||
|
err(1, "shutdown read route");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* detect lowest file desciptor, test bind, close everything above */
|
||||||
|
fd_base = socket(af, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (fd_base < 0)
|
||||||
|
err(1, "socket fd_base");
|
||||||
|
if (fd_base > INT_MAX - (int)fd_num)
|
||||||
|
err(1, "fd base %d and num %u overflow", fd_base, fd_num);
|
||||||
|
fill_sockaddr(&su);
|
||||||
|
if (bind(fd_base, &su.su_sa, su.su_sa.sa_len) < 0)
|
||||||
|
err(1, "bind %s", inet_ntop(af, &addr, buf, sizeof(buf)));
|
||||||
if (closefrom(fd_base) < 0)
|
if (closefrom(fd_base) < 0)
|
||||||
err(1, "closefrom %d", fd_base);
|
err(1, "closefrom %d", fd_base);
|
||||||
|
|
||||||
@ -196,6 +413,7 @@ main(int argc, char *argv[])
|
|||||||
err(1, "setrlimit %llu", rlim.rlim_cur);
|
err(1, "setrlimit %llu", rlim.rlim_cur);
|
||||||
|
|
||||||
run = 1;
|
run = 1;
|
||||||
|
|
||||||
tsocket = calloc(socket_num, sizeof(pthread_t));
|
tsocket = calloc(socket_num, sizeof(pthread_t));
|
||||||
if (tsocket == NULL)
|
if (tsocket == NULL)
|
||||||
err(1, "tsocket");
|
err(1, "tsocket");
|
||||||
@ -204,6 +422,7 @@ main(int argc, char *argv[])
|
|||||||
if (errno)
|
if (errno)
|
||||||
err(1, "pthread_create socket %u", n);
|
err(1, "pthread_create socket %u", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
tclose = calloc(close_num, sizeof(pthread_t));
|
tclose = calloc(close_num, sizeof(pthread_t));
|
||||||
if (tclose == NULL)
|
if (tclose == NULL)
|
||||||
err(1, "tclose");
|
err(1, "tclose");
|
||||||
@ -212,6 +431,7 @@ main(int argc, char *argv[])
|
|||||||
if (errno)
|
if (errno)
|
||||||
err(1, "pthread_create close %u", n);
|
err(1, "pthread_create close %u", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
tbind = calloc(bind_num, sizeof(pthread_t));
|
tbind = calloc(bind_num, sizeof(pthread_t));
|
||||||
if (tbind == NULL)
|
if (tbind == NULL)
|
||||||
err(1, "tbind");
|
err(1, "tbind");
|
||||||
@ -220,6 +440,7 @@ main(int argc, char *argv[])
|
|||||||
if (errno)
|
if (errno)
|
||||||
err(1, "pthread_create bind %u", n);
|
err(1, "pthread_create bind %u", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
tconnect = calloc(connect_num, sizeof(pthread_t));
|
tconnect = calloc(connect_num, sizeof(pthread_t));
|
||||||
if (tconnect == NULL)
|
if (tconnect == NULL)
|
||||||
err(1, "tconnect");
|
err(1, "tconnect");
|
||||||
@ -230,6 +451,16 @@ main(int argc, char *argv[])
|
|||||||
err(1, "pthread_create connect %u", n);
|
err(1, "pthread_create connect %u", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tdelroute = calloc(delroute_num, sizeof(pthread_t));
|
||||||
|
if (tdelroute == NULL)
|
||||||
|
err(1, "tdelroute");
|
||||||
|
for (n = 0; n < delroute_num; n++) {
|
||||||
|
errno = pthread_create(&tdelroute[n], NULL, thread_delroute,
|
||||||
|
&run);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_create delroute %u", n);
|
||||||
|
}
|
||||||
|
|
||||||
if (run_time > 0) {
|
if (run_time > 0) {
|
||||||
if (sleep(run_time) < 0)
|
if (sleep(run_time) < 0)
|
||||||
err(1, "sleep %u", run_time);
|
err(1, "sleep %u", run_time);
|
||||||
@ -245,6 +476,8 @@ main(int argc, char *argv[])
|
|||||||
err(1, "pthread_join socket %u", n);
|
err(1, "pthread_join socket %u", n);
|
||||||
socket_count += count;
|
socket_count += count;
|
||||||
}
|
}
|
||||||
|
free(tsocket);
|
||||||
|
|
||||||
close_count = 0;
|
close_count = 0;
|
||||||
for (n = 0; n < close_num; n++) {
|
for (n = 0; n < close_num; n++) {
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
@ -254,6 +487,8 @@ main(int argc, char *argv[])
|
|||||||
err(1, "pthread_join close %u", n);
|
err(1, "pthread_join close %u", n);
|
||||||
close_count += count;
|
close_count += count;
|
||||||
}
|
}
|
||||||
|
free(tclose);
|
||||||
|
|
||||||
bind_count = 0;
|
bind_count = 0;
|
||||||
for (n = 0; n < bind_num; n++) {
|
for (n = 0; n < bind_num; n++) {
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
@ -263,6 +498,8 @@ main(int argc, char *argv[])
|
|||||||
err(1, "pthread_join bind %u", n);
|
err(1, "pthread_join bind %u", n);
|
||||||
bind_count += count;
|
bind_count += count;
|
||||||
}
|
}
|
||||||
|
free(tbind);
|
||||||
|
|
||||||
connect_count = 0;
|
connect_count = 0;
|
||||||
for (n = 0; n < connect_num; n++) {
|
for (n = 0; n < connect_num; n++) {
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
@ -272,8 +509,23 @@ main(int argc, char *argv[])
|
|||||||
err(1, "pthread_join connect %u", n);
|
err(1, "pthread_join connect %u", n);
|
||||||
connect_count += count;
|
connect_count += count;
|
||||||
}
|
}
|
||||||
printf("count: socket %lu, close %lu, bind %lu, connect %lu\n",
|
free(tconnect);
|
||||||
socket_count, close_count, bind_count, connect_count);
|
|
||||||
|
delroute_count = 0;
|
||||||
|
for (n = 0; n < delroute_num; n++) {
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
errno = pthread_join(tdelroute[n], (void **)&count);
|
||||||
|
if (errno)
|
||||||
|
err(1, "pthread_join delroute %u", n);
|
||||||
|
delroute_count += count;
|
||||||
|
}
|
||||||
|
free(tdelroute);
|
||||||
|
|
||||||
|
printf("count: socket %lu, close %lu, bind %lu, connect %lu, "
|
||||||
|
"delroute %lu\n",
|
||||||
|
socket_count, close_count, bind_count, connect_count,
|
||||||
|
delroute_count);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: eephy.c,v 1.61 2023/12/05 11:06:05 uwe Exp $ */
|
/* $OpenBSD: eephy.c,v 1.62 2023/12/07 09:46:58 uwe Exp $ */
|
||||||
/*
|
/*
|
||||||
* Principal Author: Parag Patel
|
* Principal Author: Parag Patel
|
||||||
* Copyright (c) 2001
|
* Copyright (c) 2001
|
||||||
@ -276,10 +276,13 @@ eephy_reset(struct mii_softc *sc)
|
|||||||
|
|
||||||
PHY_WRITE(sc, E1000_SCR, reg);
|
PHY_WRITE(sc, E1000_SCR, reg);
|
||||||
|
|
||||||
/* 25 MHz TX_CLK should always work. */
|
if (sc->mii_model != MII_MODEL_MARVELL_E1512 &&
|
||||||
reg = PHY_READ(sc, E1000_ESCR);
|
sc->mii_model != MII_MODEL_MARVELL_E1545) {
|
||||||
reg |= E1000_ESCR_TX_CLK_25;
|
/* 25 MHz TX_CLK should always work. */
|
||||||
PHY_WRITE(sc, E1000_ESCR, reg);
|
reg = PHY_READ(sc, E1000_ESCR);
|
||||||
|
reg |= E1000_ESCR_TX_CLK_25;
|
||||||
|
PHY_WRITE(sc, E1000_ESCR, reg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Configure LEDs if they were left unconfigured. */
|
/* Configure LEDs if they were left unconfigured. */
|
||||||
if (sc->mii_model == MII_MODEL_MARVELL_E3016 &&
|
if (sc->mii_model == MII_MODEL_MARVELL_E3016 &&
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: eephyreg.h,v 1.9 2022/01/09 05:42:44 jsg Exp $ */
|
/* $OpenBSD: eephyreg.h,v 1.10 2023/12/07 09:46:58 uwe Exp $ */
|
||||||
/*
|
/*
|
||||||
* Principal Author: Parag Patel
|
* Principal Author: Parag Patel
|
||||||
* Copyright (c) 2001
|
* Copyright (c) 2001
|
||||||
@ -284,6 +284,7 @@
|
|||||||
#define E1000_ISR_SPEED_CHANGED 0x4000
|
#define E1000_ISR_SPEED_CHANGED 0x4000
|
||||||
#define E1000_ISR_AUTO_NEG_ERR 0x8000
|
#define E1000_ISR_AUTO_NEG_ERR 0x8000
|
||||||
|
|
||||||
|
/* page any */
|
||||||
#define E1000_ESCR 0x14 /* extended special control reg */
|
#define E1000_ESCR 0x14 /* extended special control reg */
|
||||||
#define E1000_ESCR_FIBER_LOOPBACK 0x4000
|
#define E1000_ESCR_FIBER_LOOPBACK 0x4000
|
||||||
#define E1000_ESCR_DOWN_NO_IDLE 0x8000
|
#define E1000_ESCR_DOWN_NO_IDLE 0x8000
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* $OpenBSD: init_sysent.c,v 1.269 2023/11/29 20:46:23 bluhm Exp $ */
|
/* $OpenBSD: init_sysent.c,v 1.270 2023/12/07 14:00:16 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call switch table.
|
* System call switch table.
|
||||||
*
|
*
|
||||||
* DO NOT EDIT-- this file is automatically generated.
|
* DO NOT EDIT-- this file is automatically generated.
|
||||||
* created from; OpenBSD: syscalls.master,v 1.251 2023/11/29 20:40:06 bluhm Exp
|
* created from; OpenBSD: syscalls.master,v 1.252 2023/12/07 13:59:04 deraadt Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -353,8 +353,8 @@ const struct sysent sysent[] = {
|
|||||||
sys_nosys }, /* 156 = obsolete ogetdirentries */
|
sys_nosys }, /* 156 = obsolete ogetdirentries */
|
||||||
{ 0, 0, 0,
|
{ 0, 0, 0,
|
||||||
sys_nosys }, /* 157 = obsolete statfs25 */
|
sys_nosys }, /* 157 = obsolete statfs25 */
|
||||||
{ 0, 0, 0,
|
{ 4, s(struct sys_pinsyscalls_args), 0,
|
||||||
sys_nosys }, /* 158 = obsolete fstatfs25 */
|
sys_pinsyscalls }, /* 158 = pinsyscalls */
|
||||||
{ 2, s(struct sys_mimmutable_args), 0,
|
{ 2, s(struct sys_mimmutable_args), 0,
|
||||||
sys_mimmutable }, /* 159 = mimmutable */
|
sys_mimmutable }, /* 159 = mimmutable */
|
||||||
{ 4, s(struct sys_waitid_args), 0,
|
{ 4, s(struct sys_waitid_args), 0,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* $OpenBSD: syscalls.c,v 1.267 2023/11/29 20:46:23 bluhm Exp $ */
|
/* $OpenBSD: syscalls.c,v 1.268 2023/12/07 14:00:16 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call names.
|
* System call names.
|
||||||
*
|
*
|
||||||
* DO NOT EDIT-- this file is automatically generated.
|
* DO NOT EDIT-- this file is automatically generated.
|
||||||
* created from; OpenBSD: syscalls.master,v 1.251 2023/11/29 20:40:06 bluhm Exp
|
* created from; OpenBSD: syscalls.master,v 1.252 2023/12/07 13:59:04 deraadt Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *const syscallnames[] = {
|
const char *const syscallnames[] = {
|
||||||
@ -182,7 +182,7 @@ const char *const syscallnames[] = {
|
|||||||
#endif
|
#endif
|
||||||
"#156 (obsolete ogetdirentries)", /* 156 = obsolete ogetdirentries */
|
"#156 (obsolete ogetdirentries)", /* 156 = obsolete ogetdirentries */
|
||||||
"#157 (obsolete statfs25)", /* 157 = obsolete statfs25 */
|
"#157 (obsolete statfs25)", /* 157 = obsolete statfs25 */
|
||||||
"#158 (obsolete fstatfs25)", /* 158 = obsolete fstatfs25 */
|
"pinsyscalls", /* 158 = pinsyscalls */
|
||||||
"mimmutable", /* 159 = mimmutable */
|
"mimmutable", /* 159 = mimmutable */
|
||||||
"waitid", /* 160 = waitid */
|
"waitid", /* 160 = waitid */
|
||||||
"getfh", /* 161 = getfh */
|
"getfh", /* 161 = getfh */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; $OpenBSD: syscalls.master,v 1.251 2023/11/29 20:40:06 bluhm Exp $
|
; $OpenBSD: syscalls.master,v 1.252 2023/12/07 13:59:04 deraadt Exp $
|
||||||
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
|
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
|
||||||
|
|
||||||
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
||||||
@ -306,7 +306,8 @@
|
|||||||
#endif
|
#endif
|
||||||
156 OBSOL ogetdirentries
|
156 OBSOL ogetdirentries
|
||||||
157 OBSOL statfs25
|
157 OBSOL statfs25
|
||||||
158 OBSOL fstatfs25
|
158 STD { int sys_pinsyscalls(void *base, size_t len, \
|
||||||
|
void *pins, size_t pinslen); }
|
||||||
159 STD { int sys_mimmutable(void *addr, size_t len); }
|
159 STD { int sys_mimmutable(void *addr, size_t len); }
|
||||||
160 STD { int sys_waitid(int idtype, id_t id, \
|
160 STD { int sys_waitid(int idtype, id_t id, \
|
||||||
siginfo_t *info, int options); }
|
siginfo_t *info, int options); }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: in_pcb.c,v 1.281 2023/12/03 20:24:17 bluhm Exp $ */
|
/* $OpenBSD: in_pcb.c,v 1.282 2023/12/07 16:08:30 bluhm Exp $ */
|
||||||
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -131,6 +131,13 @@ uint64_t in_pcbhash(struct inpcbtable *, u_int,
|
|||||||
const struct in_addr *, u_short, const struct in_addr *, u_short);
|
const struct in_addr *, u_short, const struct in_addr *, u_short);
|
||||||
uint64_t in_pcblhash(struct inpcbtable *, u_int, u_short);
|
uint64_t in_pcblhash(struct inpcbtable *, u_int, u_short);
|
||||||
|
|
||||||
|
struct inpcb *in_pcblookup_lock(struct inpcbtable *, struct in_addr, u_int,
|
||||||
|
struct in_addr, u_int, u_int, int);
|
||||||
|
int in_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in *, int,
|
||||||
|
struct proc *, int);
|
||||||
|
int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *,
|
||||||
|
struct proc *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in_pcb is used for inet and inet6. in6_pcb only contains special
|
* in_pcb is used for inet and inet6. in6_pcb only contains special
|
||||||
* IPv6 cases. So the internet initializer is used for both domains.
|
* IPv6 cases. So the internet initializer is used for both domains.
|
||||||
@ -269,9 +276,8 @@ in_pcballoc(struct socket *so, struct inpcbtable *table, int wait)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
in_pcbbind_locked(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
||||||
{
|
{
|
||||||
struct inpcbtable *table = inp->inp_table;
|
|
||||||
struct socket *so = inp->inp_socket;
|
struct socket *so = inp->inp_socket;
|
||||||
u_int16_t lport = 0;
|
u_int16_t lport = 0;
|
||||||
int wild = 0;
|
int wild = 0;
|
||||||
@ -297,7 +303,8 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
|||||||
|
|
||||||
if ((error = in6_nam2sin6(nam, &sin6)))
|
if ((error = in6_nam2sin6(nam, &sin6)))
|
||||||
return (error);
|
return (error);
|
||||||
if ((error = in6_pcbaddrisavail(inp, sin6, wild, p)))
|
if ((error = in6_pcbaddrisavail_lock(inp, sin6, wild,
|
||||||
|
p, IN_PCBLOCK_HOLD)))
|
||||||
return (error);
|
return (error);
|
||||||
laddr = &sin6->sin6_addr;
|
laddr = &sin6->sin6_addr;
|
||||||
lport = sin6->sin6_port;
|
lport = sin6->sin6_port;
|
||||||
@ -313,7 +320,8 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
|||||||
|
|
||||||
if ((error = in_nam2sin(nam, &sin)))
|
if ((error = in_nam2sin(nam, &sin)))
|
||||||
return (error);
|
return (error);
|
||||||
if ((error = in_pcbaddrisavail(inp, sin, wild, p)))
|
if ((error = in_pcbaddrisavail_lock(inp, sin, wild,
|
||||||
|
p, IN_PCBLOCK_HOLD)))
|
||||||
return (error);
|
return (error);
|
||||||
laddr = &sin->sin_addr;
|
laddr = &sin->sin_addr;
|
||||||
lport = sin->sin_port;
|
lport = sin->sin_port;
|
||||||
@ -337,16 +345,28 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
|||||||
inp->inp_laddr = *(struct in_addr *)laddr;
|
inp->inp_laddr = *(struct in_addr *)laddr;
|
||||||
}
|
}
|
||||||
inp->inp_lport = lport;
|
inp->inp_lport = lport;
|
||||||
mtx_enter(&table->inpt_mtx);
|
|
||||||
in_pcbrehash(inp);
|
in_pcbrehash(inp);
|
||||||
mtx_leave(&table->inpt_mtx);
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
||||||
struct proc *p)
|
{
|
||||||
|
struct inpcbtable *table = inp->inp_table;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* keep lookup, modification, and rehash in sync */
|
||||||
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
error = in_pcbbind_locked(inp, nam, p);
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
in_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
||||||
|
struct proc *p, int lock)
|
||||||
{
|
{
|
||||||
struct socket *so = inp->inp_socket;
|
struct socket *so = inp->inp_socket;
|
||||||
struct inpcbtable *table = inp->inp_table;
|
struct inpcbtable *table = inp->inp_table;
|
||||||
@ -393,19 +413,21 @@ in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (so->so_euid && !IN_MULTICAST(sin->sin_addr.s_addr)) {
|
if (so->so_euid && !IN_MULTICAST(sin->sin_addr.s_addr)) {
|
||||||
t = in_pcblookup_local(table, &sin->sin_addr, lport,
|
t = in_pcblookup_local_lock(table, &sin->sin_addr,
|
||||||
INPLOOKUP_WILDCARD, inp->inp_rtableid);
|
lport, INPLOOKUP_WILDCARD, inp->inp_rtableid, lock);
|
||||||
if (t && (so->so_euid != t->inp_socket->so_euid))
|
if (t && (so->so_euid != t->inp_socket->so_euid))
|
||||||
error = EADDRINUSE;
|
error = EADDRINUSE;
|
||||||
in_pcbunref(t);
|
if (lock == IN_PCBLOCK_GRAB)
|
||||||
|
in_pcbunref(t);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
t = in_pcblookup_local(table, &sin->sin_addr, lport,
|
t = in_pcblookup_local_lock(table, &sin->sin_addr, lport,
|
||||||
wild, inp->inp_rtableid);
|
wild, inp->inp_rtableid, lock);
|
||||||
if (t && (reuseport & t->inp_socket->so_options) == 0)
|
if (t && (reuseport & t->inp_socket->so_options) == 0)
|
||||||
error = EADDRINUSE;
|
error = EADDRINUSE;
|
||||||
in_pcbunref(t);
|
if (lock == IN_PCBLOCK_GRAB)
|
||||||
|
in_pcbunref(t);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
@ -413,6 +435,13 @@ in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild,
|
||||||
|
struct proc *p)
|
||||||
|
{
|
||||||
|
return in_pcbaddrisavail_lock(inp, sin, wild, p, IN_PCBLOCK_GRAB);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
||||||
const struct inpcb *inp, struct proc *p)
|
const struct inpcb *inp, struct proc *p)
|
||||||
@ -423,6 +452,8 @@ in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
|||||||
u_int16_t first, last, lower, higher, candidate, localport;
|
u_int16_t first, last, lower, higher, candidate, localport;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
||||||
|
|
||||||
if (inp->inp_flags & INP_HIGHPORT) {
|
if (inp->inp_flags & INP_HIGHPORT) {
|
||||||
first = ipport_hifirstauto; /* sysctl */
|
first = ipport_hifirstauto; /* sysctl */
|
||||||
last = ipport_hilastauto;
|
last = ipport_hilastauto;
|
||||||
@ -451,9 +482,7 @@ in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
|||||||
count = higher - lower;
|
count = higher - lower;
|
||||||
candidate = lower + arc4random_uniform(count);
|
candidate = lower + arc4random_uniform(count);
|
||||||
|
|
||||||
t = NULL;
|
|
||||||
do {
|
do {
|
||||||
in_pcbunref(t);
|
|
||||||
do {
|
do {
|
||||||
if (count-- < 0) /* completely used? */
|
if (count-- < 0) /* completely used? */
|
||||||
return (EADDRNOTAVAIL);
|
return (EADDRNOTAVAIL);
|
||||||
@ -462,8 +491,8 @@ in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
|||||||
candidate = lower;
|
candidate = lower;
|
||||||
localport = htons(candidate);
|
localport = htons(candidate);
|
||||||
} while (in_baddynamic(candidate, so->so_proto->pr_protocol));
|
} while (in_baddynamic(candidate, so->so_proto->pr_protocol));
|
||||||
t = in_pcblookup_local(table, laddr, localport, wild,
|
t = in_pcblookup_local_lock(table, laddr, localport, wild,
|
||||||
inp->inp_rtableid);
|
inp->inp_rtableid, IN_PCBLOCK_HOLD);
|
||||||
} while (t != NULL);
|
} while (t != NULL);
|
||||||
*lport = localport;
|
*lport = localport;
|
||||||
|
|
||||||
@ -498,10 +527,13 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
t = in_pcblookup(inp->inp_table, sin->sin_addr, sin->sin_port,
|
/* keep lookup, modification, and rehash in sync */
|
||||||
ina, inp->inp_lport, inp->inp_rtableid);
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
|
||||||
|
t = in_pcblookup_lock(inp->inp_table, sin->sin_addr, sin->sin_port,
|
||||||
|
ina, inp->inp_lport, inp->inp_rtableid, IN_PCBLOCK_HOLD);
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
in_pcbunref(t);
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,15 +541,17 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
|
|
||||||
if (inp->inp_laddr.s_addr == INADDR_ANY) {
|
if (inp->inp_laddr.s_addr == INADDR_ANY) {
|
||||||
if (inp->inp_lport == 0) {
|
if (inp->inp_lport == 0) {
|
||||||
error = in_pcbbind(inp, NULL, curproc);
|
error = in_pcbbind_locked(inp, NULL, curproc);
|
||||||
if (error)
|
if (error) {
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (error);
|
return (error);
|
||||||
t = in_pcblookup(inp->inp_table, sin->sin_addr,
|
}
|
||||||
|
t = in_pcblookup_lock(inp->inp_table, sin->sin_addr,
|
||||||
sin->sin_port, ina, inp->inp_lport,
|
sin->sin_port, ina, inp->inp_lport,
|
||||||
inp->inp_rtableid);
|
inp->inp_rtableid, IN_PCBLOCK_HOLD);
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
inp->inp_lport = 0;
|
inp->inp_lport = 0;
|
||||||
in_pcbunref(t);
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -525,8 +559,8 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
}
|
}
|
||||||
inp->inp_faddr = sin->sin_addr;
|
inp->inp_faddr = sin->sin_addr;
|
||||||
inp->inp_fport = sin->sin_port;
|
inp->inp_fport = sin->sin_port;
|
||||||
mtx_enter(&table->inpt_mtx);
|
|
||||||
in_pcbrehash(inp);
|
in_pcbrehash(inp);
|
||||||
|
|
||||||
mtx_leave(&table->inpt_mtx);
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
|
||||||
#if NSTOEPLITZ > 0
|
#if NSTOEPLITZ > 0
|
||||||
@ -539,6 +573,11 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
void
|
void
|
||||||
in_pcbdisconnect(struct inpcb *inp)
|
in_pcbdisconnect(struct inpcb *inp)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* XXXSMP pf lock sleeps, so we cannot use table->inpt_mtx
|
||||||
|
* to keep inp_pf_sk in sync with pcb. Use net lock for now.
|
||||||
|
*/
|
||||||
|
NET_ASSERT_LOCKED_EXCLUSIVE();
|
||||||
#if NPF > 0
|
#if NPF > 0
|
||||||
if (inp->inp_pf_sk) {
|
if (inp->inp_pf_sk) {
|
||||||
pf_remove_divert_state(inp->inp_pf_sk);
|
pf_remove_divert_state(inp->inp_pf_sk);
|
||||||
@ -576,6 +615,12 @@ in_pcbdetach(struct inpcb *inp)
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
ip_freemoptions(inp->inp_moptions);
|
ip_freemoptions(inp->inp_moptions);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXXSMP pf lock sleeps, so we cannot use table->inpt_mtx
|
||||||
|
* to keep inp_pf_sk in sync with pcb. Use net lock for now.
|
||||||
|
*/
|
||||||
|
NET_ASSERT_LOCKED_EXCLUSIVE();
|
||||||
#if NPF > 0
|
#if NPF > 0
|
||||||
if (inp->inp_pf_sk) {
|
if (inp->inp_pf_sk) {
|
||||||
pf_remove_divert_state(inp->inp_pf_sk);
|
pf_remove_divert_state(inp->inp_pf_sk);
|
||||||
@ -791,8 +836,8 @@ in_rtchange(struct inpcb *inp, int errno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in_pcblookup_local(struct inpcbtable *table, const void *laddrp,
|
in_pcblookup_local_lock(struct inpcbtable *table, const void *laddrp,
|
||||||
u_int lport_arg, int flags, u_int rtable)
|
u_int lport_arg, int flags, u_int rtable, int lock)
|
||||||
{
|
{
|
||||||
struct inpcb *inp, *match = NULL;
|
struct inpcb *inp, *match = NULL;
|
||||||
int matchwild = 3, wildcard;
|
int matchwild = 3, wildcard;
|
||||||
@ -808,7 +853,12 @@ in_pcblookup_local(struct inpcbtable *table, const void *laddrp,
|
|||||||
rdomain = rtable_l2(rtable);
|
rdomain = rtable_l2(rtable);
|
||||||
lhash = in_pcblhash(table, rdomain, lport);
|
lhash = in_pcblhash(table, rdomain, lport);
|
||||||
|
|
||||||
mtx_enter(&table->inpt_mtx);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
} else {
|
||||||
|
KASSERT(lock == IN_PCBLOCK_HOLD);
|
||||||
|
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
||||||
|
}
|
||||||
head = &table->inpt_lhashtbl[lhash & table->inpt_lmask];
|
head = &table->inpt_lhashtbl[lhash & table->inpt_lmask];
|
||||||
LIST_FOREACH(inp, head, inp_lhash) {
|
LIST_FOREACH(inp, head, inp_lhash) {
|
||||||
if (rtable_l2(inp->inp_rtableid) != rdomain)
|
if (rtable_l2(inp->inp_rtableid) != rdomain)
|
||||||
@ -859,8 +909,10 @@ in_pcblookup_local(struct inpcbtable *table, const void *laddrp,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in_pcbref(match);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
mtx_leave(&table->inpt_mtx);
|
in_pcbref(match);
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
}
|
||||||
|
|
||||||
return (match);
|
return (match);
|
||||||
}
|
}
|
||||||
@ -1029,10 +1081,6 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin,
|
|||||||
void
|
void
|
||||||
in_pcbrehash(struct inpcb *inp)
|
in_pcbrehash(struct inpcb *inp)
|
||||||
{
|
{
|
||||||
struct inpcbtable *table = inp->inp_table;
|
|
||||||
|
|
||||||
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
|
||||||
|
|
||||||
LIST_REMOVE(inp, inp_lhash);
|
LIST_REMOVE(inp, inp_lhash);
|
||||||
LIST_REMOVE(inp, inp_hash);
|
LIST_REMOVE(inp, inp_hash);
|
||||||
in_pcbhash_insert(inp);
|
in_pcbhash_insert(inp);
|
||||||
@ -1154,8 +1202,8 @@ int in_pcbnotifymiss = 0;
|
|||||||
* After those two lookups no other are necessary.
|
* After those two lookups no other are necessary.
|
||||||
*/
|
*/
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in_pcblookup(struct inpcbtable *table, struct in_addr faddr,
|
in_pcblookup_lock(struct inpcbtable *table, struct in_addr faddr,
|
||||||
u_int fport, struct in_addr laddr, u_int lport, u_int rtable)
|
u_int fport, struct in_addr laddr, u_int lport, u_int rtable, int lock)
|
||||||
{
|
{
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
uint64_t hash;
|
uint64_t hash;
|
||||||
@ -1164,11 +1212,18 @@ in_pcblookup(struct inpcbtable *table, struct in_addr faddr,
|
|||||||
rdomain = rtable_l2(rtable);
|
rdomain = rtable_l2(rtable);
|
||||||
hash = in_pcbhash(table, rdomain, &faddr, fport, &laddr, lport);
|
hash = in_pcbhash(table, rdomain, &faddr, fport, &laddr, lport);
|
||||||
|
|
||||||
mtx_enter(&table->inpt_mtx);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
} else {
|
||||||
|
KASSERT(lock == IN_PCBLOCK_HOLD);
|
||||||
|
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
||||||
|
}
|
||||||
inp = in_pcbhash_lookup(table, hash, rdomain,
|
inp = in_pcbhash_lookup(table, hash, rdomain,
|
||||||
&faddr, fport, &laddr, lport);
|
&faddr, fport, &laddr, lport);
|
||||||
in_pcbref(inp);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
mtx_leave(&table->inpt_mtx);
|
in_pcbref(inp);
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
if (inp == NULL && in_pcbnotifymiss) {
|
if (inp == NULL && in_pcbnotifymiss) {
|
||||||
@ -1180,6 +1235,14 @@ in_pcblookup(struct inpcbtable *table, struct in_addr faddr,
|
|||||||
return (inp);
|
return (inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct inpcb *
|
||||||
|
in_pcblookup(struct inpcbtable *table, struct in_addr faddr,
|
||||||
|
u_int fport, struct in_addr laddr, u_int lport, u_int rtable)
|
||||||
|
{
|
||||||
|
return in_pcblookup_lock(table, faddr, fport, laddr, lport, rtable,
|
||||||
|
IN_PCBLOCK_GRAB);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The in(6)_pcblookup_listen functions are used to locate listening
|
* The in(6)_pcblookup_listen functions are used to locate listening
|
||||||
* sockets quickly. This are sockets with unspecified foreign address
|
* sockets quickly. This are sockets with unspecified foreign address
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: in_pcb.h,v 1.142 2023/12/03 20:24:17 bluhm Exp $ */
|
/* $OpenBSD: in_pcb.h,v 1.143 2023/12/07 16:08:30 bluhm Exp $ */
|
||||||
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -268,6 +268,9 @@ struct baddynamicports {
|
|||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
|
||||||
|
#define IN_PCBLOCK_HOLD 1
|
||||||
|
#define IN_PCBLOCK_GRAB 2
|
||||||
|
|
||||||
extern struct inpcbtable rawcbtable, rawin6pcbtable;
|
extern struct inpcbtable rawcbtable, rawin6pcbtable;
|
||||||
extern struct baddynamicports baddynamicports;
|
extern struct baddynamicports baddynamicports;
|
||||||
extern struct baddynamicports rootonlyports;
|
extern struct baddynamicports rootonlyports;
|
||||||
@ -276,6 +279,7 @@ extern int in_pcbnotifymiss;
|
|||||||
void in_init(void);
|
void in_init(void);
|
||||||
void in_losing(struct inpcb *);
|
void in_losing(struct inpcb *);
|
||||||
int in_pcballoc(struct socket *, struct inpcbtable *, int);
|
int in_pcballoc(struct socket *, struct inpcbtable *, int);
|
||||||
|
int in_pcbbind_locked(struct inpcb *, struct mbuf *, struct proc *);
|
||||||
int in_pcbbind(struct inpcb *, struct mbuf *, struct proc *);
|
int in_pcbbind(struct inpcb *, struct mbuf *, struct proc *);
|
||||||
int in_pcbaddrisavail(struct inpcb *, struct sockaddr_in *, int,
|
int in_pcbaddrisavail(struct inpcb *, struct sockaddr_in *, int,
|
||||||
struct proc *);
|
struct proc *);
|
||||||
@ -296,10 +300,12 @@ uint64_t in6_pcbhash(struct inpcbtable *, u_int, const struct in6_addr *,
|
|||||||
u_short, const struct in6_addr *, u_short);
|
u_short, const struct in6_addr *, u_short);
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in6_pcblookup(struct inpcbtable *, const struct in6_addr *,
|
in6_pcblookup(struct inpcbtable *, const struct in6_addr *,
|
||||||
u_int, const struct in6_addr *, u_int, u_int);
|
u_int, const struct in6_addr *, u_int, u_int);
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in6_pcblookup_listen(struct inpcbtable *, struct in6_addr *, u_int,
|
in6_pcblookup_listen(struct inpcbtable *, struct in6_addr *, u_int,
|
||||||
struct mbuf *, u_int);
|
struct mbuf *, u_int);
|
||||||
|
int in6_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in6 *, int,
|
||||||
|
struct proc *, int);
|
||||||
int in6_pcbaddrisavail(struct inpcb *, struct sockaddr_in6 *, int,
|
int in6_pcbaddrisavail(struct inpcb *, struct sockaddr_in6 *, int,
|
||||||
struct proc *);
|
struct proc *);
|
||||||
int in6_pcbconnect(struct inpcb *, struct mbuf *);
|
int in6_pcbconnect(struct inpcb *, struct mbuf *);
|
||||||
@ -310,8 +316,8 @@ int in6_peeraddr(struct socket *, struct mbuf *);
|
|||||||
#endif /* INET6 */
|
#endif /* INET6 */
|
||||||
void in_pcbinit(struct inpcbtable *, int);
|
void in_pcbinit(struct inpcbtable *, int);
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in_pcblookup_local(struct inpcbtable *, const void *, u_int, int,
|
in_pcblookup_local_lock(struct inpcbtable *, const void *, u_int, int,
|
||||||
u_int);
|
u_int, int);
|
||||||
void in_pcbnotifyall(struct inpcbtable *, struct sockaddr *,
|
void in_pcbnotifyall(struct inpcbtable *, struct sockaddr *,
|
||||||
u_int, int, void (*)(struct inpcb *, int));
|
u_int, int, void (*)(struct inpcb *, int));
|
||||||
void in_pcbrehash(struct inpcb *);
|
void in_pcbrehash(struct inpcb *);
|
||||||
@ -331,8 +337,6 @@ void in6_pcbnotify(struct inpcbtable *, struct sockaddr_in6 *,
|
|||||||
u_int, const struct sockaddr_in6 *, u_int, u_int, int, void *,
|
u_int, const struct sockaddr_in6 *, u_int, u_int, int, void *,
|
||||||
void (*)(struct inpcb *, int));
|
void (*)(struct inpcb *, int));
|
||||||
int in6_selecthlim(struct inpcb *);
|
int in6_selecthlim(struct inpcb *);
|
||||||
int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *,
|
|
||||||
struct proc *);
|
|
||||||
int in_pcbset_rtableid(struct inpcb *, u_int);
|
int in_pcbset_rtableid(struct inpcb *, u_int);
|
||||||
void in_pcbset_laddr(struct inpcb *, const struct sockaddr *, u_int);
|
void in_pcbset_laddr(struct inpcb *, const struct sockaddr *, u_int);
|
||||||
void in_pcbunset_faddr(struct inpcb *);
|
void in_pcbunset_faddr(struct inpcb *);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: in6_pcb.c,v 1.130 2023/12/03 20:36:24 bluhm Exp $ */
|
/* $OpenBSD: in6_pcb.c,v 1.131 2023/12/07 16:08:30 bluhm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||||
@ -129,6 +129,9 @@ const struct in6_addr zeroin6_addr;
|
|||||||
struct inpcb *in6_pcbhash_lookup(struct inpcbtable *, uint64_t, u_int,
|
struct inpcb *in6_pcbhash_lookup(struct inpcbtable *, uint64_t, u_int,
|
||||||
const struct in6_addr *, u_short, const struct in6_addr *, u_short);
|
const struct in6_addr *, u_short, const struct in6_addr *, u_short);
|
||||||
|
|
||||||
|
struct inpcb * in6_pcblookup_lock(struct inpcbtable *, const struct in6_addr *,
|
||||||
|
u_int, const struct in6_addr *, u_int, u_int, int);
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
in6_pcbhash(struct inpcbtable *table, u_int rdomain,
|
in6_pcbhash(struct inpcbtable *table, u_int rdomain,
|
||||||
const struct in6_addr *faddr, u_short fport,
|
const struct in6_addr *faddr, u_short fport,
|
||||||
@ -147,8 +150,8 @@ in6_pcbhash(struct inpcbtable *table, u_int rdomain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
in6_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
||||||
struct proc *p)
|
struct proc *p, int lock)
|
||||||
{
|
{
|
||||||
struct socket *so = inp->inp_socket;
|
struct socket *so = inp->inp_socket;
|
||||||
struct inpcbtable *table = inp->inp_table;
|
struct inpcbtable *table = inp->inp_table;
|
||||||
@ -214,26 +217,35 @@ in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (so->so_euid && !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
|
if (so->so_euid && !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
|
||||||
t = in_pcblookup_local(table, &sin6->sin6_addr, lport,
|
t = in_pcblookup_local_lock(table, &sin6->sin6_addr,
|
||||||
INPLOOKUP_WILDCARD | INPLOOKUP_IPV6,
|
lport, INPLOOKUP_WILDCARD | INPLOOKUP_IPV6,
|
||||||
inp->inp_rtableid);
|
inp->inp_rtableid, lock);
|
||||||
if (t && (so->so_euid != t->inp_socket->so_euid))
|
if (t && (so->so_euid != t->inp_socket->so_euid))
|
||||||
error = EADDRINUSE;
|
error = EADDRINUSE;
|
||||||
in_pcbunref(t);
|
if (lock == IN_PCBLOCK_GRAB)
|
||||||
|
in_pcbunref(t);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
t = in_pcblookup_local(table, &sin6->sin6_addr, lport,
|
t = in_pcblookup_local_lock(table, &sin6->sin6_addr, lport,
|
||||||
wild, inp->inp_rtableid);
|
wild, inp->inp_rtableid, lock);
|
||||||
if (t && (reuseport & t->inp_socket->so_options) == 0)
|
if (t && (reuseport & t->inp_socket->so_options) == 0)
|
||||||
error = EADDRINUSE;
|
error = EADDRINUSE;
|
||||||
in_pcbunref(t);
|
if (lock == IN_PCBLOCK_GRAB)
|
||||||
|
in_pcbunref(t);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
||||||
|
struct proc *p)
|
||||||
|
{
|
||||||
|
return in6_pcbaddrisavail_lock(inp, sin6, wild, p, IN_PCBLOCK_GRAB);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect from a socket to a specified address.
|
* Connect from a socket to a specified address.
|
||||||
* Both address and port must be specified in argument sin6.
|
* Both address and port must be specified in argument sin6.
|
||||||
@ -285,11 +297,15 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
|
|
||||||
inp->inp_ipv6.ip6_hlim = (u_int8_t)in6_selecthlim(inp);
|
inp->inp_ipv6.ip6_hlim = (u_int8_t)in6_selecthlim(inp);
|
||||||
|
|
||||||
t = in6_pcblookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port,
|
/* keep lookup, modification, and rehash in sync */
|
||||||
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
|
||||||
|
t = in6_pcblookup_lock(inp->inp_table, &sin6->sin6_addr,
|
||||||
|
sin6->sin6_port,
|
||||||
IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) ? in6a : &inp->inp_laddr6,
|
IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) ? in6a : &inp->inp_laddr6,
|
||||||
inp->inp_lport, inp->inp_rtableid);
|
inp->inp_lport, inp->inp_rtableid, IN_PCBLOCK_HOLD);
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
in_pcbunref(t);
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,15 +313,17 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
|
|
||||||
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6)) {
|
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6)) {
|
||||||
if (inp->inp_lport == 0) {
|
if (inp->inp_lport == 0) {
|
||||||
error = in_pcbbind(inp, NULL, curproc);
|
error = in_pcbbind_locked(inp, NULL, curproc);
|
||||||
if (error)
|
if (error) {
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (error);
|
return (error);
|
||||||
t = in6_pcblookup(inp->inp_table, &sin6->sin6_addr,
|
}
|
||||||
|
t = in6_pcblookup_lock(inp->inp_table, &sin6->sin6_addr,
|
||||||
sin6->sin6_port, in6a, inp->inp_lport,
|
sin6->sin6_port, in6a, inp->inp_lport,
|
||||||
inp->inp_rtableid);
|
inp->inp_rtableid, IN_PCBLOCK_HOLD);
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
inp->inp_lport = 0;
|
inp->inp_lport = 0;
|
||||||
in_pcbunref(t);
|
mtx_leave(&table->inpt_mtx);
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,8 +331,8 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||||||
}
|
}
|
||||||
inp->inp_faddr6 = sin6->sin6_addr;
|
inp->inp_faddr6 = sin6->sin6_addr;
|
||||||
inp->inp_fport = sin6->sin6_port;
|
inp->inp_fport = sin6->sin6_port;
|
||||||
mtx_enter(&table->inpt_mtx);
|
|
||||||
in_pcbrehash(inp);
|
in_pcbrehash(inp);
|
||||||
|
|
||||||
mtx_leave(&table->inpt_mtx);
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
|
||||||
inp->inp_flowinfo &= ~IPV6_FLOWLABEL_MASK;
|
inp->inp_flowinfo &= ~IPV6_FLOWLABEL_MASK;
|
||||||
@ -580,8 +598,9 @@ in6_pcbhash_lookup(struct inpcbtable *table, uint64_t hash, u_int rdomain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in6_pcblookup(struct inpcbtable *table, const struct in6_addr *faddr,
|
in6_pcblookup_lock(struct inpcbtable *table, const struct in6_addr *faddr,
|
||||||
u_int fport, const struct in6_addr *laddr, u_int lport, u_int rtable)
|
u_int fport, const struct in6_addr *laddr, u_int lport, u_int rtable,
|
||||||
|
int lock)
|
||||||
{
|
{
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
uint64_t hash;
|
uint64_t hash;
|
||||||
@ -590,11 +609,18 @@ in6_pcblookup(struct inpcbtable *table, const struct in6_addr *faddr,
|
|||||||
rdomain = rtable_l2(rtable);
|
rdomain = rtable_l2(rtable);
|
||||||
hash = in6_pcbhash(table, rdomain, faddr, fport, laddr, lport);
|
hash = in6_pcbhash(table, rdomain, faddr, fport, laddr, lport);
|
||||||
|
|
||||||
mtx_enter(&table->inpt_mtx);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
|
mtx_enter(&table->inpt_mtx);
|
||||||
|
} else {
|
||||||
|
KASSERT(lock == IN_PCBLOCK_HOLD);
|
||||||
|
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
||||||
|
}
|
||||||
inp = in6_pcbhash_lookup(table, hash, rdomain,
|
inp = in6_pcbhash_lookup(table, hash, rdomain,
|
||||||
faddr, fport, laddr, lport);
|
faddr, fport, laddr, lport);
|
||||||
in_pcbref(inp);
|
if (lock == IN_PCBLOCK_GRAB) {
|
||||||
mtx_leave(&table->inpt_mtx);
|
in_pcbref(inp);
|
||||||
|
mtx_leave(&table->inpt_mtx);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
if (inp == NULL && in_pcbnotifymiss) {
|
if (inp == NULL && in_pcbnotifymiss) {
|
||||||
@ -605,6 +631,14 @@ in6_pcblookup(struct inpcbtable *table, const struct in6_addr *faddr,
|
|||||||
return (inp);
|
return (inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct inpcb *
|
||||||
|
in6_pcblookup(struct inpcbtable *table, const struct in6_addr *faddr,
|
||||||
|
u_int fport, const struct in6_addr *laddr, u_int lport, u_int rtable)
|
||||||
|
{
|
||||||
|
return in6_pcblookup_lock(table, faddr, fport, laddr, lport, rtable,
|
||||||
|
IN_PCBLOCK_GRAB);
|
||||||
|
}
|
||||||
|
|
||||||
struct inpcb *
|
struct inpcb *
|
||||||
in6_pcblookup_listen(struct inpcbtable *table, struct in6_addr *laddr,
|
in6_pcblookup_listen(struct inpcbtable *table, struct in6_addr *laddr,
|
||||||
u_int lport, struct mbuf *m, u_int rtable)
|
u_int lport, struct mbuf *m, u_int rtable)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* $OpenBSD: syscall.h,v 1.266 2023/11/29 20:46:24 bluhm Exp $ */
|
/* $OpenBSD: syscall.h,v 1.267 2023/12/07 14:00:15 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call numbers.
|
* System call numbers.
|
||||||
*
|
*
|
||||||
* DO NOT EDIT-- this file is automatically generated.
|
* DO NOT EDIT-- this file is automatically generated.
|
||||||
* created from; OpenBSD: syscalls.master,v 1.251 2023/11/29 20:40:06 bluhm Exp
|
* created from; OpenBSD: syscalls.master,v 1.252 2023/12/07 13:59:04 deraadt Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* syscall: "syscall" ret: "int" args: "int" "..." */
|
/* syscall: "syscall" ret: "int" args: "int" "..." */
|
||||||
@ -446,7 +446,9 @@
|
|||||||
|
|
||||||
/* 156 is obsolete ogetdirentries */
|
/* 156 is obsolete ogetdirentries */
|
||||||
/* 157 is obsolete statfs25 */
|
/* 157 is obsolete statfs25 */
|
||||||
/* 158 is obsolete fstatfs25 */
|
/* syscall: "pinsyscalls" ret: "int" args: "void *" "size_t" "void *" "size_t" */
|
||||||
|
#define SYS_pinsyscalls 158
|
||||||
|
|
||||||
/* syscall: "mimmutable" ret: "int" args: "void *" "size_t" */
|
/* syscall: "mimmutable" ret: "int" args: "void *" "size_t" */
|
||||||
#define SYS_mimmutable 159
|
#define SYS_mimmutable 159
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* $OpenBSD: syscallargs.h,v 1.269 2023/11/29 20:46:24 bluhm Exp $ */
|
/* $OpenBSD: syscallargs.h,v 1.270 2023/12/07 14:00:15 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System call argument lists.
|
* System call argument lists.
|
||||||
*
|
*
|
||||||
* DO NOT EDIT-- this file is automatically generated.
|
* DO NOT EDIT-- this file is automatically generated.
|
||||||
* created from; OpenBSD: syscalls.master,v 1.251 2023/11/29 20:40:06 bluhm Exp
|
* created from; OpenBSD: syscalls.master,v 1.252 2023/12/07 13:59:04 deraadt Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef syscallarg
|
#ifdef syscallarg
|
||||||
@ -750,6 +750,13 @@ struct sys_nfssvc_args {
|
|||||||
syscallarg(void *) argp;
|
syscallarg(void *) argp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct sys_pinsyscalls_args {
|
||||||
|
syscallarg(void *) base;
|
||||||
|
syscallarg(size_t) len;
|
||||||
|
syscallarg(void *) pins;
|
||||||
|
syscallarg(size_t) pinslen;
|
||||||
|
};
|
||||||
|
|
||||||
struct sys_mimmutable_args {
|
struct sys_mimmutable_args {
|
||||||
syscallarg(void *) addr;
|
syscallarg(void *) addr;
|
||||||
syscallarg(size_t) len;
|
syscallarg(size_t) len;
|
||||||
@ -1310,6 +1317,7 @@ int sys_ypconnect(struct proc *, void *, register_t *);
|
|||||||
int sys_nfssvc(struct proc *, void *, register_t *);
|
int sys_nfssvc(struct proc *, void *, register_t *);
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
int sys_pinsyscalls(struct proc *, void *, register_t *);
|
||||||
int sys_mimmutable(struct proc *, void *, register_t *);
|
int sys_mimmutable(struct proc *, void *, register_t *);
|
||||||
int sys_waitid(struct proc *, void *, register_t *);
|
int sys_waitid(struct proc *, void *, register_t *);
|
||||||
int sys_getfh(struct proc *, void *, register_t *);
|
int sys_getfh(struct proc *, void *, register_t *);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: uvm_mmap.c,v 1.182 2023/05/09 10:35:20 kn Exp $ */
|
/* $OpenBSD: uvm_mmap.c,v 1.183 2023/12/07 13:59:05 deraadt Exp $ */
|
||||||
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
|
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -644,6 +644,16 @@ sys_pinsyscall(struct proc *p, void *v, register_t *retval)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* sys_pinsyscalls
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
sys_pinsyscalls(struct proc *p, void *v, register_t *retval)
|
||||||
|
{
|
||||||
|
/* STUB until other parts are ready */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sys_mimmutable: the mimmutable system call
|
* sys_mimmutable: the mimmutable system call
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: log.c,v 1.60 2021/09/16 15:11:19 djm Exp $ */
|
/* $OpenBSD: log.c,v 1.61 2023/12/06 21:06:48 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -427,6 +427,10 @@ sshlogv(const char *file, const char *func, int line, int showfunc,
|
|||||||
const char *cp;
|
const char *cp;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
/* short circuit processing early if we're not going to log anything */
|
||||||
|
if (nlog_verbose == 0 && level > log_level)
|
||||||
|
return;
|
||||||
|
|
||||||
snprintf(tag, sizeof(tag), "%.48s:%.48s():%d (pid=%ld)",
|
snprintf(tag, sizeof(tag), "%.48s:%.48s():%d (pid=%ld)",
|
||||||
(cp = strrchr(file, '/')) == NULL ? file : cp + 1, func, line,
|
(cp = strrchr(file, '/')) == NULL ? file : cp + 1, func, line,
|
||||||
(long)getpid());
|
(long)getpid());
|
||||||
|
Loading…
Reference in New Issue
Block a user