sync with OpenBSD -current
This commit is contained in:
parent
855cd93650
commit
1fb3f2c612
51 changed files with 673 additions and 500 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/bin/ksh
|
||||
#
|
||||
# $OpenBSD: unbound,v 1.8 2024/09/23 20:44:24 kn Exp $
|
||||
# $OpenBSD: unbound,v 1.9 2024/10/09 15:42:56 kn Exp $
|
||||
|
||||
daemon="/usr/sbin/unbound"
|
||||
daemon_flags="-c /var/unbound/etc/unbound.conf"
|
||||
|
@ -8,8 +8,9 @@ daemon_flags="-c /var/unbound/etc/unbound.conf"
|
|||
. /etc/rc.d/rc.subr
|
||||
|
||||
rc_pre() {
|
||||
if grep '^[[:space:]]*auto-trust-anchor-file:' \
|
||||
/var/unbound/etc/unbound.conf > /dev/null 2>&1; then
|
||||
local _anchor=$(/usr/sbin/unbound-checkconf -o auto-trust-anchor-file)
|
||||
|
||||
if [[ -n $_anchor && ! -f $_anchor ]]; then
|
||||
/usr/sbin/unbound-anchor -v
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: SSL_alert_type_string.3,v 1.5 2018/03/27 17:35:50 schwarze Exp $
|
||||
.\" $OpenBSD: SSL_alert_type_string.3,v 1.6 2024/10/09 08:22:28 tb Exp $
|
||||
.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
|
||||
.\"
|
||||
.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
|
||||
|
@ -48,7 +48,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 27 2018 $
|
||||
.Dd $Mdocdate: October 9 2024 $
|
||||
.Dt SSL_ALERT_TYPE_STRING 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -208,6 +208,9 @@ This message is always fatal.
|
|||
An internal error unrelated to the peer or the correctness of the protocol
|
||||
makes it impossible to continue (such as a memory allocation failure).
|
||||
This message is always fatal.
|
||||
.It \(dqIF\(dq/\(dqinappropriate fallback\(dq
|
||||
Sent by a server in response to an invalid connection retry attempt from
|
||||
a client (see RFC 7507).
|
||||
.It \(dqUS\(dq/\(dquser canceled\(dq
|
||||
This handshake is being canceled for some reason unrelated to a protocol
|
||||
failure.
|
||||
|
@ -229,6 +232,12 @@ This message is always a warning.
|
|||
.It \(dqUP\(dq/\(dqunknown PSK identity\(dq
|
||||
Sent by the server to indicate that it does not recognize a PSK identity or an
|
||||
SRP identity.
|
||||
.It \(dqCQ\(dq/\(dqcertificate required\(dq
|
||||
Sent by servers when a client certificate is desired byt none was provided
|
||||
by the client.
|
||||
.It \(dqAP\(dq/\(dqno application protocol\(dq
|
||||
Sent by servers when a client ALPN extension advertises only protocols that
|
||||
the server does not support (see RFC 7301).
|
||||
.It \(dqUK\(dq/\(dqunknown\(dq
|
||||
This indicates that no description is available for this alert type.
|
||||
Probably
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ssl.h,v 1.242 2024/08/31 10:51:48 tb Exp $ */
|
||||
/* $OpenBSD: ssl.h,v 1.244 2024/10/09 10:27:52 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -2239,7 +2239,10 @@ void ERR_load_SSL_strings(void);
|
|||
#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303
|
||||
#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231
|
||||
#define SSL_R_SSL_SESSION_ID_TOO_LONG 408
|
||||
#define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109
|
||||
#define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116
|
||||
#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
|
||||
#define SSL_R_TLSV1_ALERT_NO_APPLICATION_PROTOCOL 1120
|
||||
#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050
|
||||
#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021
|
||||
#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051
|
||||
|
@ -2251,6 +2254,7 @@ void ERR_load_SSL_strings(void);
|
|||
#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070
|
||||
#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022
|
||||
#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048
|
||||
#define SSL_R_TLSV1_ALERT_UNKNOWN_PSK_IDENTITY 1115
|
||||
#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090
|
||||
#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
|
||||
#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
|
||||
|
@ -2264,7 +2268,6 @@ void ERR_load_SSL_strings(void);
|
|||
#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157
|
||||
#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233
|
||||
#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234
|
||||
#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235
|
||||
#define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236
|
||||
#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313
|
||||
#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ssl_err.c,v 1.52 2024/09/09 07:40:03 tb Exp $ */
|
||||
/* $OpenBSD: ssl_err.c,v 1.53 2024/10/09 08:00:29 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
|
@ -392,6 +392,8 @@ static const ERR_STRING_DATA SSL_str_reasons[] = {
|
|||
{ERR_REASON(SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH), "ssl session id has bad length"},
|
||||
{ERR_REASON(SSL_R_SSL_SESSION_ID_IS_DIFFERENT), "ssl session id is different"},
|
||||
{ERR_REASON(SSL_R_SSL_SESSION_ID_TOO_LONG), "ssl session id is too long"},
|
||||
{ERR_REASON(SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED), "tlsv13 alert certificate required"},
|
||||
{ERR_REASON(SSL_R_TLSV13_ALERT_MISSING_EXTENSION), "tlsv13 alert missing extension"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_ACCESS_DENIED), "tlsv1 alert access denied"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_DECODE_ERROR), "tlsv1 alert decode error"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED), "tlsv1 alert decryption failed"},
|
||||
|
@ -400,10 +402,12 @@ static const ERR_STRING_DATA SSL_str_reasons[] = {
|
|||
{ERR_REASON(SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK), "tlsv1 alert inappropriate fallback"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY), "tlsv1 alert insufficient security"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_INTERNAL_ERROR), "tlsv1 alert internal error"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_NO_APPLICATION_PROTOCOL), "tlsv1 alert no application protocol"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION), "tlsv1 alert no renegotiation"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_PROTOCOL_VERSION), "tlsv1 alert protocol version"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_RECORD_OVERFLOW), "tlsv1 alert record overflow"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_UNKNOWN_CA), "tlsv1 alert unknown ca"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_UNKNOWN_PSK_IDENTITY), "tlsv1 alert unknown psk_identity"},
|
||||
{ERR_REASON(SSL_R_TLSV1_ALERT_USER_CANCELLED), "tlsv1 alert user cancelled"},
|
||||
{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE), "tlsv1 bad certificate hash value"},
|
||||
{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE), "tlsv1 bad certificate status response"},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ssl_stat.c,v 1.21 2023/07/08 16:40:13 beck Exp $ */
|
||||
/* $OpenBSD: ssl_stat.c,v 1.22 2024/10/09 08:01:39 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -592,6 +592,9 @@ SSL_alert_desc_string(int value)
|
|||
case SSL_AD_BAD_RECORD_MAC:
|
||||
str = "BM";
|
||||
break;
|
||||
case SSL_AD_RECORD_OVERFLOW:
|
||||
str = "RO";
|
||||
break;
|
||||
case SSL_AD_DECOMPRESSION_FAILURE:
|
||||
str = "DF";
|
||||
break;
|
||||
|
@ -616,9 +619,6 @@ SSL_alert_desc_string(int value)
|
|||
case SSL_AD_ILLEGAL_PARAMETER:
|
||||
str = "IP";
|
||||
break;
|
||||
case SSL_AD_RECORD_OVERFLOW:
|
||||
str = "RO";
|
||||
break;
|
||||
case SSL_AD_UNKNOWN_CA:
|
||||
str = "CA";
|
||||
break;
|
||||
|
@ -640,6 +640,9 @@ SSL_alert_desc_string(int value)
|
|||
case SSL_AD_INTERNAL_ERROR:
|
||||
str = "IE";
|
||||
break;
|
||||
case SSL_AD_INAPPROPRIATE_FALLBACK:
|
||||
str = "IF";
|
||||
break;
|
||||
case SSL_AD_USER_CANCELLED:
|
||||
str = "US";
|
||||
break;
|
||||
|
@ -667,6 +670,12 @@ SSL_alert_desc_string(int value)
|
|||
case SSL_AD_UNKNOWN_PSK_IDENTITY:
|
||||
str = "UP";
|
||||
break;
|
||||
case SSL_AD_CERTIFICATE_REQUIRED:
|
||||
str = "CQ"; /* XXX */
|
||||
break;
|
||||
case SSL_AD_NO_APPLICATION_PROTOCOL:
|
||||
str = "AP";
|
||||
break;
|
||||
default:
|
||||
str = "UK";
|
||||
break;
|
||||
|
@ -690,6 +699,9 @@ SSL_alert_desc_string_long(int value)
|
|||
case SSL_AD_BAD_RECORD_MAC:
|
||||
str = "bad record mac";
|
||||
break;
|
||||
case SSL_AD_RECORD_OVERFLOW:
|
||||
str = "record overflow";
|
||||
break;
|
||||
case SSL_AD_DECOMPRESSION_FAILURE:
|
||||
str = "decompression failure";
|
||||
break;
|
||||
|
@ -714,9 +726,6 @@ SSL_alert_desc_string_long(int value)
|
|||
case SSL_AD_ILLEGAL_PARAMETER:
|
||||
str = "illegal parameter";
|
||||
break;
|
||||
case SSL_AD_RECORD_OVERFLOW:
|
||||
str = "record overflow";
|
||||
break;
|
||||
case SSL_AD_UNKNOWN_CA:
|
||||
str = "unknown CA";
|
||||
break;
|
||||
|
@ -738,6 +747,9 @@ SSL_alert_desc_string_long(int value)
|
|||
case SSL_AD_INTERNAL_ERROR:
|
||||
str = "internal error";
|
||||
break;
|
||||
case SSL_AD_INAPPROPRIATE_FALLBACK:
|
||||
str = "inappropriate fallback";
|
||||
break;
|
||||
case SSL_AD_USER_CANCELLED:
|
||||
str = "user canceled";
|
||||
break;
|
||||
|
@ -765,6 +777,12 @@ SSL_alert_desc_string_long(int value)
|
|||
case SSL_AD_UNKNOWN_PSK_IDENTITY:
|
||||
str = "unknown PSK identity";
|
||||
break;
|
||||
case SSL_AD_CERTIFICATE_REQUIRED:
|
||||
str = "certificate required";
|
||||
break;
|
||||
case SSL_AD_NO_APPLICATION_PROTOCOL:
|
||||
str = "no application protocol";
|
||||
break;
|
||||
default:
|
||||
str = "unknown";
|
||||
break;
|
||||
|
|
7
regress/sys/kern/signal/sig-stop3/Makefile
Normal file
7
regress/sys/kern/signal/sig-stop3/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# $OpenBSD: Makefile,v 1.1 2024/10/09 12:59:59 claudio Exp $
|
||||
|
||||
PROG= sig-stop3
|
||||
|
||||
LDADD= -lpthread
|
||||
|
||||
.include <bsd.regress.mk>
|
108
regress/sys/kern/signal/sig-stop3/sig-stop3.c
Normal file
108
regress/sys/kern/signal/sig-stop3/sig-stop3.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* $OpenBSD: sig-stop3.c,v 1.1 2024/10/09 12:59:59 claudio Exp $ */
|
||||
/*
|
||||
* Written by Artur Grabowski <art@openbsd.org> 2007 Public Domain.
|
||||
* Written by Claudio Jeker <claudio@openbsd.org> 2024 Public Domain.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define THREAD_COUNT 4
|
||||
|
||||
volatile sig_atomic_t tstp_count, cont_count;
|
||||
pid_t child;
|
||||
|
||||
static void
|
||||
alrm_handler(int sig)
|
||||
{
|
||||
kill(child, SIGKILL);
|
||||
dprintf(STDERR_FILENO, "timeout\n");
|
||||
_exit(2);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
thread(void *arg)
|
||||
{
|
||||
struct timespec ts = { .tv_sec = 2 };
|
||||
|
||||
while (nanosleep(&ts, &ts) != 0)
|
||||
;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
child_main(void)
|
||||
{
|
||||
pthread_t self, pthread[THREAD_COUNT];
|
||||
sigset_t set;
|
||||
int i, r;
|
||||
|
||||
for (i = 0; i < THREAD_COUNT; i++) {
|
||||
if ((r = pthread_create(&pthread[i], NULL, thread, NULL))) {
|
||||
warnc(r, "could not create thread");
|
||||
pthread[i] = self;
|
||||
}
|
||||
}
|
||||
|
||||
/* terminate main process */
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct timespec ts = { .tv_nsec = 200 * 1000 * 1000 };
|
||||
int status;
|
||||
|
||||
switch((child = fork())) {
|
||||
case -1:
|
||||
err(1, "fork");
|
||||
case 0:
|
||||
exit(child_main());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
signal(SIGALRM, alrm_handler);
|
||||
alarm(5);
|
||||
|
||||
nanosleep(&ts, NULL);
|
||||
|
||||
printf("sending SIGSTOP\n");
|
||||
if (kill(child, SIGSTOP) == -1)
|
||||
err(1, "kill");
|
||||
|
||||
printf("waiting...\n");
|
||||
if (waitpid(child, &status, WCONTINUED|WUNTRACED) <= 0)
|
||||
err(1, "waitpid");
|
||||
|
||||
if (!WIFSTOPPED(status))
|
||||
errx(1, "bad status, not stopped: %d", status);
|
||||
printf("got stopped notification\n");
|
||||
|
||||
nanosleep(&ts, NULL);
|
||||
|
||||
printf("killing child\n");
|
||||
if (kill(child, SIGKILL) == -1)
|
||||
err(1, "kill");
|
||||
|
||||
if (waitpid(child, &status, 0) <= 0)
|
||||
err(1, "waitpid");
|
||||
|
||||
if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL)
|
||||
errx(1, "bad status: %d", status);
|
||||
|
||||
printf("OK\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: packages-specs.7,v 1.29 2022/03/31 17:27:23 naddy Exp $
|
||||
.\" $OpenBSD: packages-specs.7,v 1.31 2024/10/09 07:25:35 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2001 Marc Espie
|
||||
.\"
|
||||
|
@ -24,7 +24,7 @@
|
|||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 31 2022 $
|
||||
.Dd $Mdocdate: October 9 2024 $
|
||||
.Dt PACKAGES-SPECS 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -185,6 +185,9 @@ that are substantially different from formal
|
|||
The special character
|
||||
.Sq %
|
||||
is explicitly forbidden in formal package names and specs.
|
||||
.Pp
|
||||
.Xr pkg_check-version 1
|
||||
can be used to verify the ordering of package names.
|
||||
.Sh CONFLICTS
|
||||
Most conflicts between packages are handled on a package name basis.
|
||||
Unless the packages have been specially prepared, it is
|
||||
|
@ -232,7 +235,7 @@ The corresponding package name is also used as a package specification,
|
|||
after removing any version and flavor requirements.
|
||||
.Pp
|
||||
Without a
|
||||
.Sq pkgspec:
|
||||
.Sq pkgspec\&:
|
||||
part, by default, any package with the right stem will do: in effect,
|
||||
the pkgspec used is
|
||||
.Sq stem-* .
|
||||
|
@ -341,6 +344,7 @@ and so would check on
|
|||
.Qq toughluck-* .
|
||||
.Sh SEE ALSO
|
||||
.Xr pkg_add 1 ,
|
||||
.Xr pkg_check-version 1 ,
|
||||
.Xr bsd.port.mk 5 ,
|
||||
.Xr library-specs 7 ,
|
||||
.Xr packages 7 ,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bus_dma.c,v 1.58 2024/08/28 18:21:15 bluhm Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.59 2024/10/08 19:40:00 kettenis Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -537,15 +537,18 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
|||
bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
|
||||
int flags)
|
||||
{
|
||||
paddr_t low, high;
|
||||
|
||||
/*
|
||||
* XXX in the presence of decent (working) iommus and bouncebuffers
|
||||
* we can then fallback this allocation to a range of { 0, -1 }.
|
||||
* However for now we err on the side of caution and allocate dma
|
||||
* memory under the 4gig boundary.
|
||||
*/
|
||||
return (_bus_dmamem_alloc_range(t, size, alignment, boundary,
|
||||
segs, nsegs, rsegs, flags, (bus_addr_t)0, (bus_addr_t)0xffffffff));
|
||||
if (flags & BUS_DMA_64BIT) {
|
||||
low = no_constraint.ucr_low;
|
||||
high = no_constraint.ucr_high;
|
||||
} else {
|
||||
low = dma_constraint.ucr_low;
|
||||
high = dma_constraint.ucr_high;
|
||||
}
|
||||
|
||||
return _bus_dmamem_alloc_range(t, size, alignment, boundary,
|
||||
segs, nsegs, rsegs, flags, low, high);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ahci_acpi.c,v 1.5 2022/04/06 18:59:27 naddy Exp $ */
|
||||
/* $OpenBSD: ahci_acpi.c,v 1.6 2024/10/09 00:38:25 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Mark Kettenis
|
||||
*
|
||||
|
@ -40,7 +40,8 @@ int ahci_acpi_match(struct device *, void *, void *);
|
|||
void ahci_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach ahci_acpi_ca = {
|
||||
sizeof(struct ahci_acpi_softc), ahci_acpi_match, ahci_acpi_attach
|
||||
sizeof(struct ahci_acpi_softc), ahci_acpi_match, ahci_acpi_attach,
|
||||
NULL, ahci_activate
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ehci_acpi.c,v 1.3 2022/06/28 08:15:04 kettenis Exp $ */
|
||||
/* $OpenBSD: ehci_acpi.c,v 1.4 2024/10/09 00:38:26 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Mark Kettenis
|
||||
*
|
||||
|
@ -47,7 +47,8 @@ int ehci_acpi_match(struct device *, void *, void *);
|
|||
void ehci_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach ehci_acpi_ca = {
|
||||
sizeof(struct ehci_acpi_softc), ehci_acpi_match, ehci_acpi_attach
|
||||
sizeof(struct ehci_acpi_softc), ehci_acpi_match, ehci_acpi_attach,
|
||||
NULL, ehci_activate
|
||||
};
|
||||
|
||||
const char *ehci_hids[] = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ipmi_acpi.c,v 1.5 2022/04/06 18:59:27 naddy Exp $ */
|
||||
/* $OpenBSD: ipmi_acpi.c,v 1.6 2024/10/09 00:38:25 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
||||
|
@ -55,6 +55,7 @@ struct ipmi_acpi_softc {
|
|||
|
||||
const struct cfattach ipmi_acpi_ca = {
|
||||
sizeof(struct ipmi_acpi_softc), ipmi_acpi_match, ipmi_acpi_attach,
|
||||
NULL, ipmi_activate
|
||||
};
|
||||
|
||||
const char *ipmi_acpi_hids[] = { ACPI_DEV_IPMI, NULL };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ohci_acpi.c,v 1.2 2022/04/06 18:59:27 naddy Exp $ */
|
||||
/* $OpenBSD: ohci_acpi.c,v 1.3 2024/10/09 00:38:25 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Mark Kettenis
|
||||
*
|
||||
|
@ -47,7 +47,8 @@ int ohci_acpi_match(struct device *, void *, void *);
|
|||
void ohci_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach ohci_acpi_ca = {
|
||||
sizeof(struct ohci_acpi_softc), ohci_acpi_match, ohci_acpi_attach
|
||||
sizeof(struct ohci_acpi_softc), ohci_acpi_match, ohci_acpi_attach,
|
||||
NULL, ohci_activate
|
||||
};
|
||||
|
||||
void ohci_acpi_attach_deferred(struct device *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sdhc_acpi.c,v 1.22 2022/10/08 19:46:52 kettenis Exp $ */
|
||||
/* $OpenBSD: sdhc_acpi.c,v 1.23 2024/10/09 00:38:25 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Mark Kettenis
|
||||
*
|
||||
|
@ -51,7 +51,8 @@ int sdhc_acpi_match(struct device *, void *, void *);
|
|||
void sdhc_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach sdhc_acpi_ca = {
|
||||
sizeof(struct sdhc_acpi_softc), sdhc_acpi_match, sdhc_acpi_attach
|
||||
sizeof(struct sdhc_acpi_softc), sdhc_acpi_match, sdhc_acpi_attach,
|
||||
NULL, sdhc_activate
|
||||
};
|
||||
|
||||
const char *sdhc_hids[] = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: xhci_acpi.c,v 1.12 2024/06/19 21:31:10 patrick Exp $ */
|
||||
/* $OpenBSD: xhci_acpi.c,v 1.13 2024/10/09 00:38:26 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Mark Kettenis
|
||||
*
|
||||
|
@ -47,7 +47,8 @@ int xhci_acpi_match(struct device *, void *, void *);
|
|||
void xhci_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach xhci_acpi_ca = {
|
||||
sizeof(struct xhci_acpi_softc), xhci_acpi_match, xhci_acpi_attach
|
||||
sizeof(struct xhci_acpi_softc), xhci_acpi_match, xhci_acpi_attach,
|
||||
NULL, xhci_activate
|
||||
};
|
||||
|
||||
const char *xhci_hids[] = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ipmi_fdt.c,v 1.2 2022/04/06 18:59:28 naddy Exp $ */
|
||||
/* $OpenBSD: ipmi_fdt.c,v 1.3 2024/10/09 00:38:26 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -31,7 +31,8 @@ int ipmi_fdt_match(struct device *, void *, void *);
|
|||
void ipmi_fdt_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach ipmi_fdt_ca = {
|
||||
sizeof (struct ipmi_softc), ipmi_fdt_match, ipmi_fdt_attach
|
||||
sizeof (struct ipmi_softc), ipmi_fdt_match, ipmi_fdt_attach,
|
||||
NULL, ipmi_activate
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sdhc_fdt.c,v 1.20 2023/04/08 05:40:54 jsg Exp $ */
|
||||
/* $OpenBSD: sdhc_fdt.c,v 1.21 2024/10/09 00:38:26 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis
|
||||
*
|
||||
|
@ -111,7 +111,8 @@ int sdhc_fdt_match(struct device *, void *, void *);
|
|||
void sdhc_fdt_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach sdhc_fdt_ca = {
|
||||
sizeof(struct sdhc_fdt_softc), sdhc_fdt_match, sdhc_fdt_attach
|
||||
sizeof(struct sdhc_fdt_softc), sdhc_fdt_match, sdhc_fdt_attach,
|
||||
NULL, sdhc_activate
|
||||
};
|
||||
|
||||
int sdhc_fdt_card_detect(struct sdhc_softc *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ipmi_i2c.c,v 1.5 2024/07/22 14:03:22 jsg Exp $ */
|
||||
/* $OpenBSD: ipmi_i2c.c,v 1.6 2024/10/09 00:38:26 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -56,7 +56,8 @@ int ipmi_i2c_match(struct device *, void *, void *);
|
|||
void ipmi_i2c_attach(struct device *, struct device *, void *);
|
||||
|
||||
const struct cfattach ipmi_i2c_ca = {
|
||||
sizeof(struct ipmi_i2c_softc), ipmi_i2c_match, ipmi_i2c_attach
|
||||
sizeof(struct ipmi_i2c_softc), ipmi_i2c_match, ipmi_i2c_attach,
|
||||
NULL, ipmi_activate
|
||||
};
|
||||
|
||||
int ipmi_i2c_get_interface_caps(struct ipmi_i2c_softc *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: nvme.c,v 1.123 2024/09/13 09:57:34 jmatthew Exp $ */
|
||||
/* $OpenBSD: nvme.c,v 1.124 2024/10/08 19:41:23 kettenis Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
|
||||
|
@ -1621,7 +1621,7 @@ nvme_dmamem_alloc(struct nvme_softc *sc, size_t size)
|
|||
goto ndmfree;
|
||||
|
||||
if (bus_dmamem_alloc(sc->sc_dmat, size, sc->sc_mps, 0, &ndm->ndm_seg,
|
||||
1, &nsegs, BUS_DMA_WAITOK | BUS_DMA_ZERO) != 0)
|
||||
1, &nsegs, BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_64BIT) != 0)
|
||||
goto destroy;
|
||||
|
||||
if (bus_dmamem_map(sc->sc_dmat, &ndm->ndm_seg, nsegs, size,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ehci.c,v 1.220 2024/05/23 03:21:08 jsg Exp $ */
|
||||
/* $OpenBSD: ehci.c,v 1.221 2024/10/08 19:42:31 kettenis Exp $ */
|
||||
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -317,6 +317,7 @@ ehci_init(struct ehci_softc *sc)
|
|||
sc->sc_noport = EHCI_HCS_N_PORTS(sparams);
|
||||
cparams = EREAD4(sc, EHCI_HCCPARAMS);
|
||||
DPRINTF(("ehci_init: cparams=0x%x\n", cparams));
|
||||
sc->sc_bus.dmaflags = EHCI_HCC_64BIT(cparams) ? BUS_DMA_64BIT : 0;
|
||||
|
||||
/* MUST clear segment register if 64 bit capable. */
|
||||
if (EHCI_HCC_64BIT(cparams))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: usb_mem.c,v 1.35 2024/05/23 03:21:09 jsg Exp $ */
|
||||
/* $OpenBSD: usb_mem.c,v 1.36 2024/10/08 19:42:31 kettenis Exp $ */
|
||||
/* $NetBSD: usb_mem.c,v 1.26 2003/02/01 06:23:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -82,7 +82,7 @@ LIST_HEAD(, usb_frag_dma) usb_frag_freelist =
|
|||
|
||||
usbd_status
|
||||
usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
|
||||
struct usb_dma_block **dmap, int coherent)
|
||||
struct usb_dma_block **dmap, int flags)
|
||||
{
|
||||
int error;
|
||||
struct usb_dma_block *p;
|
||||
|
@ -95,7 +95,7 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
|
|||
/* First check the free list. */
|
||||
for (p = LIST_FIRST(&usb_blk_freelist); p; p = LIST_NEXT(p, next)) {
|
||||
if (p->tag == tag && p->size >= size && p->align >= align &&
|
||||
p->coherent == coherent) {
|
||||
p->flags == flags) {
|
||||
LIST_REMOVE(p, next);
|
||||
usb_blk_nfree--;
|
||||
splx(s);
|
||||
|
@ -115,26 +115,25 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
|
|||
p->tag = tag;
|
||||
p->size = size;
|
||||
p->align = align;
|
||||
p->coherent = coherent;
|
||||
p->flags = flags;
|
||||
error = bus_dmamem_alloc(tag, p->size, align, 0,
|
||||
p->segs, nitems(p->segs),
|
||||
&p->nsegs, BUS_DMA_NOWAIT);
|
||||
p->segs, nitems(p->segs), &p->nsegs,
|
||||
BUS_DMA_NOWAIT | (flags & BUS_DMA_64BIT));
|
||||
if (error)
|
||||
goto free0;
|
||||
|
||||
error = bus_dmamem_map(tag, p->segs, p->nsegs, p->size,
|
||||
&p->kaddr, BUS_DMA_NOWAIT | (coherent ?
|
||||
BUS_DMA_COHERENT : 0));
|
||||
&p->kaddr, BUS_DMA_NOWAIT | (flags & BUS_DMA_COHERENT));
|
||||
if (error)
|
||||
goto free1;
|
||||
|
||||
error = bus_dmamap_create(tag, p->size, 1, p->size,
|
||||
0, BUS_DMA_NOWAIT, &p->map);
|
||||
0, BUS_DMA_NOWAIT | (flags & BUS_DMA_64BIT), &p->map);
|
||||
if (error)
|
||||
goto unmap;
|
||||
|
||||
error = bus_dmamap_load(tag, p->map, p->kaddr, p->size, NULL,
|
||||
BUS_DMA_NOWAIT);
|
||||
BUS_DMA_NOWAIT);
|
||||
if (error)
|
||||
goto destroy;
|
||||
|
||||
|
@ -189,18 +188,17 @@ usb_allocmem(struct usbd_bus *bus, size_t size, size_t align, int flags,
|
|||
usbd_status err;
|
||||
struct usb_frag_dma *f;
|
||||
struct usb_dma_block *b;
|
||||
int coherent;
|
||||
int i;
|
||||
int s;
|
||||
|
||||
coherent = !!(flags & USB_DMA_COHERENT);
|
||||
flags = (flags & USB_DMA_COHERENT) ? BUS_DMA_COHERENT : 0;
|
||||
flags |= bus->dmaflags;
|
||||
|
||||
/* If the request is large then just use a full block. */
|
||||
if (size > USB_MEM_SMALL || align > USB_MEM_SMALL) {
|
||||
DPRINTFN(1, ("%s: large alloc %d\n", __func__, (int)size));
|
||||
size = (size + USB_MEM_BLOCK - 1) & ~(USB_MEM_BLOCK - 1);
|
||||
err = usb_block_allocmem(tag, size, align, &p->block,
|
||||
coherent);
|
||||
err = usb_block_allocmem(tag, size, align, &p->block, flags);
|
||||
if (!err) {
|
||||
p->block->frags = NULL;
|
||||
p->offs = 0;
|
||||
|
@ -211,12 +209,12 @@ usb_allocmem(struct usbd_bus *bus, size_t size, size_t align, int flags,
|
|||
s = splusb();
|
||||
/* Check for free fragments. */
|
||||
for (f = LIST_FIRST(&usb_frag_freelist); f; f = LIST_NEXT(f, next))
|
||||
if (f->block->tag == tag && f->block->coherent == coherent)
|
||||
if (f->block->tag == tag && f->block->flags == flags)
|
||||
break;
|
||||
if (f == NULL) {
|
||||
DPRINTFN(1, ("usb_allocmem: adding fragments\n"));
|
||||
err = usb_block_allocmem(tag, USB_MEM_BLOCK, USB_MEM_SMALL, &b,
|
||||
coherent);
|
||||
flags);
|
||||
if (err) {
|
||||
splx(s);
|
||||
return (err);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: usb_mem.h,v 1.17 2020/03/21 12:08:31 patrick Exp $ */
|
||||
/* $OpenBSD: usb_mem.h,v 1.18 2024/10/08 19:42:31 kettenis Exp $ */
|
||||
/* $NetBSD: usb_mem.h,v 1.20 2003/05/03 18:11:42 wiz Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $ */
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct usb_dma_block {
|
|||
caddr_t kaddr;
|
||||
bus_dma_segment_t segs[1];
|
||||
int nsegs;
|
||||
int coherent;
|
||||
int flags;
|
||||
size_t size;
|
||||
size_t align;
|
||||
struct usb_frag_dma *frags;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: usbdivar.h,v 1.83 2022/09/04 08:42:39 mglocker Exp $ */
|
||||
/* $OpenBSD: usbdivar.h,v 1.84 2024/10/08 19:42:31 kettenis Exp $ */
|
||||
/* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
|
||||
|
||||
|
@ -135,6 +135,7 @@ struct usbd_bus {
|
|||
#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0", "3.0" }
|
||||
void *soft; /* soft interrupt cookie */
|
||||
bus_dma_tag_t dmatag; /* DMA tag */
|
||||
int dmaflags;
|
||||
};
|
||||
|
||||
struct usbd_device {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: xhci.c,v 1.134 2024/08/17 01:55:03 jsg Exp $ */
|
||||
/* $OpenBSD: xhci.c,v 1.135 2024/10/08 19:42:31 kettenis Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Martin Pieuchot
|
||||
|
@ -238,12 +238,12 @@ usbd_dma_contig_alloc(struct usbd_bus *bus, struct usbd_dma_info *dma,
|
|||
dma->size = size;
|
||||
|
||||
error = bus_dmamap_create(dma->tag, size, 1, size, boundary,
|
||||
BUS_DMA_NOWAIT, &dma->map);
|
||||
BUS_DMA_NOWAIT | bus->dmaflags, &dma->map);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
error = bus_dmamem_alloc(dma->tag, size, alignment, boundary, &dma->seg,
|
||||
1, &dma->nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO);
|
||||
1, &dma->nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO | bus->dmaflags);
|
||||
if (error != 0)
|
||||
goto destroy;
|
||||
|
||||
|
@ -329,6 +329,7 @@ xhci_init(struct xhci_softc *sc)
|
|||
|
||||
hcr = XREAD4(sc, XHCI_HCCPARAMS);
|
||||
sc->sc_ctxsize = XHCI_HCC_CSZ(hcr) ? 64 : 32;
|
||||
sc->sc_bus.dmaflags |= XHCI_HCC_AC64(hcr) ? BUS_DMA_64BIT : 0;
|
||||
DPRINTF(("%s: %d bytes context\n", DEVNAME(sc), sc->sc_ctxsize));
|
||||
|
||||
#ifdef XHCI_DEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_exit.c,v 1.234 2024/09/30 12:32:26 claudio Exp $ */
|
||||
/* $OpenBSD: kern_exit.c,v 1.237 2024/10/08 12:02:24 claudio Exp $ */
|
||||
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -118,7 +118,6 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
{
|
||||
struct process *pr, *qr, *nqr;
|
||||
struct rusage *rup;
|
||||
struct timespec ts, pts;
|
||||
|
||||
atomic_setbits_int(&p->p_flag, P_WEXIT);
|
||||
|
||||
|
@ -172,16 +171,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
}
|
||||
|
||||
/* proc is off ps_threads list so update accounting of process now */
|
||||
nanouptime(&ts);
|
||||
if (timespeccmp(&ts, &curcpu()->ci_schedstate.spc_runtime, <))
|
||||
timespecclear(&pts);
|
||||
else
|
||||
timespecsub(&ts, &curcpu()->ci_schedstate.spc_runtime, &pts);
|
||||
tu_enter(&p->p_tu);
|
||||
timespecadd(&p->p_tu.tu_runtime, &pts, &p->p_tu.tu_runtime);
|
||||
tu_leave(&p->p_tu);
|
||||
/* adjust spc_runtime to not double account the runtime from above */
|
||||
curcpu()->ci_schedstate.spc_runtime = ts;
|
||||
tuagg_add_runtime();
|
||||
tuagg_add_process(p->p_p, p);
|
||||
|
||||
if ((p->p_flag & P_THREAD) == 0) {
|
||||
|
@ -308,9 +298,11 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
* Traced processes are killed since their
|
||||
* existence means someone is screwing up.
|
||||
*/
|
||||
mtx_enter(&qr->ps_mtx);
|
||||
if (qr->ps_flags & PS_TRACED &&
|
||||
!(qr->ps_flags & PS_EXITING)) {
|
||||
process_untrace(qr);
|
||||
mtx_leave(&qr->ps_mtx);
|
||||
|
||||
/*
|
||||
* If single threading is active,
|
||||
|
@ -324,6 +316,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
prsignal(qr, SIGKILL);
|
||||
} else {
|
||||
process_reparent(qr, initprocess);
|
||||
mtx_leave(&qr->ps_mtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,9 +324,11 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
* Make sure orphans won't remember the exiting process.
|
||||
*/
|
||||
while ((qr = LIST_FIRST(&pr->ps_orphans)) != NULL) {
|
||||
KASSERT(qr->ps_oppid == pr->ps_pid);
|
||||
qr->ps_oppid = 0;
|
||||
mtx_enter(&qr->ps_mtx);
|
||||
KASSERT(qr->ps_opptr == pr);
|
||||
qr->ps_opptr = NULL;
|
||||
process_clear_orphan(qr);
|
||||
mtx_leave(&qr->ps_mtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,11 +354,13 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
|
|||
* we can wake our original parent to possibly unblock
|
||||
* wait4() to return ECHILD.
|
||||
*/
|
||||
mtx_enter(&pr->ps_mtx);
|
||||
if (pr->ps_flags & PS_NOZOMBIE) {
|
||||
struct process *ppr = pr->ps_pptr;
|
||||
process_reparent(pr, initprocess);
|
||||
wakeup(ppr);
|
||||
}
|
||||
mtx_leave(&pr->ps_mtx);
|
||||
}
|
||||
|
||||
/* just a thread? check if last one standing. */
|
||||
|
@ -746,14 +743,17 @@ proc_finish_wait(struct proc *waiter, struct process *pr)
|
|||
* If we got the child via a ptrace 'attach',
|
||||
* we need to give it back to the old parent.
|
||||
*/
|
||||
if (pr->ps_oppid != 0 && (pr->ps_oppid != pr->ps_ppid) &&
|
||||
(tr = prfind(pr->ps_oppid))) {
|
||||
pr->ps_oppid = 0;
|
||||
mtx_enter(&pr->ps_mtx);
|
||||
if (pr->ps_opptr != NULL && (pr->ps_opptr != pr->ps_pptr)) {
|
||||
tr = pr->ps_opptr;
|
||||
pr->ps_opptr = NULL;
|
||||
atomic_clearbits_int(&pr->ps_flags, PS_TRACED);
|
||||
process_reparent(pr, tr);
|
||||
mtx_leave(&pr->ps_mtx);
|
||||
prsignal(tr, SIGCHLD);
|
||||
wakeup(tr);
|
||||
} else {
|
||||
mtx_leave(&pr->ps_mtx);
|
||||
scheduler_wait_hook(waiter, pr->ps_mainproc);
|
||||
rup = &waiter->p_p->ps_cru;
|
||||
ruadd(rup, pr->ps_ru);
|
||||
|
@ -772,13 +772,14 @@ process_untrace(struct process *pr)
|
|||
struct process *ppr = NULL;
|
||||
|
||||
KASSERT(pr->ps_flags & PS_TRACED);
|
||||
MUTEX_ASSERT_LOCKED(&pr->ps_mtx);
|
||||
|
||||
if (pr->ps_oppid != 0 &&
|
||||
(pr->ps_oppid != pr->ps_ppid))
|
||||
ppr = prfind(pr->ps_oppid);
|
||||
if (pr->ps_opptr != NULL &&
|
||||
(pr->ps_opptr != pr->ps_pptr))
|
||||
ppr = pr->ps_opptr;
|
||||
|
||||
/* not being traced any more */
|
||||
pr->ps_oppid = 0;
|
||||
pr->ps_opptr = NULL;
|
||||
atomic_clearbits_int(&pr->ps_flags, PS_TRACED);
|
||||
process_reparent(pr, ppr ? ppr : initprocess);
|
||||
}
|
||||
|
@ -802,8 +803,8 @@ process_reparent(struct process *child, struct process *parent)
|
|||
if (child->ps_pptr == parent)
|
||||
return;
|
||||
|
||||
KASSERT(child->ps_oppid == 0 ||
|
||||
child->ps_oppid == child->ps_ppid);
|
||||
KASSERT(child->ps_opptr == NULL ||
|
||||
child->ps_opptr == child->ps_pptr);
|
||||
|
||||
LIST_REMOVE(child, ps_sibling);
|
||||
LIST_INSERT_HEAD(&parent->ps_children, child, ps_sibling);
|
||||
|
@ -814,6 +815,7 @@ process_reparent(struct process *child, struct process *parent)
|
|||
LIST_INSERT_HEAD(&child->ps_pptr->ps_orphans, child, ps_orphan);
|
||||
}
|
||||
|
||||
MUTEX_ASSERT_LOCKED(&child->ps_mtx);
|
||||
child->ps_pptr = parent;
|
||||
child->ps_ppid = parent->ps_pid;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_fork.c,v 1.265 2024/08/21 03:07:45 deraadt Exp $ */
|
||||
/* $OpenBSD: kern_fork.c,v 1.267 2024/10/08 12:02:24 claudio Exp $ */
|
||||
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -457,8 +457,9 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
|
|||
LIST_INSERT_AFTER(curpr, pr, ps_pglist);
|
||||
LIST_INSERT_HEAD(&curpr->ps_children, pr, ps_sibling);
|
||||
|
||||
mtx_enter(&pr->ps_mtx);
|
||||
if (pr->ps_flags & PS_TRACED) {
|
||||
pr->ps_oppid = curpr->ps_pid;
|
||||
pr->ps_opptr = curpr;
|
||||
process_reparent(pr, curpr->ps_pptr);
|
||||
|
||||
/*
|
||||
|
@ -473,6 +474,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
|
|||
pr->ps_ptstat->pe_other_pid = curpr->ps_pid;
|
||||
}
|
||||
}
|
||||
mtx_leave(&pr->ps_mtx);
|
||||
|
||||
/*
|
||||
* For new processes, set accounting bits and mark as complete.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_prot.c,v 1.82 2023/01/09 02:12:13 guenther Exp $ */
|
||||
/* $OpenBSD: kern_prot.c,v 1.83 2024/10/08 09:05:40 claudio Exp $ */
|
||||
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -83,7 +83,9 @@ int
|
|||
sys_getppid(struct proc *p, void *v, register_t *retval)
|
||||
{
|
||||
|
||||
mtx_enter(&p->p_p->ps_mtx);
|
||||
*retval = p->p_p->ps_ppid;
|
||||
mtx_leave(&p->p_p->ps_mtx);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_resource.c,v 1.90 2024/10/03 10:20:05 claudio Exp $ */
|
||||
/* $OpenBSD: kern_resource.c,v 1.91 2024/10/08 11:57:59 claudio Exp $ */
|
||||
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -443,6 +443,37 @@ tuagg_add_process(struct process *pr, struct proc *p)
|
|||
p->p_tu.tu_uticks = p->p_tu.tu_sticks = p->p_tu.tu_iticks = 0;
|
||||
}
|
||||
|
||||
void
|
||||
tuagg_add_runtime(void)
|
||||
{
|
||||
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
|
||||
struct proc *p = curproc;
|
||||
struct timespec ts;
|
||||
|
||||
/*
|
||||
* Compute the amount of time during which the current
|
||||
* process was running, and add that to its total so far.
|
||||
*/
|
||||
nanouptime(&ts);
|
||||
if (timespeccmp(&ts, &spc->spc_runtime, <)) {
|
||||
#if 0
|
||||
printf("uptime is not monotonic! "
|
||||
"ts=%lld.%09lu, runtime=%lld.%09lu\n",
|
||||
(long long)tv.tv_sec, tv.tv_nsec,
|
||||
(long long)spc->spc_runtime.tv_sec,
|
||||
spc->spc_runtime.tv_nsec);
|
||||
#endif
|
||||
timespecclear(&ts);
|
||||
} else {
|
||||
timespecsub(&ts, &spc->spc_runtime, &ts);
|
||||
}
|
||||
/* update spc_runtime */
|
||||
spc->spc_runtime = ts;
|
||||
tu_enter(&p->p_tu);
|
||||
timespecadd(&p->p_tu.tu_runtime, &ts, &p->p_tu.tu_runtime);
|
||||
tu_leave(&p->p_tu);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform the running time and tick information in a struct tusage
|
||||
* into user, system, and interrupt time usage.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_sched.c,v 1.101 2024/10/06 01:50:56 jsg Exp $ */
|
||||
/* $OpenBSD: kern_sched.c,v 1.102 2024/10/08 11:57:59 claudio Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
|
||||
*
|
||||
|
@ -213,21 +213,10 @@ void
|
|||
sched_exit(struct proc *p)
|
||||
{
|
||||
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
|
||||
struct timespec ts;
|
||||
|
||||
LIST_INSERT_HEAD(&spc->spc_deadproc, p, p_hash);
|
||||
|
||||
/* update the tu_runtime one last time */
|
||||
nanouptime(&ts);
|
||||
if (timespeccmp(&ts, &spc->spc_runtime, <))
|
||||
timespecclear(&ts);
|
||||
else
|
||||
timespecsub(&ts, &spc->spc_runtime, &ts);
|
||||
|
||||
/* add the time counts for this thread */
|
||||
tu_enter(&p->p_tu);
|
||||
timespecadd(&p->p_tu.tu_runtime, &ts, &p->p_tu.tu_runtime);
|
||||
tu_leave(&p->p_tu);
|
||||
tuagg_add_runtime();
|
||||
|
||||
KERNEL_ASSERT_LOCKED();
|
||||
sched_toidle();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_sig.c,v 1.339 2024/10/01 08:28:34 claudio Exp $ */
|
||||
/* $OpenBSD: kern_sig.c,v 1.341 2024/10/09 08:58:19 claudio Exp $ */
|
||||
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -840,6 +840,7 @@ trapsignal(struct proc *p, int signum, u_long trapno, int code,
|
|||
SCHED_UNLOCK();
|
||||
|
||||
signum = pr->ps_xsig;
|
||||
pr->ps_xsig = 0;
|
||||
if ((p->p_flag & P_TRACESINGLE) == 0)
|
||||
single_thread_clear(p, 0);
|
||||
atomic_clearbits_int(&p->p_flag, P_TRACESINGLE);
|
||||
|
@ -901,6 +902,16 @@ psignal(struct proc *p, int signum)
|
|||
ptsignal(p, signum, SPROCESS);
|
||||
}
|
||||
|
||||
void
|
||||
prsignal(struct process *pr, int signum)
|
||||
{
|
||||
/* Ignore signal if the target process is exiting */
|
||||
if (pr->ps_flags & PS_EXITING) {
|
||||
return;
|
||||
}
|
||||
ptsignal(TAILQ_FIRST(&pr->ps_threads), signum, SPROCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* type = SPROCESS process signal, can be diverted (sigwait())
|
||||
* type = STHREAD thread signal, but should be propagated if unhandled
|
||||
|
@ -1352,6 +1363,7 @@ cursig(struct proc *p, struct sigctx *sctx)
|
|||
* those are not true.
|
||||
*/
|
||||
signum = pr->ps_xsig;
|
||||
pr->ps_xsig = 0;
|
||||
mask = sigmask(signum);
|
||||
setsigctx(p, signum, sctx);
|
||||
if (!((pr->ps_flags & PS_TRACED) == 0 ||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sched_bsd.c,v 1.94 2024/07/08 13:17:12 claudio Exp $ */
|
||||
/* $OpenBSD: sched_bsd.c,v 1.96 2024/10/09 08:58:19 claudio Exp $ */
|
||||
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -344,7 +344,6 @@ mi_switch(void)
|
|||
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
|
||||
struct proc *p = curproc;
|
||||
struct proc *nextproc;
|
||||
struct timespec ts;
|
||||
int oldipl;
|
||||
#ifdef MULTIPROCESSOR
|
||||
int hold_count;
|
||||
|
@ -364,26 +363,8 @@ mi_switch(void)
|
|||
hold_count = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compute the amount of time during which the current
|
||||
* process was running, and add that to its total so far.
|
||||
*/
|
||||
nanouptime(&ts);
|
||||
if (timespeccmp(&ts, &spc->spc_runtime, <)) {
|
||||
#if 0
|
||||
printf("uptime is not monotonic! "
|
||||
"ts=%lld.%09lu, runtime=%lld.%09lu\n",
|
||||
(long long)tv.tv_sec, tv.tv_nsec,
|
||||
(long long)spc->spc_runtime.tv_sec,
|
||||
spc->spc_runtime.tv_nsec);
|
||||
#endif
|
||||
timespecclear(&ts);
|
||||
} else {
|
||||
timespecsub(&ts, &spc->spc_runtime, &ts);
|
||||
}
|
||||
tu_enter(&p->p_tu);
|
||||
timespecadd(&p->p_tu.tu_runtime, &ts, &p->p_tu.tu_runtime);
|
||||
tu_leave(&p->p_tu);
|
||||
/* Update thread runtime */
|
||||
tuagg_add_runtime();
|
||||
|
||||
/* Stop any optional clock interrupts. */
|
||||
if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) {
|
||||
|
@ -483,12 +464,6 @@ setrunnable(struct proc *p)
|
|||
default:
|
||||
panic("setrunnable");
|
||||
case SSTOP:
|
||||
/*
|
||||
* If we're being traced (possibly because someone attached us
|
||||
* while we were stopped), check for a signal from the debugger.
|
||||
*/
|
||||
if ((pr->ps_flags & PS_TRACED) != 0 && pr->ps_xsig != 0)
|
||||
atomic_setbits_int(&p->p_siglist, sigmask(pr->ps_xsig));
|
||||
prio = p->p_usrpri;
|
||||
setrunqueue(NULL, p, prio);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sys_process.c,v 1.100 2024/10/01 08:28:34 claudio Exp $ */
|
||||
/* $OpenBSD: sys_process.c,v 1.102 2024/10/08 12:02:24 claudio Exp $ */
|
||||
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -288,10 +288,14 @@ ptrace_ctrl(struct proc *p, int req, pid_t pid, caddr_t addr, int data)
|
|||
case PT_TRACE_ME:
|
||||
/* Just set the trace flag. */
|
||||
tr = p->p_p;
|
||||
if (ISSET(tr->ps_flags, PS_TRACED))
|
||||
mtx_enter(&tr->ps_mtx);
|
||||
if (ISSET(tr->ps_flags, PS_TRACED)) {
|
||||
mtx_leave(&tr->ps_mtx);
|
||||
return EBUSY;
|
||||
}
|
||||
atomic_setbits_int(&tr->ps_flags, PS_TRACED);
|
||||
tr->ps_oppid = tr->ps_ppid;
|
||||
tr->ps_opptr = tr->ps_pptr;
|
||||
mtx_leave(&tr->ps_mtx);
|
||||
if (tr->ps_ptstat == NULL)
|
||||
tr->ps_ptstat = malloc(sizeof(*tr->ps_ptstat),
|
||||
M_SUBPROC, M_WAITOK);
|
||||
|
@ -489,8 +493,10 @@ ptrace_ctrl(struct proc *p, int req, pid_t pid, caddr_t addr, int data)
|
|||
goto fail;
|
||||
#endif
|
||||
|
||||
mtx_enter(&tr->ps_mtx);
|
||||
process_untrace(tr);
|
||||
atomic_clearbits_int(&tr->ps_flags, PS_WAITED);
|
||||
mtx_leave(&tr->ps_mtx);
|
||||
|
||||
sendsig:
|
||||
memset(tr->ps_ptstat, 0, sizeof(*tr->ps_ptstat));
|
||||
|
@ -526,9 +532,11 @@ ptrace_ctrl(struct proc *p, int req, pid_t pid, caddr_t addr, int data)
|
|||
* proc gets to see all the action.
|
||||
* Stop the target.
|
||||
*/
|
||||
mtx_enter(&tr->ps_mtx);
|
||||
atomic_setbits_int(&tr->ps_flags, PS_TRACED);
|
||||
tr->ps_oppid = tr->ps_ppid;
|
||||
tr->ps_opptr = tr->ps_pptr;
|
||||
process_reparent(tr, p->p_p);
|
||||
mtx_leave(&tr->ps_mtx);
|
||||
if (tr->ps_ptstat == NULL)
|
||||
tr->ps_ptstat = malloc(sizeof(*tr->ps_ptstat),
|
||||
M_SUBPROC, M_WAITOK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: proc.h,v 1.372 2024/10/01 08:28:34 claudio Exp $ */
|
||||
/* $OpenBSD: proc.h,v 1.374 2024/10/08 12:02:24 claudio Exp $ */
|
||||
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -157,7 +157,7 @@ struct process {
|
|||
TAILQ_HEAD(,proc) ps_threads; /* [K|m] Threads in this process. */
|
||||
|
||||
LIST_ENTRY(process) ps_pglist; /* List of processes in pgrp. */
|
||||
struct process *ps_pptr; /* Pointer to parent process. */
|
||||
struct process *ps_pptr; /* [K|m] Pointer to parent process. */
|
||||
LIST_ENTRY(process) ps_sibling; /* List of sibling processes. */
|
||||
LIST_HEAD(, process) ps_children;/* Pointer to list of children. */
|
||||
LIST_ENTRY(process) ps_hash; /* Hash chain. */
|
||||
|
@ -176,7 +176,7 @@ struct process {
|
|||
struct vnode *ps_textvp; /* Vnode of executable. */
|
||||
struct filedesc *ps_fd; /* Ptr to open files structure */
|
||||
struct vmspace *ps_vmspace; /* Address space */
|
||||
pid_t ps_pid; /* Process identifier. */
|
||||
pid_t ps_pid; /* [I] Process identifier. */
|
||||
|
||||
struct futex_list ps_ftlist; /* futexes attached to this process */
|
||||
struct tslpqueue ps_tslpqueue; /* [p] queue of threads in thrsleep */
|
||||
|
@ -200,10 +200,10 @@ struct process {
|
|||
u_int ps_xexit; /* Exit status for wait */
|
||||
int ps_xsig; /* Stopping or killing signal */
|
||||
|
||||
pid_t ps_ppid; /* [a] Cached parent pid */
|
||||
pid_t ps_oppid; /* [a] Save parent pid during ptrace. */
|
||||
pid_t ps_ppid; /* [K|m] Cached parent pid */
|
||||
int ps_ptmask; /* Ptrace event mask */
|
||||
struct ptrace_state *ps_ptstat;/* Ptrace state */
|
||||
struct process *ps_opptr; /* [K|m] Old parent during ptrace. */
|
||||
|
||||
struct rusage *ps_ru; /* sum of stats for dead threads. */
|
||||
struct tusage ps_tu; /* [m] accumul times of dead threads. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: resourcevar.h,v 1.33 2024/10/01 09:22:25 claudio Exp $ */
|
||||
/* $OpenBSD: resourcevar.h,v 1.34 2024/10/08 11:57:59 claudio Exp $ */
|
||||
/* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -67,6 +67,7 @@ void addupc_task(struct proc *, u_long, u_int);
|
|||
struct clockrequest;
|
||||
void profclock(struct clockrequest *, void *, void *);
|
||||
void tuagg_add_process(struct process *, struct proc *);
|
||||
void tuagg_add_runtime(void);
|
||||
struct tusage;
|
||||
void tuagg_get_proc(struct tusage *, struct proc *);
|
||||
void tuagg_get_process(struct tusage *, struct process *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: signalvar.h,v 1.54 2022/05/13 15:32:00 claudio Exp $ */
|
||||
/* $OpenBSD: signalvar.h,v 1.55 2024/10/09 08:39:49 claudio Exp $ */
|
||||
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -114,7 +114,7 @@ void pgsigio(struct sigio_ref *sir, int sig, int checkctty);
|
|||
void pgsignal(struct pgrp *pgrp, int sig, int checkctty);
|
||||
void psignal(struct proc *p, int sig);
|
||||
void ptsignal(struct proc *p, int sig, enum signal_type type);
|
||||
#define prsignal(pr,sig) ptsignal((pr)->ps_mainproc, (sig), SPROCESS)
|
||||
void prsignal(struct process *pr, int sig);
|
||||
void trapsignal(struct proc *p, int sig, u_long code, int type,
|
||||
union sigval val);
|
||||
__dead void sigexit(struct proc *, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ext2fs_extern.h,v 1.38 2020/01/20 23:21:56 claudio Exp $ */
|
||||
/* $OpenBSD: ext2fs_extern.h,v 1.39 2024/10/08 02:58:26 jsg Exp $ */
|
||||
/* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -92,9 +92,6 @@ int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *);
|
|||
/* ext2fs_subr.c */
|
||||
int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **);
|
||||
int ext2fs_vinit(struct mount *, struct vnode **);
|
||||
#ifdef DIAGNOSTIC
|
||||
void ext2fs_checkoverlap(struct buf *, struct inode *);
|
||||
#endif
|
||||
|
||||
/* ext2fs_vfsops.c */
|
||||
int ext2fs_mountroot(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ext2fs_subr.c,v 1.37 2021/10/20 06:35:39 semarie Exp $ */
|
||||
/* $OpenBSD: ext2fs_subr.c,v 1.38 2024/10/08 02:58:26 jsg Exp $ */
|
||||
/* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -110,37 +110,6 @@ ext2fs_bufatoff(struct inode *ip, off_t offset, char **res, struct buf **bpp)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) && defined(DIAGNOSTIC)
|
||||
void
|
||||
ext2fs_checkoverlap(struct buf *bp, struct inode *ip)
|
||||
{
|
||||
struct buf *ep;
|
||||
struct vnode *vp;
|
||||
daddr_t start, last;
|
||||
|
||||
start = bp->b_blkno;
|
||||
last = start + btodb(bp->b_bcount) - 1;
|
||||
LIST_FOREACH(ep, &bufhead, b_list) {
|
||||
if (ep == bp || (ep->b_flags & B_INVAL) ||
|
||||
ep->b_vp == NULLVP)
|
||||
continue;
|
||||
if (VOP_BMAP(ep->b_vp, 0, &vp, NULL, NULL))
|
||||
continue;
|
||||
if (vp != ip->i_devvp)
|
||||
continue;
|
||||
/* look for overlap */
|
||||
if (ep->b_bcount == 0 || ep->b_blkno > last ||
|
||||
ep->b_blkno + btodb(ep->b_bcount) <= start)
|
||||
continue;
|
||||
vprint("Disk overlap", vp);
|
||||
printf("\tstart %lld, end %lld overlap start %lld, end %lld\n",
|
||||
start, last, (long long)ep->b_blkno,
|
||||
(long long)(ep->b_blkno + btodb(ep->b_bcount) - 1));
|
||||
panic("Disk buffer overlap");
|
||||
}
|
||||
}
|
||||
#endif /* DIAGNOSTIC */
|
||||
|
||||
/*
|
||||
* Initialize the vnode associated with a new inode, handle aliased vnodes.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ffs_extern.h,v 1.50 2024/05/13 01:15:53 jsg Exp $ */
|
||||
/* $OpenBSD: ffs_extern.h,v 1.51 2024/10/08 02:58:26 jsg Exp $ */
|
||||
/* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -125,9 +125,6 @@ int ffs_truncate(struct inode *, off_t, int, struct ucred *);
|
|||
/* ffs_subr.c */
|
||||
int ffs_bufatoff(struct inode *, off_t, char **, struct buf **);
|
||||
void ffs_fragacct(struct fs *, int, int32_t[], int);
|
||||
#ifdef DIAGNOSTIC
|
||||
void ffs_checkoverlap(struct buf *, struct inode *);
|
||||
#endif
|
||||
int ffs_isfreeblock(struct fs *, u_char *, daddr_t);
|
||||
int ffs_isblock(struct fs *, u_char *, daddr_t);
|
||||
void ffs_clrblock(struct fs *, u_char *, daddr_t);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ffs_subr.c,v 1.34 2021/10/20 06:35:39 semarie Exp $ */
|
||||
/* $OpenBSD: ffs_subr.c,v 1.35 2024/10/08 02:58:26 jsg Exp $ */
|
||||
/* $NetBSD: ffs_subr.c,v 1.6 1996/03/17 02:16:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -119,38 +119,6 @@ ffs_fragacct(struct fs *fs, int fragmap, int32_t fraglist[], int cnt)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(_KERNEL) && defined(DIAGNOSTIC)
|
||||
void
|
||||
ffs_checkoverlap(struct buf *bp, struct inode *ip)
|
||||
{
|
||||
daddr_t start, last;
|
||||
struct vnode *vp;
|
||||
struct buf *ep;
|
||||
|
||||
start = bp->b_blkno;
|
||||
last = start + btodb(bp->b_bcount) - 1;
|
||||
LIST_FOREACH(ep, &bufhead, b_list) {
|
||||
if (ep == bp || (ep->b_flags & B_INVAL) ||
|
||||
ep->b_vp == NULLVP)
|
||||
continue;
|
||||
if (VOP_BMAP(ep->b_vp, 0, &vp, NULL, NULL))
|
||||
continue;
|
||||
if (vp != ip->i_devvp)
|
||||
continue;
|
||||
/* look for overlap */
|
||||
if (ep->b_bcount == 0 || ep->b_blkno > last ||
|
||||
ep->b_blkno + btodb(ep->b_bcount) <= start)
|
||||
continue;
|
||||
vprint("Disk overlap", vp);
|
||||
(void)printf("\tstart %lld, end %lld overlap start %llu, "
|
||||
"end %llu\n", (long long)start, (long long)last,
|
||||
(long long)ep->b_blkno,
|
||||
(long long)(ep->b_blkno + btodb(ep->b_bcount) - 1));
|
||||
panic("Disk buffer overlap");
|
||||
}
|
||||
}
|
||||
#endif /* DIAGNOSTIC */
|
||||
|
||||
/*
|
||||
* block operations
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: screen-redraw.c,v 1.98 2024/08/26 07:34:40 nicm Exp $ */
|
||||
/* $OpenBSD: screen-redraw.c,v 1.99 2024/10/08 09:40:50 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -195,13 +195,17 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
|||
struct client *c = ctx->c;
|
||||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp;
|
||||
u_int sy = w->sy;
|
||||
|
||||
if (ctx->pane_status == PANE_STATUS_BOTTOM)
|
||||
sy--;
|
||||
|
||||
/* Outside the window? */
|
||||
if (px > w->sx || py > w->sy)
|
||||
if (px > w->sx || py > sy)
|
||||
return (0);
|
||||
|
||||
/* On the window border? */
|
||||
if (px == w->sx || py == w->sy)
|
||||
if (px == w->sx || py == sy)
|
||||
return (1);
|
||||
|
||||
/* Check all the panes. */
|
||||
|
@ -231,6 +235,9 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
|||
u_int sx = w->sx, sy = w->sy;
|
||||
int borders = 0;
|
||||
|
||||
if (pane_status == PANE_STATUS_BOTTOM)
|
||||
sy--;
|
||||
|
||||
/* Is this outside the window? */
|
||||
if (px > sx || py > sy)
|
||||
return (CELL_OUTSIDE);
|
||||
|
@ -253,7 +260,7 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
|||
if (py == 0 ||
|
||||
screen_redraw_cell_border(ctx, px, py - 1))
|
||||
borders |= 2;
|
||||
if (py != sy - 1 &&
|
||||
if (py != sy &&
|
||||
screen_redraw_cell_border(ctx, px, py + 1))
|
||||
borders |= 1;
|
||||
} else {
|
||||
|
@ -305,14 +312,15 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
|||
struct window *w = c->session->curw->window;
|
||||
struct window_pane *wp, *active;
|
||||
int pane_status = ctx->pane_status;
|
||||
u_int sx = w->sx, sy = w->sy;
|
||||
int border;
|
||||
u_int right, line;
|
||||
|
||||
*wpp = NULL;
|
||||
|
||||
if (px > w->sx || py > w->sy)
|
||||
if (px > sx || py > sy)
|
||||
return (CELL_OUTSIDE);
|
||||
if (px == w->sx || py == w->sy) /* window border */
|
||||
if (px == sx || py == sy) /* window border */
|
||||
return (screen_redraw_type_of_cell(ctx, px, py));
|
||||
|
||||
if (pane_status != PANE_STATUS_OFF) {
|
||||
|
@ -324,7 +332,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
|||
if (pane_status == PANE_STATUS_TOP)
|
||||
line = wp->yoff - 1;
|
||||
else
|
||||
line = wp->yoff + wp->sy;
|
||||
line = wp->yoff + sy;
|
||||
right = wp->xoff + 2 + wp->status_size - 1;
|
||||
|
||||
if (py == line && px >= wp->xoff + 2 && px <= right)
|
||||
|
@ -587,9 +595,9 @@ screen_redraw_screen(struct client *c)
|
|||
|
||||
if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) {
|
||||
log_debug("%s: redrawing borders", c->name);
|
||||
screen_redraw_draw_borders(&ctx);
|
||||
if (ctx.pane_status != PANE_STATUS_OFF)
|
||||
screen_redraw_draw_pane_status(&ctx);
|
||||
screen_redraw_draw_borders(&ctx);
|
||||
}
|
||||
if (flags & CLIENT_REDRAWWINDOW) {
|
||||
log_debug("%s: redrawing panes", c->name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: server-client.c,v 1.413 2024/10/07 12:58:36 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.414 2024/10/08 06:29:44 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -2458,8 +2458,10 @@ server_client_reset_state(struct client *c)
|
|||
if (c->overlay_draw != NULL) {
|
||||
if (c->overlay_mode != NULL)
|
||||
s = c->overlay_mode(c, c->overlay_data, &cx, &cy);
|
||||
} else
|
||||
} else if (c->prompt_string == NULL)
|
||||
s = wp->screen;
|
||||
else
|
||||
s = c->status.active;
|
||||
if (s != NULL)
|
||||
mode = s->mode;
|
||||
if (log_get_level() != 0) {
|
||||
|
@ -2484,37 +2486,21 @@ server_client_reset_state(struct client *c)
|
|||
cy = tty->sy - n;
|
||||
}
|
||||
cx = c->prompt_cursor;
|
||||
} else if (c->overlay_draw == NULL) {
|
||||
cursor = 0;
|
||||
tty_window_offset(tty, &ox, &oy, &sx, &sy);
|
||||
if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
|
||||
wp->yoff + s->cy >= oy && wp->yoff + s->cy <= oy + sy) {
|
||||
cursor = 1;
|
||||
|
||||
n = options_get_number(oo, "prompt-cursor-colour");
|
||||
s->default_ccolour = n;
|
||||
n = options_get_number(oo, "prompt-cursor-style");
|
||||
screen_set_cursor_style(n, &s->default_cstyle,
|
||||
&s->default_mode);
|
||||
} else {
|
||||
n = options_get_number(wp->options, "cursor-colour");
|
||||
s->default_ccolour = n;
|
||||
n = options_get_number(wp->options, "cursor-style");
|
||||
screen_set_cursor_style(n, &s->default_cstyle,
|
||||
&s->default_mode);
|
||||
cx = wp->xoff + s->cx - ox;
|
||||
cy = wp->yoff + s->cy - oy;
|
||||
|
||||
if (c->overlay_draw == NULL) {
|
||||
cursor = 0;
|
||||
tty_window_offset(tty, &ox, &oy, &sx, &sy);
|
||||
if (wp->xoff + s->cx >= ox &&
|
||||
wp->xoff + s->cx <= ox + sx &&
|
||||
wp->yoff + s->cy >= oy &&
|
||||
wp->yoff + s->cy <= oy + sy) {
|
||||
cursor = 1;
|
||||
|
||||
cx = wp->xoff + s->cx - ox;
|
||||
cy = wp->yoff + s->cy - oy;
|
||||
|
||||
if (status_at_line(c) == 0)
|
||||
cy += status_line_size(c);
|
||||
}
|
||||
if (!cursor)
|
||||
mode &= ~MODE_CURSOR;
|
||||
if (status_at_line(c) == 0)
|
||||
cy += status_line_size(c);
|
||||
}
|
||||
if (!cursor)
|
||||
mode &= ~MODE_CURSOR;
|
||||
}
|
||||
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
|
||||
tty_cursor(tty, cx, cy);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: status.c,v 1.247 2024/10/07 12:58:36 nicm Exp $ */
|
||||
/* $OpenBSD: status.c,v 1.248 2024/10/08 06:29:44 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -736,7 +736,7 @@ status_prompt_redraw(struct client *c)
|
|||
struct screen_write_ctx ctx;
|
||||
struct session *s = c->session;
|
||||
struct screen old_screen;
|
||||
u_int i, lines, offset, left, start, width;
|
||||
u_int i, lines, offset, left, start, width, n;
|
||||
u_int pcursor, pwidth, promptline;
|
||||
struct grid_cell gc;
|
||||
struct format_tree *ft;
|
||||
|
@ -750,6 +750,12 @@ status_prompt_redraw(struct client *c)
|
|||
lines = 1;
|
||||
screen_init(sl->active, c->tty.sx, lines, 0);
|
||||
|
||||
n = options_get_number(s->options, "prompt-cursor-colour");
|
||||
sl->active->default_ccolour = n;
|
||||
n = options_get_number(s->options, "prompt-cursor-style");
|
||||
screen_set_cursor_style(n, &sl->active->default_cstyle,
|
||||
&sl->active->default_mode);
|
||||
|
||||
promptline = status_prompt_line_at(c);
|
||||
if (promptline > lines - 1)
|
||||
promptline = lines - 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bgpd.c,v 1.269 2024/10/01 11:49:24 claudio Exp $ */
|
||||
/* $OpenBSD: bgpd.c,v 1.270 2024/10/08 12:28:09 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
|
@ -53,8 +53,9 @@ int control_setup(struct bgpd_config *);
|
|||
static void getsockpair(int [2]);
|
||||
int imsg_send_sockets(struct imsgbuf *, struct imsgbuf *,
|
||||
struct imsgbuf *);
|
||||
void bgpd_rtr_connect(struct rtr_config *);
|
||||
void bgpd_rtr_connect_done(int, struct bgpd_config *);
|
||||
void bgpd_rtr_conn_setup(struct rtr_config *);
|
||||
void bgpd_rtr_conn_setup_done(int, struct bgpd_config *);
|
||||
void bgpd_rtr_conn_teardown(uint32_t);
|
||||
|
||||
int cflags;
|
||||
volatile sig_atomic_t mrtdump;
|
||||
|
@ -71,12 +72,15 @@ char *rcname;
|
|||
|
||||
struct connect_elm {
|
||||
TAILQ_ENTRY(connect_elm) entry;
|
||||
struct auth_state auth_state;
|
||||
uint32_t id;
|
||||
int fd;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(, connect_elm) connect_queue = \
|
||||
TAILQ_HEAD_INITIALIZER(connect_queue);
|
||||
TAILQ_HEAD_INITIALIZER(connect_queue),
|
||||
socket_queue = \
|
||||
TAILQ_HEAD_INITIALIZER(socket_queue);
|
||||
u_int connect_cnt;
|
||||
#define MAX_CONNECT_CNT 32
|
||||
|
||||
|
@ -404,7 +408,7 @@ BROKEN if (pledge("stdio rpath wpath cpath fattr unix route recvfd sendfd",
|
|||
|
||||
for (i = PFD_CONNECT_START; i < npfd; i++)
|
||||
if (pfd[i].revents != 0)
|
||||
bgpd_rtr_connect_done(pfd[i].fd, conf);
|
||||
bgpd_rtr_conn_setup_done(pfd[i].fd, conf);
|
||||
|
||||
next_loop:
|
||||
if (reconfig) {
|
||||
|
@ -657,7 +661,7 @@ send_config(struct bgpd_config *conf)
|
|||
if (p->reconf_action == RECONF_REINIT)
|
||||
if (pfkey_establish(&p->auth_state, &p->auth_conf,
|
||||
session_localaddr(p), &p->conf.remote_addr) == -1)
|
||||
log_peer_warnx(&p->conf, "pfkey setup failed");
|
||||
log_peer_warnx(&p->conf, "auth setup failed");
|
||||
}
|
||||
|
||||
/* networks go via kroute to the RDE */
|
||||
|
@ -1053,19 +1057,27 @@ dispatch_imsg(struct imsgbuf *imsgbuf, int idx, struct bgpd_config *conf)
|
|||
reconfpending = 3; /* expecting 2 DONE msg */
|
||||
}
|
||||
break;
|
||||
case IMSG_SOCKET_CONN:
|
||||
case IMSG_SOCKET_SETUP:
|
||||
if (idx != PFD_PIPE_RTR) {
|
||||
log_warnx("connect request not from RTR");
|
||||
} else {
|
||||
uint32_t rtrid = imsg_get_id(&imsg);
|
||||
SIMPLEQ_FOREACH(r, &conf->rtrs, entry) {
|
||||
if (imsg_get_id(&imsg) == r->id)
|
||||
if (rtrid == r->id)
|
||||
break;
|
||||
}
|
||||
if (r == NULL)
|
||||
log_warnx("unknown rtr id %d",
|
||||
imsg_get_id(&imsg));
|
||||
log_warnx("unknown rtr id %d", rtrid);
|
||||
else
|
||||
bgpd_rtr_connect(r);
|
||||
bgpd_rtr_conn_setup(r);
|
||||
}
|
||||
break;
|
||||
case IMSG_SOCKET_TEARDOWN:
|
||||
if (idx != PFD_PIPE_RTR) {
|
||||
log_warnx("connect request not from RTR");
|
||||
} else {
|
||||
uint32_t rtrid = imsg_get_id(&imsg);
|
||||
bgpd_rtr_conn_teardown(rtrid);
|
||||
}
|
||||
break;
|
||||
case IMSG_CTL_SHOW_RTR:
|
||||
|
@ -1358,7 +1370,7 @@ imsg_send_sockets(struct imsgbuf *se, struct imsgbuf *rde, struct imsgbuf *rtr)
|
|||
}
|
||||
|
||||
void
|
||||
bgpd_rtr_connect(struct rtr_config *r)
|
||||
bgpd_rtr_conn_setup(struct rtr_config *r)
|
||||
{
|
||||
struct connect_elm *ce;
|
||||
struct sockaddr *sa;
|
||||
|
@ -1377,13 +1389,16 @@ bgpd_rtr_connect(struct rtr_config *r)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pfkey_establish(&ce->auth_state, &r->auth,
|
||||
&r->local_addr, &r->remote_addr) == -1)
|
||||
log_warnx("rtr %s: pfkey setup failed", r->descr);
|
||||
|
||||
ce->id = r->id;
|
||||
ce->fd = socket(aid2af(r->remote_addr.aid),
|
||||
SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_TCP);
|
||||
if (ce->fd == -1) {
|
||||
log_warn("rtr %s", r->descr);
|
||||
free(ce);
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
switch (r->remote_addr.aid) {
|
||||
|
@ -1409,13 +1424,14 @@ bgpd_rtr_connect(struct rtr_config *r)
|
|||
return;
|
||||
}
|
||||
|
||||
if (tcp_md5_set(ce->fd, &r->auth, &r->remote_addr) == -1)
|
||||
log_warn("rtr %s: setting md5sig", r->descr);
|
||||
|
||||
if ((sa = addr2sa(&r->local_addr, 0, &len)) != NULL) {
|
||||
if (bind(ce->fd, sa, len) == -1) {
|
||||
log_warn("rtr %s: bind to %s", r->descr,
|
||||
log_addr(&r->local_addr));
|
||||
close(ce->fd);
|
||||
free(ce);
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1424,21 +1440,25 @@ bgpd_rtr_connect(struct rtr_config *r)
|
|||
if (errno != EINPROGRESS) {
|
||||
log_warn("rtr %s: connect to %s:%u", r->descr,
|
||||
log_addr(&r->remote_addr), r->remote_port);
|
||||
close(ce->fd);
|
||||
free(ce);
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&connect_queue, ce, entry);
|
||||
connect_cnt++;
|
||||
return;
|
||||
}
|
||||
|
||||
imsg_compose(ibuf_rtr, IMSG_SOCKET_CONN, ce->id, 0, ce->fd, NULL, 0);
|
||||
imsg_compose(ibuf_rtr, IMSG_SOCKET_SETUP, ce->id, 0, ce->fd, NULL, 0);
|
||||
TAILQ_INSERT_TAIL(&socket_queue, ce, entry);
|
||||
return;
|
||||
|
||||
fail:
|
||||
if (ce->fd != -1)
|
||||
close(ce->fd);
|
||||
free(ce);
|
||||
}
|
||||
|
||||
void
|
||||
bgpd_rtr_connect_done(int fd, struct bgpd_config *conf)
|
||||
bgpd_rtr_conn_setup_done(int fd, struct bgpd_config *conf)
|
||||
{
|
||||
struct rtr_config *r;
|
||||
struct connect_elm *ce;
|
||||
|
@ -1477,11 +1497,26 @@ bgpd_rtr_connect_done(int fd, struct bgpd_config *conf)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
imsg_compose(ibuf_rtr, IMSG_SOCKET_CONN, ce->id, 0, ce->fd, NULL, 0);
|
||||
free(ce);
|
||||
imsg_compose(ibuf_rtr, IMSG_SOCKET_SETUP, ce->id, 0, ce->fd, NULL, 0);
|
||||
TAILQ_INSERT_TAIL(&socket_queue, ce, entry);
|
||||
return;
|
||||
|
||||
fail:
|
||||
close(fd);
|
||||
free(ce);
|
||||
}
|
||||
|
||||
void
|
||||
bgpd_rtr_conn_teardown(uint32_t id)
|
||||
{
|
||||
struct connect_elm *ce;
|
||||
|
||||
TAILQ_FOREACH(ce, &socket_queue, entry) {
|
||||
if (ce->id == id) {
|
||||
pfkey_remove(&ce->auth_state);
|
||||
TAILQ_REMOVE(&socket_queue, ce, entry);
|
||||
free(ce);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bgpd.h,v 1.497 2024/10/01 11:49:24 claudio Exp $ */
|
||||
/* $OpenBSD: bgpd.h,v 1.498 2024/10/08 12:28:09 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
|
@ -569,6 +569,7 @@ enum rtr_error {
|
|||
struct rtr_config {
|
||||
SIMPLEQ_ENTRY(rtr_config) entry;
|
||||
char descr[PEER_DESCR_LEN];
|
||||
struct auth_config auth;
|
||||
struct bgpd_addr remote_addr;
|
||||
struct bgpd_addr local_addr;
|
||||
uint32_t id;
|
||||
|
@ -645,6 +646,8 @@ enum imsg_type {
|
|||
IMSG_SOCKET_CONN,
|
||||
IMSG_SOCKET_CONN_CTL,
|
||||
IMSG_SOCKET_CONN_RTR,
|
||||
IMSG_SOCKET_SETUP,
|
||||
IMSG_SOCKET_TEARDOWN,
|
||||
IMSG_RECONF_CONF,
|
||||
IMSG_RECONF_RIB,
|
||||
IMSG_RECONF_PEER,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: parse.y,v 1.469 2024/10/01 11:49:24 claudio Exp $ */
|
||||
/* $OpenBSD: parse.y,v 1.470 2024/10/09 10:01:29 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
|
@ -187,6 +187,7 @@ static int push_unary_numop(enum comp_ops, long long);
|
|||
static int push_binary_numop(enum comp_ops, long long, long long);
|
||||
static int geticmptypebyname(char *, uint8_t);
|
||||
static int geticmpcodebyname(u_long, char *, uint8_t);
|
||||
static int merge_auth_conf(struct auth_config *, struct auth_config *);
|
||||
|
||||
static struct bgpd_config *conf;
|
||||
static struct network_head *netconf;
|
||||
|
@ -228,6 +229,7 @@ typedef struct {
|
|||
} prefix;
|
||||
struct filter_prefixlen prefixlen;
|
||||
struct prefixset_item *prefixset_item;
|
||||
struct auth_config authconf;
|
||||
struct {
|
||||
enum auth_enc_alg enc_alg;
|
||||
uint8_t enc_key_len;
|
||||
|
@ -293,6 +295,7 @@ typedef struct {
|
|||
%type <v.filter_prefix> filter_prefix filter_prefix_l filter_prefix_h
|
||||
%type <v.filter_prefix> filter_prefix_m
|
||||
%type <v.u8> unaryop equalityop binaryop filter_as_type
|
||||
%type <v.authconf> authconf
|
||||
%type <v.encspec> encspec
|
||||
%type <v.aspa_elm> aspa_tas aspa_tas_l
|
||||
%%
|
||||
|
@ -732,6 +735,10 @@ rtropt : DESCR STRING {
|
|||
}
|
||||
currtr->min_version = $2;
|
||||
}
|
||||
| authconf {
|
||||
if (merge_auth_conf(&currtr->auth, &$1) == 0)
|
||||
YYERROR;
|
||||
}
|
||||
;
|
||||
|
||||
conf_main : AS as4number {
|
||||
|
@ -2075,142 +2082,9 @@ peeropts : REMOTEAS as4number {
|
|||
curpeer->conf.max_out_prefix = $2;
|
||||
curpeer->conf.max_out_prefix_restart = $4;
|
||||
}
|
||||
| TCP MD5SIG PASSWORD string {
|
||||
if (curpeer->auth_conf.method) {
|
||||
yyerror("auth method cannot be redefined");
|
||||
free($4);
|
||||
| authconf {
|
||||
if (merge_auth_conf(&curpeer->auth_conf, &$1) == 0)
|
||||
YYERROR;
|
||||
}
|
||||
if (strlcpy(curpeer->auth_conf.md5key, $4,
|
||||
sizeof(curpeer->auth_conf.md5key)) >=
|
||||
sizeof(curpeer->auth_conf.md5key)) {
|
||||
yyerror("tcp md5sig password too long: max %zu",
|
||||
sizeof(curpeer->auth_conf.md5key) - 1);
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
curpeer->auth_conf.method = AUTH_MD5SIG;
|
||||
curpeer->auth_conf.md5key_len = strlen($4);
|
||||
free($4);
|
||||
}
|
||||
| TCP MD5SIG KEY string {
|
||||
if (curpeer->auth_conf.method) {
|
||||
yyerror("auth method cannot be redefined");
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if (str2key($4, curpeer->auth_conf.md5key,
|
||||
sizeof(curpeer->auth_conf.md5key)) == -1) {
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
curpeer->auth_conf.method = AUTH_MD5SIG;
|
||||
curpeer->auth_conf.md5key_len = strlen($4) / 2;
|
||||
free($4);
|
||||
}
|
||||
| IPSEC espah IKE {
|
||||
if (curpeer->auth_conf.method) {
|
||||
yyerror("auth method cannot be redefined");
|
||||
YYERROR;
|
||||
}
|
||||
if ($2)
|
||||
curpeer->auth_conf.method = AUTH_IPSEC_IKE_ESP;
|
||||
else
|
||||
curpeer->auth_conf.method = AUTH_IPSEC_IKE_AH;
|
||||
}
|
||||
| IPSEC espah inout SPI NUMBER STRING STRING encspec {
|
||||
enum auth_alg auth_alg;
|
||||
uint8_t keylen;
|
||||
|
||||
if (curpeer->auth_conf.method &&
|
||||
(((curpeer->auth_conf.spi_in && $3 == 1) ||
|
||||
(curpeer->auth_conf.spi_out && $3 == 0)) ||
|
||||
($2 == 1 && curpeer->auth_conf.method !=
|
||||
AUTH_IPSEC_MANUAL_ESP) ||
|
||||
($2 == 0 && curpeer->auth_conf.method !=
|
||||
AUTH_IPSEC_MANUAL_AH))) {
|
||||
yyerror("auth method cannot be redefined");
|
||||
free($6);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if (!strcmp($6, "sha1")) {
|
||||
auth_alg = AUTH_AALG_SHA1HMAC;
|
||||
keylen = 20;
|
||||
} else if (!strcmp($6, "md5")) {
|
||||
auth_alg = AUTH_AALG_MD5HMAC;
|
||||
keylen = 16;
|
||||
} else {
|
||||
yyerror("unknown auth algorithm \"%s\"", $6);
|
||||
free($6);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
free($6);
|
||||
|
||||
if (strlen($7) / 2 != keylen) {
|
||||
yyerror("auth key len: must be %u bytes, "
|
||||
"is %zu bytes", keylen, strlen($7) / 2);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if ($2)
|
||||
curpeer->auth_conf.method =
|
||||
AUTH_IPSEC_MANUAL_ESP;
|
||||
else {
|
||||
if ($8.enc_alg) {
|
||||
yyerror("\"ipsec ah\" doesn't take "
|
||||
"encryption keys");
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
curpeer->auth_conf.method =
|
||||
AUTH_IPSEC_MANUAL_AH;
|
||||
}
|
||||
|
||||
if ($5 <= SPI_RESERVED_MAX || $5 > UINT_MAX) {
|
||||
yyerror("bad spi number %lld", $5);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if ($3 == 1) {
|
||||
if (str2key($7, curpeer->auth_conf.auth_key_in,
|
||||
sizeof(curpeer->auth_conf.auth_key_in)) ==
|
||||
-1) {
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
curpeer->auth_conf.spi_in = $5;
|
||||
curpeer->auth_conf.auth_alg_in = auth_alg;
|
||||
curpeer->auth_conf.enc_alg_in = $8.enc_alg;
|
||||
memcpy(&curpeer->auth_conf.enc_key_in,
|
||||
&$8.enc_key,
|
||||
sizeof(curpeer->auth_conf.enc_key_in));
|
||||
curpeer->auth_conf.enc_keylen_in =
|
||||
$8.enc_key_len;
|
||||
curpeer->auth_conf.auth_keylen_in = keylen;
|
||||
} else {
|
||||
if (str2key($7, curpeer->auth_conf.auth_key_out,
|
||||
sizeof(curpeer->auth_conf.auth_key_out)) ==
|
||||
-1) {
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
curpeer->auth_conf.spi_out = $5;
|
||||
curpeer->auth_conf.auth_alg_out = auth_alg;
|
||||
curpeer->auth_conf.enc_alg_out = $8.enc_alg;
|
||||
memcpy(&curpeer->auth_conf.enc_key_out,
|
||||
&$8.enc_key,
|
||||
sizeof(curpeer->auth_conf.enc_key_out));
|
||||
curpeer->auth_conf.enc_keylen_out =
|
||||
$8.enc_key_len;
|
||||
curpeer->auth_conf.auth_keylen_out = keylen;
|
||||
}
|
||||
free($7);
|
||||
}
|
||||
| TTLSECURITY yesno {
|
||||
curpeer->conf.ttlsec = $2;
|
||||
|
@ -2357,6 +2231,111 @@ nettype : STATIC { $$ = 1; }
|
|||
| CONNECTED { $$ = 0; }
|
||||
;
|
||||
|
||||
authconf : TCP MD5SIG PASSWORD string {
|
||||
memset(&$$, 0, sizeof($$));
|
||||
if (strlcpy($$.md5key, $4, sizeof($$.md5key)) >=
|
||||
sizeof($$.md5key)) {
|
||||
yyerror("tcp md5sig password too long: max %zu",
|
||||
sizeof($$.md5key) - 1);
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
$$.method = AUTH_MD5SIG;
|
||||
$$.md5key_len = strlen($4);
|
||||
free($4);
|
||||
}
|
||||
| TCP MD5SIG KEY string {
|
||||
memset(&$$, 0, sizeof($$));
|
||||
if (str2key($4, $$.md5key, sizeof($$.md5key)) == -1) {
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
$$.method = AUTH_MD5SIG;
|
||||
$$.md5key_len = strlen($4) / 2;
|
||||
free($4);
|
||||
}
|
||||
| IPSEC espah IKE {
|
||||
memset(&$$, 0, sizeof($$));
|
||||
if ($2)
|
||||
$$.method = AUTH_IPSEC_IKE_ESP;
|
||||
else
|
||||
$$.method = AUTH_IPSEC_IKE_AH;
|
||||
}
|
||||
| IPSEC espah inout SPI NUMBER STRING STRING encspec {
|
||||
enum auth_alg auth_alg;
|
||||
uint8_t keylen;
|
||||
|
||||
memset(&$$, 0, sizeof($$));
|
||||
if (!strcmp($6, "sha1")) {
|
||||
auth_alg = AUTH_AALG_SHA1HMAC;
|
||||
keylen = 20;
|
||||
} else if (!strcmp($6, "md5")) {
|
||||
auth_alg = AUTH_AALG_MD5HMAC;
|
||||
keylen = 16;
|
||||
} else {
|
||||
yyerror("unknown auth algorithm \"%s\"", $6);
|
||||
free($6);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
free($6);
|
||||
|
||||
if (strlen($7) / 2 != keylen) {
|
||||
yyerror("auth key len: must be %u bytes, "
|
||||
"is %zu bytes", keylen, strlen($7) / 2);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if ($2)
|
||||
$$.method = AUTH_IPSEC_MANUAL_ESP;
|
||||
else {
|
||||
if ($8.enc_alg) {
|
||||
yyerror("\"ipsec ah\" doesn't take "
|
||||
"encryption keys");
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
$$.method = AUTH_IPSEC_MANUAL_AH;
|
||||
}
|
||||
|
||||
if ($5 <= SPI_RESERVED_MAX || $5 > UINT_MAX) {
|
||||
yyerror("bad spi number %lld", $5);
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
if ($3 == 1) {
|
||||
if (str2key($7, $$.auth_key_in,
|
||||
sizeof($$.auth_key_in)) == -1) {
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
$$.spi_in = $5;
|
||||
$$.auth_alg_in = auth_alg;
|
||||
$$.enc_alg_in = $8.enc_alg;
|
||||
memcpy(&$$.enc_key_in, &$8.enc_key,
|
||||
sizeof($$.enc_key_in));
|
||||
$$.enc_keylen_in = $8.enc_key_len;
|
||||
$$.auth_keylen_in = keylen;
|
||||
} else {
|
||||
if (str2key($7, $$.auth_key_out,
|
||||
sizeof($$.auth_key_out)) == -1) {
|
||||
free($7);
|
||||
YYERROR;
|
||||
}
|
||||
$$.spi_out = $5;
|
||||
$$.auth_alg_out = auth_alg;
|
||||
$$.enc_alg_out = $8.enc_alg;
|
||||
memcpy(&$$.enc_key_out, &$8.enc_key,
|
||||
sizeof($$.enc_key_out));
|
||||
$$.enc_keylen_out = $8.enc_key_len;
|
||||
$$.auth_keylen_out = keylen;
|
||||
}
|
||||
free($7);
|
||||
}
|
||||
;
|
||||
|
||||
espah : ESP { $$ = 1; }
|
||||
| AH { $$ = 0; }
|
||||
;
|
||||
|
@ -6033,3 +6012,39 @@ geticmpcodebyname(u_long type, char *w, uint8_t aid)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
merge_auth_conf(struct auth_config *to, struct auth_config *from)
|
||||
{
|
||||
if (to->method != 0) {
|
||||
/* extra magic for manual ipsec rules */
|
||||
if (to->method == from->method &&
|
||||
(to->method == AUTH_IPSEC_MANUAL_ESP ||
|
||||
to->method == AUTH_IPSEC_MANUAL_AH)) {
|
||||
if (to->spi_in == 0 && from->spi_in != 0) {
|
||||
to->spi_in = from->spi_in;
|
||||
to->auth_alg_in = from->auth_alg_in;
|
||||
to->enc_alg_in = from->enc_alg_in;
|
||||
memcpy(to->enc_key_in, from->enc_key_in,
|
||||
sizeof(to->enc_key_in));
|
||||
to->enc_keylen_in = from->enc_keylen_in;
|
||||
to->auth_keylen_in = from->auth_keylen_in;
|
||||
return 1;
|
||||
} else if (to->spi_out == 0 && from->spi_out != 0) {
|
||||
to->spi_out = from->spi_out;
|
||||
to->auth_alg_out = from->auth_alg_out;
|
||||
to->enc_alg_out = from->enc_alg_out;
|
||||
memcpy(to->enc_key_out, from->enc_key_out,
|
||||
sizeof(to->enc_key_out));
|
||||
to->enc_keylen_out = from->enc_keylen_out;
|
||||
to->auth_keylen_out = from->auth_keylen_out;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
yyerror("auth method cannot be redefined");
|
||||
return 0;
|
||||
}
|
||||
*to = *from;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: printconf.c,v 1.175 2024/10/01 11:49:24 claudio Exp $ */
|
||||
/* $OpenBSD: printconf.c,v 1.176 2024/10/09 10:01:29 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
|
@ -712,6 +712,39 @@ print_aspa(struct aspa_tree *a)
|
|||
printf("\n}\n\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_auth(struct auth_config *auth, const char *c)
|
||||
{
|
||||
char *method;
|
||||
|
||||
if (auth->method == AUTH_MD5SIG)
|
||||
printf("%s\ttcp md5sig\n", c);
|
||||
else if (auth->method == AUTH_IPSEC_MANUAL_ESP ||
|
||||
auth->method == AUTH_IPSEC_MANUAL_AH) {
|
||||
if (auth->method == AUTH_IPSEC_MANUAL_ESP)
|
||||
method = "esp";
|
||||
else
|
||||
method = "ah";
|
||||
|
||||
printf("%s\tipsec %s in spi %u %s XXXXXX", c, method,
|
||||
auth->spi_in, print_auth_alg(auth->auth_alg_in));
|
||||
if (auth->enc_alg_in)
|
||||
printf(" %s XXXXXX", print_enc_alg(auth->enc_alg_in));
|
||||
printf("\n");
|
||||
|
||||
printf("%s\tipsec %s out spi %u %s XXXXXX", c, method,
|
||||
auth->spi_out, print_auth_alg(auth->auth_alg_out));
|
||||
if (auth->enc_alg_out)
|
||||
printf(" %s XXXXXX",
|
||||
print_enc_alg(auth->enc_alg_out));
|
||||
printf("\n");
|
||||
} else if (auth->method == AUTH_IPSEC_IKE_AH)
|
||||
printf("%s\tipsec ah ike\n", c);
|
||||
else if (auth->method == AUTH_IPSEC_IKE_ESP)
|
||||
printf("%s\tipsec esp ike\n", c);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
print_rtrs(struct rtr_config_head *rh)
|
||||
{
|
||||
|
@ -723,6 +756,7 @@ print_rtrs(struct rtr_config_head *rh)
|
|||
printf("\tport %u\n", r->remote_port);
|
||||
if (r->local_addr.aid != AID_UNSPEC)
|
||||
printf("local-addr %s\n", log_addr(&r->local_addr));
|
||||
print_auth(&r->auth, "");
|
||||
printf("}\n\n");
|
||||
}
|
||||
}
|
||||
|
@ -731,9 +765,7 @@ void
|
|||
print_peer(struct peer *peer, struct bgpd_config *conf, const char *c)
|
||||
{
|
||||
struct in_addr ina;
|
||||
char *method;
|
||||
struct peer_config *p = &peer->conf;
|
||||
struct auth_config *auth = &peer->auth_conf;
|
||||
|
||||
if ((p->remote_addr.aid == AID_INET && p->remote_masklen != 32) ||
|
||||
(p->remote_addr.aid == AID_INET6 && p->remote_masklen != 128))
|
||||
|
@ -832,31 +864,7 @@ print_peer(struct peer *peer, struct bgpd_config *conf, const char *c)
|
|||
if (p->flags & PEERFLAG_LOG_UPDATES)
|
||||
printf("%s\tlog updates\n", c);
|
||||
|
||||
if (auth->method == AUTH_MD5SIG)
|
||||
printf("%s\ttcp md5sig\n", c);
|
||||
else if (auth->method == AUTH_IPSEC_MANUAL_ESP ||
|
||||
auth->method == AUTH_IPSEC_MANUAL_AH) {
|
||||
if (auth->method == AUTH_IPSEC_MANUAL_ESP)
|
||||
method = "esp";
|
||||
else
|
||||
method = "ah";
|
||||
|
||||
printf("%s\tipsec %s in spi %u %s XXXXXX", c, method,
|
||||
auth->spi_in, print_auth_alg(auth->auth_alg_in));
|
||||
if (auth->enc_alg_in)
|
||||
printf(" %s XXXXXX", print_enc_alg(auth->enc_alg_in));
|
||||
printf("\n");
|
||||
|
||||
printf("%s\tipsec %s out spi %u %s XXXXXX", c, method,
|
||||
auth->spi_out, print_auth_alg(auth->auth_alg_out));
|
||||
if (auth->enc_alg_out)
|
||||
printf(" %s XXXXXX",
|
||||
print_enc_alg(auth->enc_alg_out));
|
||||
printf("\n");
|
||||
} else if (auth->method == AUTH_IPSEC_IKE_AH)
|
||||
printf("%s\tipsec ah ike\n", c);
|
||||
else if (auth->method == AUTH_IPSEC_IKE_ESP)
|
||||
printf("%s\tipsec esp ike\n", c);
|
||||
print_auth(&peer->auth_conf, c);
|
||||
|
||||
if (p->ttlsec)
|
||||
printf("%s\tttl-security yes\n", c);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rtr.c,v 1.23 2024/09/10 08:37:52 claudio Exp $ */
|
||||
/* $OpenBSD: rtr.c,v 1.24 2024/10/08 12:28:09 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
|
@ -338,15 +338,15 @@ rtr_dispatch_imsg_parent(struct imsgbuf *imsgbuf)
|
|||
fatal(NULL);
|
||||
imsg_init(ibuf_rde, fd);
|
||||
break;
|
||||
case IMSG_SOCKET_CONN:
|
||||
case IMSG_SOCKET_SETUP:
|
||||
if ((fd = imsg_get_fd(&imsg)) == -1) {
|
||||
log_warnx("expected to receive imsg fd "
|
||||
"but didn't receive any");
|
||||
break;
|
||||
}
|
||||
if ((rs = rtr_get(rtrid)) == NULL) {
|
||||
log_warnx("IMSG_SOCKET_CONN: unknown rtr id %d",
|
||||
rtrid);
|
||||
log_warnx("IMSG_SOCKET_SETUP: "
|
||||
"unknown rtr id %d", rtrid);
|
||||
close(fd);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rtr_proto.c,v 1.40 2024/09/10 08:41:13 claudio Exp $ */
|
||||
/* $OpenBSD: rtr_proto.c,v 1.41 2024/10/08 12:28:09 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
|
@ -1130,6 +1130,8 @@ rtr_fsm(struct rtr_session *rs, enum rtr_event event)
|
|||
rs->r.wpos = 0;
|
||||
close(rs->fd);
|
||||
rs->fd = -1;
|
||||
rtr_imsg_compose(IMSG_SOCKET_TEARDOWN, rs->id, 0,
|
||||
NULL, 0);
|
||||
}
|
||||
/* try to reopen session */
|
||||
if (!rs->errored)
|
||||
|
@ -1158,7 +1160,7 @@ rtr_fsm(struct rtr_session *rs, enum rtr_event event)
|
|||
case RTR_STATE_CLOSED:
|
||||
case RTR_STATE_NEGOTIATION:
|
||||
timer_set(&rs->timers, Timer_Rtr_Retry, rs->retry);
|
||||
rtr_imsg_compose(IMSG_SOCKET_CONN, rs->id, 0, NULL, 0);
|
||||
rtr_imsg_compose(IMSG_SOCKET_SETUP, rs->id, 0, NULL, 0);
|
||||
break;
|
||||
case RTR_STATE_ESTABLISHED:
|
||||
if (rs->session_id == -1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: httpd.h,v 1.164 2023/11/08 19:19:10 millert Exp $ */
|
||||
/* $OpenBSD: httpd.h,v 1.165 2024/10/08 05:28:11 jsg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
|
||||
|
@ -165,11 +165,6 @@ struct control_sock {
|
|||
};
|
||||
TAILQ_HEAD(control_socks, control_sock);
|
||||
|
||||
extern struct {
|
||||
struct event ev;
|
||||
int fd;
|
||||
} control_state;
|
||||
|
||||
struct imsgev {
|
||||
struct imsgbuf ibuf;
|
||||
void (*handler)(int, short, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: relayd.h,v 1.274 2024/08/10 05:47:29 tb Exp $ */
|
||||
/* $OpenBSD: relayd.h,v 1.275 2024/10/08 05:28:11 jsg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
|
||||
|
@ -913,11 +913,6 @@ struct control_sock {
|
|||
};
|
||||
TAILQ_HEAD(control_socks, control_sock);
|
||||
|
||||
extern struct {
|
||||
struct event ev;
|
||||
int fd;
|
||||
} control_state;
|
||||
|
||||
struct imsgev {
|
||||
struct imsgbuf ibuf;
|
||||
void (*handler)(int, short, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: parse_netgroup.c,v 1.14 2022/12/28 21:30:19 jmc Exp $ */
|
||||
/* $OpenBSD: parse_netgroup.c,v 1.15 2024/10/09 01:52:11 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -302,38 +302,38 @@ read_for_group(char *group)
|
|||
*(lp->l_groupname + len) = '\0';
|
||||
len = strlen(pos);
|
||||
olen = 0;
|
||||
/*
|
||||
* Loop around handling line continuations.
|
||||
*/
|
||||
do {
|
||||
if (*(pos + len - 1) == '\n')
|
||||
len--;
|
||||
if (*(pos + len - 1) == '\\') {
|
||||
len--;
|
||||
cont = 1;
|
||||
/*
|
||||
* Loop around handling line continuations.
|
||||
*/
|
||||
do {
|
||||
if (*(pos + len - 1) == '\n')
|
||||
len--;
|
||||
if (*(pos + len - 1) == '\\') {
|
||||
len--;
|
||||
cont = 1;
|
||||
} else
|
||||
cont = 0;
|
||||
if (len > 0) {
|
||||
linep = malloc(olen + len + 1);
|
||||
if (olen > 0) {
|
||||
bcopy(olinep, linep, olen);
|
||||
free(olinep);
|
||||
}
|
||||
bcopy(pos, linep + olen, len);
|
||||
olen += len;
|
||||
*(linep + olen) = '\0';
|
||||
olinep = linep;
|
||||
}
|
||||
#ifdef CANT_HAPPEN
|
||||
if (cont) {
|
||||
if (fgets(line, sizeof(line), netf)) {
|
||||
pos = line;
|
||||
len = strlen(pos);
|
||||
} else
|
||||
cont = 0;
|
||||
if (len > 0) {
|
||||
linep = malloc(olen + len + 1);
|
||||
if (olen > 0) {
|
||||
bcopy(olinep, linep, olen);
|
||||
free(olinep);
|
||||
}
|
||||
bcopy(pos, linep + olen, len);
|
||||
olen += len;
|
||||
*(linep + olen) = '\0';
|
||||
olinep = linep;
|
||||
}
|
||||
#ifdef CANT_HAPPEN
|
||||
if (cont) {
|
||||
if (fgets(line, sizeof(line), netf)) {
|
||||
pos = line;
|
||||
len = strlen(pos);
|
||||
} else
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} while (cont);
|
||||
} while (cont);
|
||||
lp->l_line = linep;
|
||||
lp->l_next = linehead;
|
||||
linehead = lp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue