sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-20 16:39:32 +00:00
parent eb9d621948
commit f36b410006
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
37 changed files with 350 additions and 317 deletions

View File

@ -1,76 +0,0 @@
#!/bin/sh -
# $OpenBSD: mkscripts.sh,v 1.2 1996/06/23 14:20:08 deraadt Exp $
# $NetBSD: mkscripts.sh,v 1.10 1995/04/23 10:07:36 cgd Exp $
#
# This script generates ed test scripts (.ed) from .t files
PATH="/bin:/usr/bin:/usr/local/bin/:."
ED=$1
[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
for i in *.t; do
# base=${i%.*}
# base=`echo $i | sed 's/\..*//'`
# base=`expr $i : '\([^.]*\)'`
# (
# echo "#!/bin/sh -"
# echo "$ED - <<\EOT"
# echo "r $base.d"
# cat $i
# echo "w $base.o"
# echo EOT
# ) >$base.ed
# chmod +x $base.ed
# The following is pretty ugly way of doing the above, and not appropriate
# use of ed but the point is that it can be done...
base=`$ED - \!"echo $i" <<-EOF
s/\..*
EOF`
$ED - <<-EOF
a
#!/bin/sh -
$ED - <<\EOT
H
r $base.d
w $base.o
EOT
.
-2r $i
w $base.ed
!chmod +x $base.ed
EOF
done
for i in *.err; do
# base=${i%.*}
# base=`echo $i | sed 's/\..*//'`
# base=`expr $i : '\([^.]*\)'`
# (
# echo "#!/bin/sh -"
# echo "$ED - <<\EOT"
# echo H
# echo "r $base.err"
# cat $i
# echo "w $base.o"
# echo EOT
# ) >$base-err.ed
# chmod +x $base-err.ed
# The following is pretty ugly way of doing the above, and not appropriate
# use of ed but the point is that it can be done...
base=`$ED - \!"echo $i" <<-EOF
s/\..*
EOF`
$ED - <<-EOF
a
#!/bin/sh -
$ED - <<\EOT
H
r $base.err
w $base.o
EOT
.
-2r $i
w ${base}.red
!chmod +x ${base}.red
EOF
done

View File

@ -1 +1 @@
# SecBSD 1.6-0217120: Thu Aug 8 00:00:00 UTC 2024 (Yatagarasu)
# SecBSD 1.6-68b5a75: Tue Aug 20 00:00:00 UTC 2024 (Yatagarasu)

View File

@ -1,76 +1,92 @@
# $OpenBSD: rekey.sh,v 1.20 2024/05/22 04:20:00 djm Exp $
# $OpenBSD: rekey.sh,v 1.26 2024/08/20 12:36:59 dtucker Exp $
# Placed in the Public Domain.
tid="rekey"
LOG=${TEST_SSH_LOGFILE}
COPY2=$OBJ/copy2
rm -f ${LOG}
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
echo "Compression no" >> $OBJ/ssh_proxy
echo "RekeyLimit 256k" >> $OBJ/ssh_proxy
# Test rekeying based on data volume only.
# Arguments will be passed to ssh.
# Arguments: rekeylimit, kex method, optional remaining opts are passed to ssh.
ssh_data_rekeying()
{
_bytes=$1 ; shift
_kexopt=$1 ; shift
_opts="$@"
if test -z "$_bytes"; then
_bytes=32k
fi
if ! test -z "$_kexopt" ; then
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "$_kexopt" >> $OBJ/sshd_proxy
_opts="$_opts -o$_kexopt"
fi
rm -f ${COPY} ${LOG}
_opts="$_opts -oCompression=no"
${SSH} <${DATA} $_opts -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
trace bytes $_bytes kex $_kexopt opts $_opts
rm -f ${COPY} ${COPY2} ${LOG}
# Create data file just big enough to reach rekey threshold.
dd if=${DATA} of=${COPY} bs=$_bytes count=1 2>/dev/null
${SSH} <${COPY} $_opts -v \
-oRekeyLimit=$_bytes -F $OBJ/ssh_proxy somehost "cat >${COPY2}"
if [ $? -ne 0 ]; then
fail "ssh failed ($@)"
fi
cmp ${DATA} ${COPY} || fail "corrupted copy ($@)"
cmp ${COPY} ${COPY2} || fail "corrupted copy ($@)"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1`
trace "$n rekeying(s)"
if [ $n -lt 1 ]; then
fail "no rekeying occurred ($@)"
fi
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
}
increase_datafile_size 300
opts=""
for i in `${SSH} -Q kex`; do
# Filter out duplicate curve algo
kexs=`${SSH} -Q kex | grep -v curve25519-sha256@libssh.org`
ciphers=`${SSH} -Q cipher`
macs=`${SSH} -Q mac`
for i in $kexs; do
opts="$opts KexAlgorithms=$i"
done
for i in `${SSH} -Q cipher`; do
for i in $ciphers; do
opts="$opts Ciphers=$i"
done
for i in `${SSH} -Q mac`; do
for i in $macs; do
opts="$opts MACs=$i"
done
for opt in $opts; do
verbose "client rekey $opt"
ssh_data_rekeying "$opt" -oRekeyLimit=256k
if ${SSH} -Q cipher-auth | sed 's/^/Ciphers=/' | \
grep $opt >/dev/null; then
trace AEAD cipher, testing all KexAlgorithms
for kex in $kexs; do
ssh_data_rekeying "" "KexAlgorithms=$kex" "-o$opt"
done
else
ssh_data_rekeying "" "$opt"
fi
done
# AEAD ciphers are magical so test with all KexAlgorithms
if ${SSH} -Q cipher-auth | grep '^.*$' >/dev/null 2>&1 ; then
for c in `${SSH} -Q cipher-auth`; do
for kex in `${SSH} -Q kex`; do
verbose "client rekey $c $kex"
ssh_data_rekeying "KexAlgorithms=$kex" -oRekeyLimit=256k -oCiphers=$c
done
done
fi
for s in 16 1k 128k 256k; do
verbose "client rekeylimit ${s}"
ssh_data_rekeying "" -oCompression=no -oRekeyLimit=$s
ssh_data_rekeying "$s" ""
done
for s in 5 10; do
verbose "client rekeylimit default ${s}"
rm -f ${COPY} ${LOG}
${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \
${SSH} < ${DATA} -oRekeyLimit="default $s" -F \
$OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 10"
if [ $? -ne 0 ]; then
fail "ssh failed"
@ -87,7 +103,7 @@ done
for s in 5 10; do
verbose "client rekeylimit default ${s} no data"
rm -f ${COPY} ${LOG}
${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
${SSH} -oRekeyLimit="default $s" -F \
$OBJ/ssh_proxy somehost "sleep $s;sleep 10"
if [ $? -ne 0 ]; then
fail "ssh failed"
@ -104,13 +120,13 @@ for s in 16 1k 128k 256k; do
verbose "server rekeylimit ${s}"
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "rekeylimit ${s}" >>$OBJ/sshd_proxy
rm -f ${COPY} ${LOG}
${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "cat ${DATA}" \
> ${COPY}
rm -f ${COPY} ${COPY2} ${LOG}
dd if=${DATA} of=${COPY} bs=$s count=1 2>/dev/null
${SSH} -F $OBJ/ssh_proxy somehost "cat ${COPY}" >${COPY2}
if [ $? -ne 0 ]; then
fail "ssh failed"
fi
cmp ${DATA} ${COPY} || fail "corrupted copy"
cmp ${COPY} ${COPY2} || fail "corrupted copy"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1`
trace "$n rekeying(s)"
@ -124,7 +140,7 @@ for s in 5 10; do
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "rekeylimit default ${s}" >>$OBJ/sshd_proxy
rm -f ${COPY} ${LOG}
${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 10"
${SSH} -F $OBJ/ssh_proxy somehost "sleep $s;sleep 10"
if [ $? -ne 0 ]; then
fail "ssh failed"
fi
@ -136,9 +152,8 @@ for s in 5 10; do
fi
done
verbose "rekeylimit parsing"
verbose "rekeylimit parsing: bytes"
for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do
case $size in
16) bytes=16 ;;
1k|1K) bytes=1024 ;;
@ -147,6 +162,15 @@ for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
4g|4G) bytes=4294967296 ;;
8g|8G) bytes=8589934592 ;;
esac
b=`${SSH} -G -o "rekeylimit $size" -f $OBJ/ssh_proxy host | \
awk '/rekeylimit/{print $2}'`
if [ "$bytes" != "$b" ]; then
fatal "rekeylimit size: expected $bytes bytes got $b"
fi
done
verbose "rekeylimit parsing: time"
for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do
case $time in
1) seconds=1 ;;
1m|1M) seconds=60 ;;
@ -154,19 +178,11 @@ for size in 16 1k 1K 1m 1M 1g 1G 4G 8G; do
1d|1D) seconds=86400 ;;
1w|1W) seconds=604800 ;;
esac
b=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
awk '/rekeylimit/{print $2}'`
s=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
s=`${SSH} -G -o "rekeylimit default $time" -f $OBJ/ssh_proxy host | \
awk '/rekeylimit/{print $3}'`
if [ "$bytes" != "$b" ]; then
fatal "rekeylimit size: expected $bytes bytes got $b"
fi
if [ "$seconds" != "$s" ]; then
fatal "rekeylimit time: expected $time seconds got $s"
fi
done
done
rm -f ${COPY} ${DATA}
rm -f ${COPY} ${COPY2} ${DATA}

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sti.4,v 1.26 2024/08/17 08:41:25 miod Exp $
.\" $OpenBSD: sti.4,v 1.27 2024/08/20 05:52:04 jsg Exp $
.\"
.\" Copyright (c) 2001 Michael Shalayeff
.\" All rights reserved.
@ -24,7 +24,7 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: August 17 2024 $
.Dd $Mdocdate: August 20 2024 $
.Dt STI 4
.Os
.Sh NAME
@ -239,7 +239,7 @@ EPROM map mode, implemented on
.Nm Visualize EG .
.It 8.11
Support for HP-UX non-implicit locking DMA, implemented on
.Nm Visualize FXE .
.Nm Visualize FXe .
.It 8.12
.Nm sti_util
function added (flashing under HP-UX and other sideband traffic).

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bus_dma.c,v 1.53 2024/08/18 21:04:29 bluhm Exp $ */
/* $OpenBSD: bus_dma.c,v 1.55 2024/08/20 12:36:09 sf Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@ -102,7 +102,7 @@
#endif
int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
struct proc *, int, paddr_t *, int *, int);
struct proc *, int, paddr_t *, int *, int *, int);
/*
* Common function for DMA map creation. May be called by bus-specific
@ -223,12 +223,18 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
size_t mapsize;
struct vm_page **pg;
struct pglist mlist;
int use_bounce_buffer = cpu_sev_guestmode || FORCE_BOUNCE_BUFFER;
if (map->_dm_pgva) {
km_free((void *)map->_dm_pgva, map->_dm_npages << PGSHIFT,
&kv_any, &kp_none);
}
mapsize = sizeof(struct bus_dmamap) +
(sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
if (use_bounce_buffer)
mapsize += sizeof(struct vm_page *) * map->_dm_npages;
if (map->_dm_pages) {
TAILQ_INIT(&mlist);
for (pg = map->_dm_pages; map->_dm_npages--; pg++) {
@ -237,8 +243,6 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
uvm_pglistfree(&mlist);
}
mapsize = sizeof(struct bus_dmamap) +
(sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
free(map, M_DEVBUF, mapsize);
}
@ -251,7 +255,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
bus_size_t buflen, struct proc *p, int flags)
{
bus_addr_t lastaddr = 0;
int seg, error;
int seg, used, error;
/*
* Make sure that on error condition we return "no valid mappings".
@ -263,11 +267,13 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
return (EINVAL);
seg = 0;
used = 0;
error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
&lastaddr, &seg, 1);
&lastaddr, &seg, &used, 1);
if (error == 0) {
map->dm_mapsize = buflen;
map->dm_nsegs = seg + 1;
map->_dm_nused = used;
}
return (error);
}
@ -280,7 +286,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
int flags)
{
paddr_t lastaddr = 0;
int seg, error, first;
int seg, used, error, first;
struct mbuf *m;
/*
@ -299,17 +305,19 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
first = 1;
seg = 0;
used = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
if (m->m_len == 0)
continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
NULL, flags, &lastaddr, &seg, &used, first);
first = 0;
}
if (error == 0) {
map->dm_mapsize = m0->m_pkthdr.len;
map->dm_nsegs = seg + 1;
map->_dm_nused = used;
}
return (error);
}
@ -322,7 +330,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
int flags)
{
paddr_t lastaddr = 0;
int seg, i, error, first;
int seg, used, i, error, first;
bus_size_t minlen, resid;
struct proc *p = NULL;
struct iovec *iov;
@ -347,6 +355,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
first = 1;
seg = 0;
used = 0;
error = 0;
for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
/*
@ -357,7 +366,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
addr = (caddr_t)iov[i].iov_base;
error = _bus_dmamap_load_buffer(t, map, addr, minlen,
p, flags, &lastaddr, &seg, first);
p, flags, &lastaddr, &seg, &used, first);
first = 0;
resid -= minlen;
@ -365,6 +374,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
if (error == 0) {
map->dm_mapsize = uio->uio_resid;
map->dm_nsegs = seg + 1;
map->_dm_nused = used;
}
return (error);
}
@ -683,8 +693,8 @@ _bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
*/
int
_bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
bus_size_t buflen, struct proc *p, int flags, paddr_t *lastaddrp, int *segp,
int first)
bus_size_t buflen, struct proc *p, int flags, paddr_t *lastaddrp,
int *segp, int *usedp, int first)
{
bus_size_t sgsize;
bus_addr_t curaddr, lastaddr, baddr, bmask;
@ -699,6 +709,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
else
pmap = pmap_kernel();
page = *usedp;
lastaddr = *lastaddrp;
bmask = ~(map->_dm_boundary - 1);
@ -714,14 +725,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
curaddr);
if (use_bounce_buffer) {
if (map->_dm_nused + 1 >= map->_dm_npages)
if (page >= map->_dm_npages)
return (ENOMEM);
off = vaddr & PAGE_MASK;
pg = map->_dm_pages[page = map->_dm_nused++];
pg = map->_dm_pages[page];
curaddr = VM_PAGE_TO_PHYS(pg) + off;
pgva = map->_dm_pgva + (page << PGSHIFT) + off;
page++;
}
/*
@ -774,6 +785,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
}
*segp = seg;
*usedp = page;
*lastaddrp = lastaddr;
/*

View File

@ -1,4 +1,4 @@
/* $OpenBSD: param.c,v 1.50 2024/05/05 06:14:37 jsg Exp $ */
/* $OpenBSD: param.c,v 1.52 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
/*
@ -49,6 +49,11 @@
#include <sys/sem.h>
#endif
/*
* Locks used to protect data:
* a atomic
*/
/*
* System parameter formulae.
*
@ -67,9 +72,9 @@ int utc_offset = 0;
#define NTEXT (80 + NPROCESS / 8) /* actually the object cache */
#define NVNODE (NPROCESS * 2 + NTEXT + 100)
int initialvnodes = NVNODE;
int maxprocess = NPROCESS;
int maxthread = 2 * NPROCESS;
int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80;
int maxprocess = NPROCESS; /* [a] */
int maxthread = 2 * NPROCESS; /* [a] */
int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; /* [a] */
long nmbclust = NMBCLUSTERS;
#ifndef BUFCACHEPERCENT

View File

@ -1,4 +1,4 @@
/* $OpenBSD: audio.c,v 1.207 2024/06/07 08:48:10 jsg Exp $ */
/* $OpenBSD: audio.c,v 1.208 2024/08/20 07:44:36 mvs Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
@ -27,11 +27,17 @@
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/audioio.h>
#include <sys/atomic.h>
#include <dev/audio_if.h>
#include <dev/mulaw.h>
#include "audio.h"
#include "wskbd.h"
/*
* Locks used to protect data:
* a atomic
*/
#ifdef AUDIO_DEBUG
#define DPRINTF(...) \
do { \
@ -225,7 +231,7 @@ struct mutex audio_lock = MUTEX_INITIALIZER(IPL_AUDIO);
* Global flag to control if audio recording is enabled when the
* mixerctl setting is record.enable=sysctl
*/
int audio_record_enable = 0;
int audio_record_enable = 0; /* [a] */
#ifdef AUDIO_DEBUG
/*
@ -590,7 +596,7 @@ audio_rintr(void *addr)
sc->rec.pos += sc->rec.blksz;
if ((sc->record_enable == MIXER_RECORD_ENABLE_SYSCTL &&
!audio_record_enable) ||
atomic_load_int(&audio_record_enable) == 0) ||
sc->record_enable == MIXER_RECORD_ENABLE_OFF) {
ptr = audio_buf_wgetblk(&sc->rec, &count);
audio_fill_sil(sc, ptr, sc->rec.blksz);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: virtio_mmio.c,v 1.13 2024/05/17 16:37:10 sf Exp $ */
/* $OpenBSD: virtio_mmio.c,v 1.14 2024/08/20 07:04:29 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
@ -271,16 +271,16 @@ virtio_mmio_attach(struct device *parent, struct device *self, void *aux)
id = bus_space_read_4(sc->sc_iot, sc->sc_ioh, VIRTIO_MMIO_DEVICE_ID);
printf(": Virtio %s Device", virtio_device_string(id));
if (sc->sc_version == 1)
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
VIRTIO_MMIO_GUEST_PAGE_SIZE, PAGE_SIZE);
printf("\n");
/* No device connected. */
if (id == 0)
return;
if (sc->sc_version == 1)
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
VIRTIO_MMIO_GUEST_PAGE_SIZE, PAGE_SIZE);
vsc->sc_ops = &virtio_mmio_ops;
vsc->sc_dmat = sc->sc_dmat;
sc->sc_config_offset = VIRTIO_MMIO_CONFIG;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ufshci.c,v 1.39 2024/06/27 21:35:34 mglocker Exp $ */
/* $OpenBSD: ufshci.c,v 1.40 2024/08/20 05:36:38 jsg Exp $ */
/*
* Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org>
@ -347,7 +347,7 @@ ufshci_dmamem_alloc(struct ufshci_softc *sc, size_t size)
if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,
BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW |
(sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0,
((sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0),
&udm->udm_map) != 0)
goto udmfree;
@ -1428,7 +1428,7 @@ ufshci_ccb_alloc(struct ufshci_softc *sc, int nccbs)
if (bus_dmamap_create(sc->sc_dmat, UFSHCI_UCD_PRDT_MAX_XFER,
UFSHCI_UCD_PRDT_MAX_SEGS, UFSHCI_UCD_PRDT_MAX_XFER, 0,
BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW |
(sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0,
((sc->sc_cap & UFSHCI_REG_CAP_64AS) ? BUS_DMA_64BIT : 0),
&ccb->ccb_dmamap) != 0)
goto free_maps;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_rge.c,v 1.29 2024/08/12 06:47:11 dlg Exp $ */
/* $OpenBSD: if_rge.c,v 1.30 2024/08/20 00:09:12 dlg Exp $ */
/*
* Copyright (c) 2019, 2020, 2023, 2024
@ -65,7 +65,6 @@ int rge_match(struct device *, void *, void *);
void rge_attach(struct device *, struct device *, void *);
int rge_activate(struct device *, int);
int rge_intr(void *);
int rge_encap(struct rge_queues *, struct mbuf *, int);
int rge_ioctl(struct ifnet *, u_long, caddr_t);
void rge_start(struct ifqueue *);
void rge_watchdog(struct ifnet *);
@ -413,29 +412,27 @@ rge_intr(void *arg)
return (claimed);
}
int
rge_encap(struct rge_queues *q, struct mbuf *m, int idx)
static inline void
rge_tx_list_sync(struct rge_softc *sc, struct rge_queues *q,
unsigned int idx, unsigned int len, int ops)
{
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc), len * sizeof(struct rge_tx_desc),
ops);
}
static int
rge_encap(struct ifnet *ifp, struct rge_queues *q, struct mbuf *m, int idx)
{
struct rge_softc *sc = q->q_sc;
struct rge_tx_desc *d = NULL;
struct rge_txq *txq;
bus_dmamap_t txmap;
uint32_t cmdsts, cflags = 0;
int cur, error, i, last, nsegs;
/*
* Set RGE_TDEXTSTS_IPCSUM if any checksum offloading is requested.
* Otherwise, RGE_TDEXTSTS_TCPCSUM / RGE_TDEXTSTS_UDPCSUM does not
* take affect.
*/
if ((m->m_pkthdr.csum_flags &
(M_IPV4_CSUM_OUT | M_TCP_CSUM_OUT | M_UDP_CSUM_OUT)) != 0) {
cflags |= RGE_TDEXTSTS_IPCSUM;
if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_TCPCSUM;
if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_UDPCSUM;
}
int cur, error, i;
#if NBPFILTER > 0
caddr_t if_bpf;
#endif
txq = &q->q_tx.rge_txq[idx];
txmap = txq->txq_dmamap;
@ -455,10 +452,28 @@ rge_encap(struct rge_queues *q, struct mbuf *m, int idx)
return (0);
}
#if NBPFILTER > 0
if_bpf = READ_ONCE(ifp->if_bpf);
if (if_bpf)
bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_OUT);
#endif
bus_dmamap_sync(sc->sc_dmat, txmap, 0, txmap->dm_mapsize,
BUS_DMASYNC_PREWRITE);
nsegs = txmap->dm_nsegs;
/*
* Set RGE_TDEXTSTS_IPCSUM if any checksum offloading is requested.
* Otherwise, RGE_TDEXTSTS_TCPCSUM / RGE_TDEXTSTS_UDPCSUM does not
* take affect.
*/
if ((m->m_pkthdr.csum_flags &
(M_IPV4_CSUM_OUT | M_TCP_CSUM_OUT | M_UDP_CSUM_OUT)) != 0) {
cflags |= RGE_TDEXTSTS_IPCSUM;
if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_TCPCSUM;
if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT)
cflags |= RGE_TDEXTSTS_UDPCSUM;
}
/* Set up hardware VLAN tagging. */
#if NVLAN > 0
@ -467,47 +482,57 @@ rge_encap(struct rge_queues *q, struct mbuf *m, int idx)
#endif
cur = idx;
cmdsts = RGE_TDCMDSTS_SOF;
for (i = 0; i < txmap->dm_nsegs; i++) {
d = &q->q_tx.rge_tx_list[cur];
d->rge_extsts = htole32(cflags);
d->rge_addrlo = htole32(RGE_ADDR_LO(txmap->dm_segs[i].ds_addr));
d->rge_addrhi = htole32(RGE_ADDR_HI(txmap->dm_segs[i].ds_addr));
for (i = 1; i < txmap->dm_nsegs; i++) {
cur = RGE_NEXT_TX_DESC(cur);
cmdsts = RGE_TDCMDSTS_OWN;
cmdsts |= txmap->dm_segs[i].ds_len;
if (cur == RGE_TX_LIST_CNT - 1)
cmdsts |= RGE_TDCMDSTS_EOR;
if (i == (txmap->dm_nsegs - 1))
if (i == txmap->dm_nsegs - 1)
cmdsts |= RGE_TDCMDSTS_EOF;
d = &q->q_tx.rge_tx_list[cur];
d->rge_cmdsts = htole32(cmdsts);
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
cur * sizeof(struct rge_tx_desc), sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
last = cur;
cmdsts = RGE_TDCMDSTS_OWN;
cur = RGE_NEXT_TX_DESC(cur);
d->rge_extsts = htole32(cflags);
d->rge_addr = htole64(txmap->dm_segs[i].ds_addr);
}
/* Transfer ownership of packet to the chip. */
d = &q->q_tx.rge_tx_list[idx];
d->rge_cmdsts |= htole32(RGE_TDCMDSTS_OWN);
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc), sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/* Update info of TX queue and descriptors. */
txq->txq_mbuf = m;
txq->txq_descidx = last;
txq->txq_descidx = cur;
return (nsegs);
cmdsts = RGE_TDCMDSTS_SOF;
cmdsts |= txmap->dm_segs[0].ds_len;
if (idx == RGE_TX_LIST_CNT - 1)
cmdsts |= RGE_TDCMDSTS_EOR;
if (txmap->dm_nsegs == 1)
cmdsts |= RGE_TDCMDSTS_EOF;
d = &q->q_tx.rge_tx_list[idx];
d->rge_cmdsts = htole32(cmdsts);
d->rge_extsts = htole32(cflags);
d->rge_addr = htole64(txmap->dm_segs[0].ds_addr);
if (cur >= idx) {
rge_tx_list_sync(sc, q, idx, txmap->dm_nsegs,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
} else {
rge_tx_list_sync(sc, q, idx, RGE_TX_LIST_CNT - idx,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
rge_tx_list_sync(sc, q, 0, cur + 1,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
}
/* Transfer ownership of packet to the chip. */
cmdsts |= RGE_TDCMDSTS_OWN;
rge_tx_list_sync(sc, q, idx, 1, BUS_DMASYNC_POSTWRITE);
d->rge_cmdsts = htole32(cmdsts);
rge_tx_list_sync(sc, q, idx, 1, BUS_DMASYNC_PREWRITE);
return (txmap->dm_nsegs);
}
int
@ -590,20 +615,15 @@ rge_start(struct ifqueue *ifq)
if (m == NULL)
break;
used = rge_encap(q, m, idx);
used = rge_encap(ifp, q, m, idx);
if (used == 0) {
m_freem(m);
continue;
}
KASSERT(used <= free);
KASSERT(used < free);
free -= used;
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
idx += used;
if (idx >= RGE_TX_LIST_CNT)
idx -= RGE_TX_LIST_CNT;
@ -1357,24 +1377,21 @@ rge_txeof(struct rge_queues *q)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct rge_txq *txq;
uint32_t txstat;
int cons, idx, prod;
int cons, prod, cur, idx;
int free = 0;
prod = q->q_tx.rge_txq_prodidx;
cons = q->q_tx.rge_txq_considx;
while (prod != cons) {
txq = &q->q_tx.rge_txq[cons];
idx = txq->txq_descidx;
idx = cons;
while (idx != prod) {
txq = &q->q_tx.rge_txq[idx];
cur = txq->txq_descidx;
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc),
sizeof(struct rge_tx_desc),
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
txstat = letoh32(q->q_tx.rge_tx_list[idx].rge_cmdsts);
if (txstat & RGE_TDCMDSTS_OWN) {
rge_tx_list_sync(sc, q, cur, 1, BUS_DMASYNC_POSTREAD);
txstat = q->q_tx.rge_tx_list[cur].rge_cmdsts;
rge_tx_list_sync(sc, q, cur, 1, BUS_DMASYNC_PREREAD);
if (ISSET(txstat, htole32(RGE_TDCMDSTS_OWN))) {
free = 2;
break;
}
@ -1385,24 +1402,30 @@ rge_txeof(struct rge_queues *q)
m_freem(txq->txq_mbuf);
txq->txq_mbuf = NULL;
if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL))
if (ISSET(txstat,
htole32(RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL)))
ifp->if_collisions++;
if (txstat & RGE_TDCMDSTS_TXERR)
if (ISSET(txstat, htole32(RGE_TDCMDSTS_TXERR)))
ifp->if_oerrors++;
bus_dmamap_sync(sc->sc_dmat, q->q_tx.rge_tx_list_map,
idx * sizeof(struct rge_tx_desc),
sizeof(struct rge_tx_desc),
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
cons = RGE_NEXT_TX_DESC(idx);
idx = RGE_NEXT_TX_DESC(cur);
free = 1;
}
if (free == 0)
return (0);
q->q_tx.rge_txq_considx = cons;
if (idx >= cons) {
rge_tx_list_sync(sc, q, cons, idx - cons,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
} else {
rge_tx_list_sync(sc, q, cons, RGE_TX_LIST_CNT - cons,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
rge_tx_list_sync(sc, q, 0, idx,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
}
q->q_tx.rge_txq_considx = idx;
if (ifq_is_oactive(&ifp->if_snd))
ifq_restart(&ifp->if_snd);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_rgereg.h,v 1.11 2024/06/30 08:13:02 kevlo Exp $ */
/* $OpenBSD: if_rgereg.h,v 1.12 2024/08/20 00:09:12 dlg Exp $ */
/*
* Copyright (c) 2019, 2020 Kevin Lo <kevlo@openbsd.org>
@ -206,10 +206,9 @@
struct rge_tx_desc {
uint32_t rge_cmdsts;
uint32_t rge_extsts;
uint32_t rge_addrlo;
uint32_t rge_addrhi;
uint64_t rge_addr;
uint32_t reserved[4];
};
} __packed __aligned(16);
#define RGE_TDCMDSTS_COLL 0x000f0000
#define RGE_TDCMDSTS_EXCESSCOLL 0x00100000

View File

@ -1,4 +1,4 @@
$OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp $
$OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/*
@ -8956,6 +8956,8 @@ product SAMSUNG2 SM981_NVME 0xa808 SM981/PM981 NVMe
product SAMSUNG2 PM991_NVME 0xa809 PM991 NVMe
product SAMSUNG2 PM9A1_NVME 0xa80a PM9A1 NVMe
product SAMSUNG2 PM9B1_NVME 0xa80b PM9B1 NVMe
product SAMSUNG2 PM9C1_NVME 0xa80c PM9C1 NVMe
product SAMSUNG2 PM9C1A_NVME 0xa80d PM9C1a NVMe
product SAMSUNG2 NVME_171X 0xa820 NVMe
product SAMSUNG2 NVME_172X 0xa821 NVMe
product SAMSUNG2 NVME_172X_A_B 0xa822 NVMe

View File

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp
* OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -8961,6 +8961,8 @@
#define PCI_PRODUCT_SAMSUNG2_PM991_NVME 0xa809 /* PM991 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9A1_NVME 0xa80a /* PM9A1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9B1_NVME 0xa80b /* PM9B1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9C1_NVME 0xa80c /* PM9C1 NVMe */
#define PCI_PRODUCT_SAMSUNG2_PM9C1A_NVME 0xa80d /* PM9C1a NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_171X 0xa820 /* NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_172X 0xa821 /* NVMe */
#define PCI_PRODUCT_SAMSUNG2_NVME_172X_A_B 0xa822 /* NVMe */

View File

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2084 2024/08/15 11:25:37 patrick Exp
* OpenBSD: pcidevs,v 1.2085 2024/08/20 12:17:48 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -32307,6 +32307,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9B1_NVME,
"PM9B1 NVMe",
},
{
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9C1_NVME,
"PM9C1 NVMe",
},
{
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_PM9C1A_NVME,
"PM9C1a NVMe",
},
{
PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_NVME_171X,
"NVMe",

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_descrip.c,v 1.208 2024/06/22 10:22:29 jsg Exp $ */
/* $OpenBSD: kern_descrip.c,v 1.209 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@ -362,7 +362,7 @@ restart:
return (0);
}
if ((u_int)new >= lim_cur(RLIMIT_NOFILE) ||
(u_int)new >= maxfiles) {
(u_int)new >= atomic_load_int(&maxfiles)) {
FRELE(fp, p);
return (EBADF);
}
@ -424,7 +424,7 @@ restart:
case F_DUPFD_CLOEXEC:
newmin = (long)SCARG(uap, arg);
if ((u_int)newmin >= lim_cur(RLIMIT_NOFILE) ||
(u_int)newmin >= maxfiles) {
(u_int)newmin >= atomic_load_int(&maxfiles)) {
error = EINVAL;
break;
}
@ -877,7 +877,7 @@ fdalloc(struct proc *p, int want, int *result)
* expanding the ofile array.
*/
restart:
lim = min((int)lim_cur(RLIMIT_NOFILE), maxfiles);
lim = min((int)lim_cur(RLIMIT_NOFILE), atomic_load_int(&maxfiles));
last = min(fdp->fd_nfiles, lim);
if ((i = want) < fdp->fd_freefile)
i = fdp->fd_freefile;
@ -1037,7 +1037,7 @@ fnew(struct proc *p)
int nfiles;
nfiles = atomic_inc_int_nv(&numfiles);
if (nfiles > maxfiles) {
if (nfiles > atomic_load_int(&maxfiles)) {
atomic_dec_int(&numfiles);
tablefull("file");
return (NULL);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_fork.c,v 1.263 2024/08/16 16:19:03 mpi Exp $ */
/* $OpenBSD: kern_fork.c,v 1.264 2024/08/20 07:48:23 mvs Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@ -307,7 +307,7 @@ struct timeval fork_tfmrate = { 10, 0 };
int
fork_check_maxthread(uid_t uid)
{
int val;
int maxthread_local, val;
/*
* Although process entries are dynamically created, we still keep
@ -318,8 +318,10 @@ fork_check_maxthread(uid_t uid)
* the variable nthreads is the current number of procs, maxthread is
* the limit.
*/
maxthread_local = atomic_load_int(&maxthread);
val = atomic_inc_int_nv(&nthreads);
if ((val > maxthread - 5 && uid != 0) || val > maxthread) {
if ((val > maxthread_local - 5 && uid != 0) ||
val > maxthread_local) {
static struct timeval lasttfm;
if (ratecheck(&lasttfm, &fork_tfmrate))
@ -353,7 +355,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
struct proc *p;
uid_t uid = curp->p_ucred->cr_ruid;
struct vmspace *vm;
int count;
int count, maxprocess_local;
vaddr_t uaddr;
int error;
struct ptrace_state *newptstat = NULL;
@ -366,8 +368,9 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
if ((error = fork_check_maxthread(uid)))
return error;
if ((nprocesses >= maxprocess - 5 && uid != 0) ||
nprocesses >= maxprocess) {
maxprocess_local = atomic_load_int(&maxprocess);
if ((nprocesses >= maxprocess_local - 5 && uid != 0) ||
nprocesses >= maxprocess_local) {
static struct timeval lasttfm;
if (ratecheck(&lasttfm, &fork_tfmrate))

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_resource.c,v 1.86 2024/07/09 15:20:15 claudio Exp $ */
/* $OpenBSD: kern_resource.c,v 1.88 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
@ -275,10 +275,10 @@ dosetrlimit(struct proc *p, u_int which, struct rlimit *limp)
maxlim = maxsmap;
break;
case RLIMIT_NOFILE:
maxlim = maxfiles;
maxlim = atomic_load_int(&maxfiles);
break;
case RLIMIT_NPROC:
maxlim = maxprocess;
maxlim = atomic_load_int(&maxprocess);
break;
default:
maxlim = RLIM_INFINITY;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.439 2024/08/14 17:52:47 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.442 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -455,11 +455,6 @@ kern_sysctl_dirs(int top_name, int *name, u_int namelen,
return witness_sysctl(name, namelen, oldp, oldlenp,
newp, newlen);
#endif
#if NAUDIO > 0
case KERN_AUDIO:
return (sysctl_audio(name, namelen, oldp, oldlenp,
newp, newlen));
#endif
#if NVIDEO > 0
case KERN_VIDEO:
return (sysctl_video(name, namelen, oldp, oldlenp,
@ -488,6 +483,16 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
/* dispatch the non-terminal nodes first */
if (namelen != 1) {
switch (name[0]) {
#if NAUDIO > 0
case KERN_AUDIO:
return (sysctl_audio(name, namelen, oldp, oldlenp,
newp, newlen));
#endif
default:
break;
}
savelen = *oldlenp;
if ((error = sysctl_vslock(oldp, savelen)))
return (error);
@ -549,6 +554,8 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
}
case KERN_OSREV:
case KERN_MAXPROC:
case KERN_MAXFILES:
case KERN_NFILES:
case KERN_TTYCOUNT:
case KERN_ARGMAX:
@ -558,6 +565,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_SAVED_IDS:
case KERN_MAXPARTITIONS:
case KERN_RAWPARTITION:
case KERN_MAXTHREAD:
case KERN_NTHREADS:
case KERN_SOMAXCONN:
case KERN_SOMINCONN:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_etherip.c,v 1.55 2024/02/13 12:22:09 bluhm Exp $ */
/* $OpenBSD: if_etherip.c,v 1.56 2024/08/20 07:47:25 mvs Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@ -55,6 +55,11 @@
#include <net/if_etherip.h>
/*
* Locks used to protect data:
* a atomic
*/
union etherip_addr {
struct in_addr in4;
struct in6_addr in6;
@ -97,7 +102,7 @@ struct etherip_softc {
* We can control the acceptance of EtherIP packets by altering the sysctl
* net.inet.etherip.allow value. Zero means drop them, all else is acceptance.
*/
int etherip_allow = 0;
int etherip_allow = 0; /* [a] */
struct cpumem *etheripcounters;
@ -628,7 +633,8 @@ etherip_input(struct etherip_tunnel *key, struct mbuf *m, uint8_t tos,
struct etherip_header *eip;
int rxprio;
if (!etherip_allow && (m->m_flags & (M_AUTH|M_CONF)) == 0) {
if (atomic_load_int(&etherip_allow) == 0 &&
(m->m_flags & (M_AUTH|M_CONF)) == 0) {
etheripstat_inc(etherips_pdrops);
goto drop;
}
@ -799,19 +805,14 @@ int
etherip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen)
{
int error;
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return ENOTDIR;
switch (name[0]) {
case ETHERIPCTL_ALLOW:
NET_LOCK();
error = sysctl_int_bounded(oldp, oldlenp, newp, newlen,
&etherip_allow, 0, 1);
NET_UNLOCK();
return (error);
return (sysctl_int_bounded(oldp, oldlenp, newp, newlen,
&etherip_allow, 0, 1));
case ETHERIPCTL_STATS:
return (etherip_sysctl_etheripstat(oldp, oldlenp, newp));
default:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: igmp.c,v 1.84 2024/08/12 11:25:27 bluhm Exp $ */
/* $OpenBSD: igmp.c,v 1.85 2024/08/20 07:46:27 mvs Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@ -687,8 +687,6 @@ igmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
switch (name[0]) {
case IGMPCTL_STATS:
if (newp != NULL)
return (EPERM);
return (igmp_sysctl_igmpstat(oldp, oldlenp, newp));
default:
return (EOPNOTSUPP);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in_proto.c,v 1.108 2024/08/16 09:20:35 mvs Exp $ */
/* $OpenBSD: in_proto.c,v 1.110 2024/08/20 07:47:25 mvs Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
@ -270,7 +270,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
.pr_protocol = IPPROTO_IGMP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = igmp_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs,
@ -342,7 +342,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
.pr_protocol = IPPROTO_PFSYNC,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = pfsync_input4,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs,
@ -366,7 +366,7 @@ const struct protosw inetsw[] = {
.pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
.pr_protocol = IPPROTO_ETHERIP,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = ip_etherip_input,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in6_proto.c,v 1.118 2024/08/16 09:20:35 mvs Exp $ */
/* $OpenBSD: in6_proto.c,v 1.119 2024/08/20 07:46:27 mvs Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@ -158,7 +158,7 @@ const struct protosw inet6sw[] = {
.pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
.pr_protocol = IPPROTO_RAW,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET|PR_MPSYSCTL,
.pr_input = rip6_input,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,

View File

@ -13,7 +13,7 @@ by the folks at Sun Microsystems.
> From: yunexus!oz@uunet.UU.NET (Ozan Yigit)
> To: bostic@okeeffe.berkeley.edu
> Cc: ccvaxa!willcox@uunet.UU.NET, jag@sun.com, rsalz@uunet.UU.NET
> In-Reply-To: Keith Bostic's message of Tue, 16 Feb 88 16:09:06 PST
> In-Reply-To: Keith Bostic's message of Tue, 16 Feb 88 16:09:06 PST
> Subject: Re: Indent...
Thank you for your response about indent. I was wrong in my original

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshkey.c,v 1.143 2024/08/15 00:51:51 djm Exp $ */
/* $OpenBSD: sshkey.c,v 1.145 2024/08/20 11:10:04 djm Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@ -26,6 +26,7 @@
*/
#include <sys/types.h>
#include <sys/mman.h>
#include <netinet/in.h>
#ifdef WITH_OPENSSL
@ -710,6 +711,27 @@ sshkey_sk_cleanup(struct sshkey *k)
k->sk_key_handle = k->sk_reserved = NULL;
}
static int
sshkey_prekey_alloc(u_char **prekeyp, size_t len)
{
u_char *prekey;
*prekeyp = NULL;
if ((prekey = mmap(NULL, len, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE|MAP_CONCEAL, -1, 0)) == MAP_FAILED)
return SSH_ERR_SYSTEM_ERROR;
*prekeyp = prekey;
return 0;
}
static void
sshkey_prekey_free(void *prekey, size_t len)
{
if (prekey == NULL)
return;
munmap(prekey, len);
}
static void
sshkey_free_contents(struct sshkey *k)
{
@ -723,7 +745,7 @@ sshkey_free_contents(struct sshkey *k)
if (sshkey_is_cert(k))
cert_free(k->cert);
freezero(k->shielded_private, k->shielded_len);
freezero(k->shield_prekey, k->shield_prekey_len);
sshkey_prekey_free(k->shield_prekey, k->shield_prekey_len);
}
void
@ -1591,10 +1613,8 @@ sshkey_shield_private(struct sshkey *k)
}
/* Prepare a random pre-key, and from it an ephemeral key */
if ((prekey = malloc(SSHKEY_SHIELD_PREKEY_LEN)) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
if ((r = sshkey_prekey_alloc(&prekey, SSHKEY_SHIELD_PREKEY_LEN)) != 0)
goto out;
}
arc4random_buf(prekey, SSHKEY_SHIELD_PREKEY_LEN);
if ((r = ssh_digest_memory(SSHKEY_SHIELD_PREKEY_HASH,
prekey, SSHKEY_SHIELD_PREKEY_LEN,
@ -1672,7 +1692,7 @@ sshkey_shield_private(struct sshkey *k)
explicit_bzero(keyiv, sizeof(keyiv));
explicit_bzero(&tmp, sizeof(tmp));
freezero(enc, enclen);
freezero(prekey, SSHKEY_SHIELD_PREKEY_LEN);
sshkey_prekey_free(prekey, SSHKEY_SHIELD_PREKEY_LEN);
sshkey_free(kswap);
sshbuf_free(prvbuf);
return r;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: output.c,v 1.53 2024/08/14 19:10:51 claudio Exp $ */
/* $OpenBSD: output.c,v 1.54 2024/08/20 12:00:20 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@ -119,7 +119,7 @@ show_summary(struct peer *p)
p->stats.msg_sent_open + p->stats.msg_sent_notification +
p->stats.msg_sent_update + p->stats.msg_sent_keepalive +
p->stats.msg_sent_rrefresh,
p->wbuf.queued,
p->stats.msg_queue_len,
fmt_monotime(p->stats.last_updown));
if (p->state == STATE_ESTABLISHED) {
printf("%6u", p->stats.prefix_cnt);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: control.c,v 1.117 2024/04/22 09:36:04 claudio Exp $ */
/* $OpenBSD: control.c,v 1.118 2024/08/20 11:59:39 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -564,6 +564,7 @@ control_imsg_relay(struct imsg *imsg, struct peer *p)
p->stats.prefix_sent_eor = stats.prefix_sent_eor;
p->stats.pending_update = stats.pending_update;
p->stats.pending_withdraw = stats.pending_withdraw;
p->stats.msg_queue_len = msgbuf_queuelen(&p->wbuf);
return imsg_compose(&c->imsgbuf, type, 0, pid, -1,
p, sizeof(*p));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rde.c,v 1.626 2024/08/14 19:09:51 claudio Exp $ */
/* $OpenBSD: rde.c,v 1.627 2024/08/20 11:59:39 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -245,7 +245,7 @@ rde_main(int debug, int verbose)
if (i >= pfd_elms)
fatalx("poll pfd too small");
if (mctx->mrt.wbuf.queued) {
if (msgbuf_queuelen(&mctx->mrt.wbuf) > 0) {
pfd[i].fd = mctx->mrt.wbuf.fd;
pfd[i].events = POLLOUT;
i++;
@ -3175,7 +3175,7 @@ rde_mrt_throttled(void *arg)
{
struct mrt *mrt = arg;
return (mrt->wbuf.queued > SESS_MSG_LOW_MARK);
return (msgbuf_queuelen(&mrt->wbuf) > SESS_MSG_LOW_MARK);
}
static void

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rtr_proto.c,v 1.38 2024/08/12 09:04:23 claudio Exp $ */
/* $OpenBSD: rtr_proto.c,v 1.39 2024/08/20 11:59:39 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@ -1263,7 +1263,7 @@ rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
return;
}
if (pfd->revents & POLLOUT && rs->w.queued) {
if (pfd->revents & POLLOUT && msgbuf_queuelen(&rs->w) > 0) {
if ((error = ibuf_write(&rs->w)) == -1) {
if (errno != EAGAIN) {
log_warn("rtr %s: write error", log_rtr(rs));
@ -1272,7 +1272,8 @@ rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
}
if (error == 0)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
if (rs->w.queued == 0 && rs->state == RTR_STATE_ERROR)
if (rs->state == RTR_STATE_ERROR &&
msgbuf_queuelen(&rs->w) == 0)
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
}
if (pfd->revents & POLLIN) {
@ -1378,7 +1379,7 @@ rtr_poll_events(struct pollfd *pfds, size_t npfds, time_t *timeout)
pfd->fd = rs->fd;
pfd->events = 0;
if (rs->w.queued)
if (msgbuf_queuelen(&rs->w) > 0)
pfd->events |= POLLOUT;
if (rs->state >= RTR_STATE_ESTABLISHED)
pfd->events |= POLLIN;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.480 2024/06/10 12:51:25 claudio Exp $ */
/* $OpenBSD: session.c,v 1.481 2024/08/20 11:59:39 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@ -305,7 +305,7 @@ session_main(int debug, int verbose)
free(m);
continue;
}
if (m->wbuf.queued)
if (msgbuf_queuelen(&m->wbuf) > 0)
mrt_cnt++;
}
@ -415,7 +415,8 @@ session_main(int debug, int verbose)
/* are we waiting for a write? */
events = POLLIN;
if (p->wbuf.queued > 0 || p->state == STATE_CONNECT)
if (msgbuf_queuelen(&p->wbuf) > 0 ||
p->state == STATE_CONNECT)
events |= POLLOUT;
/* is there still work to do? */
if (p->rpending && p->rbuf && p->rbuf->wpos)
@ -433,7 +434,7 @@ session_main(int debug, int verbose)
idx_peers = i;
LIST_FOREACH(m, &mrthead, entry)
if (m->wbuf.queued) {
if (msgbuf_queuelen(&m->wbuf) > 0) {
pfd[i].fd = m->wbuf.fd;
pfd[i].events = POLLOUT;
mrt_l[i - idx_peers] = m;
@ -884,7 +885,8 @@ change_state(struct peer *peer, enum session_state state,
* try to write out what's buffered (maybe a notification),
* don't bother if it fails
*/
if (peer->state >= STATE_OPENSENT && peer->wbuf.queued)
if (peer->state >= STATE_OPENSENT &&
msgbuf_queuelen(&peer->wbuf) > 0)
msgbuf_write(&peer->wbuf);
/*
@ -1429,7 +1431,7 @@ session_sendmsg(struct bgp_msg *msg, struct peer *p)
}
ibuf_close(&p->wbuf, msg->buf);
if (!p->throttled && p->wbuf.queued > SESS_MSG_HIGH_MARK) {
if (!p->throttled && msgbuf_queuelen(&p->wbuf) > SESS_MSG_HIGH_MARK) {
if (imsg_rde(IMSG_XOFF, p->conf.id, NULL, 0) == -1)
log_peer_warn(&p->conf, "imsg_compose XOFF");
else
@ -1936,7 +1938,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
return (1);
}
if (pfd->revents & POLLOUT && p->wbuf.queued) {
if (pfd->revents & POLLOUT && msgbuf_queuelen(&p->wbuf) > 0) {
if ((error = msgbuf_write(&p->wbuf)) <= 0 && errno != EAGAIN) {
if (error == 0)
log_peer_warnx(&p->conf, "Connection closed");
@ -1947,7 +1949,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
}
p->stats.last_write = getmonotime();
start_timer_sendholdtime(p);
if (p->throttled && p->wbuf.queued < SESS_MSG_LOW_MARK) {
if (p->throttled &&
msgbuf_queuelen(&p->wbuf) < SESS_MSG_LOW_MARK) {
if (imsg_rde(IMSG_XON, p->conf.id, NULL, 0) == -1)
log_peer_warn(&p->conf, "imsg_compose XON");
else

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.h,v 1.171 2024/08/12 09:04:23 claudio Exp $ */
/* $OpenBSD: session.h,v 1.172 2024/08/20 11:59:39 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -151,6 +151,7 @@ struct peer_stats {
time_t last_updown;
time_t last_read;
time_t last_write;
uint32_t msg_queue_len;
uint32_t prefix_cnt;
uint32_t prefix_out_cnt;
uint32_t pending_update;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: filemode.c,v 1.48 2024/07/25 08:44:39 tb Exp $ */
/* $OpenBSD: filemode.c,v 1.49 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -731,7 +731,7 @@ proc_filemode(int fd)
for (;;) {
pfd.events = POLLIN;
if (msgq.queued)
if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT;
if (poll(&pfd, 1, INFTIM) == -1) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: http.c,v 1.85 2024/04/23 10:27:46 tb Exp $ */
/* $OpenBSD: http.c,v 1.86 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@ -2077,7 +2077,7 @@ proc_http(char *bind_addr, int fd)
memset(&pfds, 0, sizeof(pfds));
pfds[0].fd = fd;
pfds[0].events = POLLIN;
if (msgq.queued)
if (msgbuf_queuelen(&msgq) > 0)
pfds[0].events |= POLLOUT;
i = 1;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.263 2024/08/15 09:22:12 claudio Exp $ */
/* $OpenBSD: main.c,v 1.264 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -1289,7 +1289,7 @@ main(int argc, char *argv[])
for (i = 0; i < NPFD; i++) {
pfd[i].events = POLLIN;
if (queues[i]->queued)
if (msgbuf_queuelen(queues[i]) > 0)
pfd[i].events |= POLLOUT;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parser.c,v 1.141 2024/06/12 10:03:09 tb Exp $ */
/* $OpenBSD: parser.c,v 1.142 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -1056,7 +1056,7 @@ proc_parser(int fd)
for (;;) {
pfd.events = POLLIN;
if (msgq.queued)
if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT;
if (poll(&pfd, 1, INFTIM) == -1) {

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: rpki-client.8,v 1.107 2024/06/20 20:15:02 job Exp $
.\" $OpenBSD: rpki-client.8,v 1.108 2024/08/20 12:53:47 job Exp $
.\"
.\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 20 2024 $
.Dd $Mdocdate: August 20 2024 $
.Dt RPKI-CLIENT 8
.Os
.Sh NAME
@ -403,11 +403,6 @@ agreement regarding ARIN service restrictions.
.Re
.Pp
.Rs
.%T Finding and Using Geofeed Data
.%R RFC 9092
.Re
.Pp
.Rs
.%T Manifests for the RPKI
.%R RFC 9286
.Re
@ -428,6 +423,11 @@ agreement regarding ARIN service restrictions.
.Re
.Pp
.Rs
.%T Finding and Using Geofeed Data
.%R RFC 9632
.Re
.Pp
.Rs
.%T RPKI Signed Object for Trust Anchor Key
.%U https://datatracker.ietf.org/doc/html/draft-ietf-sidrops-signed-tal
.%D Oct, 2022

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rrdp.c,v 1.33 2024/02/16 11:46:57 tb Exp $ */
/* $OpenBSD: rrdp.c,v 1.34 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
@ -585,7 +585,7 @@ proc_rrdp(int fd)
*/
pfds[0].fd = fd;
pfds[0].events = POLLIN;
if (msgq.queued)
if (msgbuf_queuelen(&msgq) > 0)
pfds[0].events |= POLLOUT;
if (poll(pfds, i, INFTIM) == -1) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rsync.c,v 1.50 2024/03/22 03:38:12 job Exp $ */
/* $OpenBSD: rsync.c,v 1.51 2024/08/20 13:31:49 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@ -294,7 +294,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
pfd.events = 0;
pfd.events |= POLLIN;
if (msgq.queued)
if (msgbuf_queuelen(&msgq) > 0)
pfd.events |= POLLOUT;
if (npending > 0 && nprocs < MAX_RSYNC_REQUESTS) {