sync with OpenBSD -current
This commit is contained in:
parent
caadbe0d20
commit
ffd019c293
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: conf_mod.c,v 1.28 2023/07/20 15:05:30 tb Exp $ */
|
||||
/* $OpenBSD: conf_mod.c,v 1.36 2024/03/20 22:11:07 tb Exp $ */
|
||||
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2001.
|
||||
*/
|
||||
@ -86,7 +86,7 @@ struct conf_module_st {
|
||||
*/
|
||||
|
||||
struct conf_imodule_st {
|
||||
CONF_MODULE *pmod;
|
||||
CONF_MODULE *mod;
|
||||
char *name;
|
||||
char *value;
|
||||
unsigned long flags;
|
||||
@ -96,14 +96,15 @@ struct conf_imodule_st {
|
||||
static STACK_OF(CONF_MODULE) *supported_modules = NULL;
|
||||
static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
|
||||
|
||||
static void module_free(CONF_MODULE *md);
|
||||
static void module_free(CONF_MODULE *mod);
|
||||
static void imodule_free(CONF_IMODULE *imod);
|
||||
static void module_finish(CONF_IMODULE *imod);
|
||||
static int module_run(const CONF *cnf, char *name, char *value,
|
||||
unsigned long flags);
|
||||
static CONF_MODULE *module_add(const char *name, conf_init_func *ifunc,
|
||||
static int module_add(const char *name, conf_init_func *ifunc,
|
||||
conf_finish_func *ffunc);
|
||||
static CONF_MODULE *module_find(char *name);
|
||||
static int module_init(CONF_MODULE *pmod, char *name, char *value,
|
||||
static int module_init(CONF_MODULE *mod, char *name, char *value,
|
||||
const CONF *cnf);
|
||||
|
||||
/* Main function: load modules from a CONF structure */
|
||||
@ -188,10 +189,10 @@ err:
|
||||
static int
|
||||
module_run(const CONF *cnf, char *name, char *value, unsigned long flags)
|
||||
{
|
||||
CONF_MODULE *md;
|
||||
CONF_MODULE *mod;
|
||||
int ret;
|
||||
|
||||
if ((md = module_find(name)) == NULL) {
|
||||
if ((mod = module_find(name)) == NULL) {
|
||||
if (!(flags & CONF_MFLAGS_SILENT)) {
|
||||
CONFerror(CONF_R_UNKNOWN_MODULE_NAME);
|
||||
ERR_asprintf_error_data("module=%s", name);
|
||||
@ -199,7 +200,7 @@ module_run(const CONF *cnf, char *name, char *value, unsigned long flags)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = module_init(md, name, value, cnf);
|
||||
ret = module_init(mod, name, value, cnf);
|
||||
|
||||
if (ret <= 0) {
|
||||
if (!(flags & CONF_MFLAGS_SILENT)) {
|
||||
@ -213,33 +214,37 @@ module_run(const CONF *cnf, char *name, char *value, unsigned long flags)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* add module to list */
|
||||
static CONF_MODULE *
|
||||
static int
|
||||
module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc)
|
||||
{
|
||||
CONF_MODULE *tmod = NULL;
|
||||
CONF_MODULE *mod = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
goto err;
|
||||
|
||||
if (supported_modules == NULL)
|
||||
supported_modules = sk_CONF_MODULE_new_null();
|
||||
if (supported_modules == NULL)
|
||||
return NULL;
|
||||
tmod = malloc(sizeof(CONF_MODULE));
|
||||
if (tmod == NULL)
|
||||
return NULL;
|
||||
goto err;
|
||||
|
||||
tmod->name = strdup(name);
|
||||
tmod->init = ifunc;
|
||||
tmod->finish = ffunc;
|
||||
tmod->links = 0;
|
||||
if ((mod = calloc(1, sizeof(*mod))) == NULL)
|
||||
goto err;
|
||||
if ((mod->name = strdup(name)) == NULL)
|
||||
goto err;
|
||||
mod->init = ifunc;
|
||||
mod->finish = ffunc;
|
||||
|
||||
if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
|
||||
free(tmod);
|
||||
return NULL;
|
||||
}
|
||||
if (!sk_CONF_MODULE_push(supported_modules, mod))
|
||||
goto err;
|
||||
mod = NULL;
|
||||
|
||||
return tmod;
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
module_free(mod);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Find a module from the list. We allow module names of the
|
||||
@ -250,7 +255,7 @@ module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc)
|
||||
static CONF_MODULE *
|
||||
module_find(char *name)
|
||||
{
|
||||
CONF_MODULE *tmod;
|
||||
CONF_MODULE *mod;
|
||||
int i, nchar;
|
||||
char *p;
|
||||
|
||||
@ -262,9 +267,9 @@ module_find(char *name)
|
||||
nchar = strlen(name);
|
||||
|
||||
for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) {
|
||||
tmod = sk_CONF_MODULE_value(supported_modules, i);
|
||||
if (!strncmp(tmod->name, name, nchar))
|
||||
return tmod;
|
||||
mod = sk_CONF_MODULE_value(supported_modules, i);
|
||||
if (!strncmp(mod->name, name, nchar))
|
||||
return mod;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -272,7 +277,7 @@ module_find(char *name)
|
||||
|
||||
/* initialize a module */
|
||||
static int
|
||||
module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf)
|
||||
module_init(CONF_MODULE *mod, char *name, char *value, const CONF *cnf)
|
||||
{
|
||||
int ret = 1;
|
||||
int init_called = 0;
|
||||
@ -283,7 +288,7 @@ module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf)
|
||||
if (!imod)
|
||||
goto err;
|
||||
|
||||
imod->pmod = pmod;
|
||||
imod->mod = mod;
|
||||
imod->name = name ? strdup(name) : NULL;
|
||||
imod->value = value ? strdup(value) : NULL;
|
||||
imod->usr_data = NULL;
|
||||
@ -292,8 +297,8 @@ module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf)
|
||||
goto memerr;
|
||||
|
||||
/* Try to initialize module */
|
||||
if (pmod->init) {
|
||||
ret = pmod->init(imod, cnf);
|
||||
if (mod->init) {
|
||||
ret = mod->init(imod, cnf);
|
||||
init_called = 1;
|
||||
/* Error occurred, exit */
|
||||
if (ret <= 0)
|
||||
@ -313,14 +318,14 @@ module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf)
|
||||
goto err;
|
||||
}
|
||||
|
||||
pmod->links++;
|
||||
mod->links++;
|
||||
|
||||
return ret;
|
||||
|
||||
err:
|
||||
/* We've started the module so we'd better finish it */
|
||||
if (pmod->finish && init_called)
|
||||
pmod->finish(imod);
|
||||
if (mod->finish && init_called)
|
||||
mod->finish(imod);
|
||||
|
||||
memerr:
|
||||
if (imod) {
|
||||
@ -341,18 +346,18 @@ void
|
||||
CONF_modules_unload(int all)
|
||||
{
|
||||
int i;
|
||||
CONF_MODULE *md;
|
||||
CONF_MODULE *mod;
|
||||
|
||||
CONF_modules_finish();
|
||||
|
||||
/* unload modules in reverse order */
|
||||
for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
|
||||
md = sk_CONF_MODULE_value(supported_modules, i);
|
||||
mod = sk_CONF_MODULE_value(supported_modules, i);
|
||||
if (!all)
|
||||
continue;
|
||||
/* Since we're working in reverse this is OK */
|
||||
(void)sk_CONF_MODULE_delete(supported_modules, i);
|
||||
module_free(md);
|
||||
module_free(mod);
|
||||
}
|
||||
if (sk_CONF_MODULE_num(supported_modules) == 0) {
|
||||
sk_CONF_MODULE_free(supported_modules);
|
||||
@ -362,10 +367,24 @@ CONF_modules_unload(int all)
|
||||
|
||||
/* unload a single module */
|
||||
static void
|
||||
module_free(CONF_MODULE *md)
|
||||
module_free(CONF_MODULE *mod)
|
||||
{
|
||||
free(md->name);
|
||||
free(md);
|
||||
if (mod == NULL)
|
||||
return;
|
||||
|
||||
free(mod->name);
|
||||
free(mod);
|
||||
}
|
||||
|
||||
static void
|
||||
imodule_free(CONF_IMODULE *imod)
|
||||
{
|
||||
if (imod == NULL)
|
||||
return;
|
||||
|
||||
free(imod->name);
|
||||
free(imod->value);
|
||||
free(imod);
|
||||
}
|
||||
|
||||
/* finish and free up all modules instances */
|
||||
@ -388,12 +407,11 @@ CONF_modules_finish(void)
|
||||
static void
|
||||
module_finish(CONF_IMODULE *imod)
|
||||
{
|
||||
if (imod->pmod->finish)
|
||||
imod->pmod->finish(imod);
|
||||
imod->pmod->links--;
|
||||
free(imod->name);
|
||||
free(imod->value);
|
||||
free(imod);
|
||||
if (imod->mod->finish)
|
||||
imod->mod->finish(imod);
|
||||
imod->mod->links--;
|
||||
|
||||
imodule_free(imod);
|
||||
}
|
||||
|
||||
/* Add a static module to OpenSSL */
|
||||
@ -401,7 +419,7 @@ module_finish(CONF_IMODULE *imod)
|
||||
int
|
||||
CONF_module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc)
|
||||
{
|
||||
return module_add(name, ifunc, ffunc) != NULL;
|
||||
return module_add(name, ifunc, ffunc);
|
||||
}
|
||||
|
||||
void
|
||||
@ -414,57 +432,57 @@ CONF_modules_free(void)
|
||||
/* Utility functions */
|
||||
|
||||
const char *
|
||||
CONF_imodule_get_name(const CONF_IMODULE *md)
|
||||
CONF_imodule_get_name(const CONF_IMODULE *imod)
|
||||
{
|
||||
return md->name;
|
||||
return imod->name;
|
||||
}
|
||||
|
||||
const char *
|
||||
CONF_imodule_get_value(const CONF_IMODULE *md)
|
||||
CONF_imodule_get_value(const CONF_IMODULE *imod)
|
||||
{
|
||||
return md->value;
|
||||
return imod->value;
|
||||
}
|
||||
|
||||
void *
|
||||
CONF_imodule_get_usr_data(const CONF_IMODULE *md)
|
||||
CONF_imodule_get_usr_data(const CONF_IMODULE *imod)
|
||||
{
|
||||
return md->usr_data;
|
||||
return imod->usr_data;
|
||||
}
|
||||
|
||||
void
|
||||
CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data)
|
||||
CONF_imodule_set_usr_data(CONF_IMODULE *imod, void *usr_data)
|
||||
{
|
||||
md->usr_data = usr_data;
|
||||
imod->usr_data = usr_data;
|
||||
}
|
||||
|
||||
CONF_MODULE *
|
||||
CONF_imodule_get_module(const CONF_IMODULE *md)
|
||||
CONF_imodule_get_module(const CONF_IMODULE *imod)
|
||||
{
|
||||
return md->pmod;
|
||||
return imod->mod;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
CONF_imodule_get_flags(const CONF_IMODULE *md)
|
||||
CONF_imodule_get_flags(const CONF_IMODULE *imod)
|
||||
{
|
||||
return md->flags;
|
||||
return imod->flags;
|
||||
}
|
||||
|
||||
void
|
||||
CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags)
|
||||
CONF_imodule_set_flags(CONF_IMODULE *imod, unsigned long flags)
|
||||
{
|
||||
md->flags = flags;
|
||||
imod->flags = flags;
|
||||
}
|
||||
|
||||
void *
|
||||
CONF_module_get_usr_data(CONF_MODULE *pmod)
|
||||
CONF_module_get_usr_data(CONF_MODULE *mod)
|
||||
{
|
||||
return pmod->usr_data;
|
||||
return mod->usr_data;
|
||||
}
|
||||
|
||||
void
|
||||
CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data)
|
||||
CONF_module_set_usr_data(CONF_MODULE *mod, void *usr_data)
|
||||
{
|
||||
pmod->usr_data = usr_data;
|
||||
mod->usr_data = usr_data;
|
||||
}
|
||||
|
||||
/* Return default config file name */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.3 2022/01/07 09:07:00 tb Exp $
|
||||
# $OpenBSD: Makefile,v 1.4 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= dtlstest
|
||||
LDADD= ${SSL_INT} -lcrypto
|
||||
@ -11,10 +11,11 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libssl
|
||||
REGRESS_TARGETS= \
|
||||
regress-dtlstest
|
||||
|
||||
# XXX(jsing): use CA root and chain
|
||||
regress-dtlstest: ${PROG}
|
||||
./dtlstest \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca-int-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2022/10/02 16:40:56 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= quictest
|
||||
LDADD= -lssl -lcrypto
|
||||
@ -12,8 +12,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-quictest: ${PROG}
|
||||
./quictest \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa-chain.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2020/05/11 18:18:21 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= servertest
|
||||
LDADD= ${SSL_INT} -lcrypto
|
||||
@ -11,8 +11,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-servertest: ${PROG}
|
||||
./servertest \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa-chain.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.1 2024/01/19 08:29:08 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.2 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= shutdowntest
|
||||
LDADD= -lssl -lcrypto
|
||||
@ -11,8 +11,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-shutdowntest: ${PROG}
|
||||
./shutdowntest \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa-chain.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.1 2021/10/23 14:34:10 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.2 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= tlstest
|
||||
LDADD= -lssl -lcrypto
|
||||
@ -11,8 +11,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-tlstest: ${PROG}
|
||||
./tlstest \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa-chain.pem \
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ssl_get_shared_ciphers.c,v 1.11 2022/02/05 18:19:39 tb Exp $ */
|
||||
/* $OpenBSD: ssl_get_shared_ciphers.c,v 1.12 2024/03/20 10:38:05 jsing Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
|
||||
*
|
||||
@ -462,7 +462,7 @@ main(int argc, char **argv)
|
||||
size_t i;
|
||||
int failed = 0;
|
||||
|
||||
if (asprintf(&server_cert, "%s/server.pem", CERTSDIR) == -1) {
|
||||
if (asprintf(&server_cert, "%s/server1-rsa.pem", CERTSDIR) == -1) {
|
||||
fprintf(stderr, "asprintf server_cert failed\n");
|
||||
failed = 1;
|
||||
goto err;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.1 2018/02/08 10:06:52 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.2 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= keypairtest
|
||||
LDADD= -lcrypto -lssl ${TLS_INT}
|
||||
@ -13,8 +13,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-keypairtest: ${PROG}
|
||||
./keypairtest \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: keypairtest.c,v 1.6 2022/02/08 18:05:57 tb Exp $ */
|
||||
/* $OpenBSD: keypairtest.c,v 1.7 2024/03/20 10:38:05 jsing Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
@ -29,7 +29,7 @@
|
||||
#include <tls_internal.h>
|
||||
|
||||
#define PUBKEY_HASH \
|
||||
"SHA256:858d0f94beb0a08eb4f13871ba57bf0a2e081287d0efbaeb3bbac59dd8f1a8e5"
|
||||
"SHA256:f03c535d374614e7356c0a4e6fd37fe94297b60ed86212adcba40e8e0b07bc9f"
|
||||
|
||||
char *cert_file, *key_file, *ocsp_staple_file;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2017/05/06 21:56:43 jsing Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2024/03/20 10:38:05 jsing Exp $
|
||||
|
||||
PROG= tlstest
|
||||
LDADD= -lcrypto -lssl -ltls
|
||||
@ -12,8 +12,8 @@ REGRESS_TARGETS= \
|
||||
|
||||
regress-tlstest: ${PROG}
|
||||
./tlstest \
|
||||
${.CURDIR}/../../libssl/certs/ca.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem \
|
||||
${.CURDIR}/../../libssl/certs/server.pem
|
||||
${.CURDIR}/../../libssl/certs/ca-root-rsa.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa-chain.pem \
|
||||
${.CURDIR}/../../libssl/certs/server1-rsa.pem
|
||||
|
||||
.include <bsd.regress.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-aspa.c,v 1.6 2023/09/25 11:09:30 tb Exp $ */
|
||||
/* $Id: test-aspa.c,v 1.7 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Job Snijders <job@fastly.com>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-gbr.c,v 1.16 2023/09/25 11:09:30 tb Exp $ */
|
||||
/* $Id: test-gbr.c,v 1.17 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-mft.c,v 1.27 2023/09/25 11:09:30 tb Exp $ */
|
||||
/* $Id: test-mft.c,v 1.28 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-roa.c,v 1.24 2023/09/25 11:09:30 tb Exp $ */
|
||||
/* $Id: test-roa.c,v 1.25 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-spl.c,v 1.1 2024/02/22 12:51:50 job Exp $ */
|
||||
/* $Id: test-spl.c,v 1.2 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2024 Job Snijders <job@fastly.com>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: test-tak.c,v 1.6 2023/09/25 11:09:30 tb Exp $ */
|
||||
/* $Id: test-tak.c,v 1.7 2024/03/20 04:39:10 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Job Snijders <job@fastly.com>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
int outformats;
|
||||
int verbose;
|
||||
int filemode;
|
||||
int filemode = 1;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: drm_linux.c,v 1.109 2024/01/21 13:36:40 kettenis Exp $ */
|
||||
/* $OpenBSD: drm_linux.c,v 1.111 2024/03/20 02:42:17 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
|
||||
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
|
||||
@ -673,6 +673,28 @@ vmap(struct vm_page **pages, unsigned int npages, unsigned long flags,
|
||||
return (void *)va;
|
||||
}
|
||||
|
||||
void *
|
||||
vmap_pfn(unsigned long *pfns, unsigned int npfn, pgprot_t prot)
|
||||
{
|
||||
vaddr_t va;
|
||||
paddr_t pa;
|
||||
int i;
|
||||
|
||||
va = (vaddr_t)km_alloc(PAGE_SIZE * npfn, &kv_any, &kp_none,
|
||||
&kd_nowait);
|
||||
if (va == 0)
|
||||
return NULL;
|
||||
for (i = 0; i < npfn; i++) {
|
||||
pa = round_page(pfns[i]) | prot;
|
||||
pmap_enter(pmap_kernel(), va + (i * PAGE_SIZE), pa,
|
||||
PROT_READ | PROT_WRITE,
|
||||
PROT_READ | PROT_WRITE | PMAP_WIRED);
|
||||
pmap_update(pmap_kernel());
|
||||
}
|
||||
|
||||
return (void *)va;
|
||||
}
|
||||
|
||||
void
|
||||
vunmap(void *addr, size_t size)
|
||||
{
|
||||
@ -1302,7 +1324,8 @@ vga_disable_bridge(struct pci_attach_args *pa)
|
||||
void
|
||||
vga_get_uninterruptible(struct pci_dev *pdev, int rsrc)
|
||||
{
|
||||
KASSERT(pdev->pci->sc_bridgetag == NULL);
|
||||
if (pdev->pci->sc_bridgetag != NULL)
|
||||
return;
|
||||
pci_enumerate_bus(pdev->pci, vga_disable_bridge, NULL);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,6 @@
|
||||
|
||||
#include <drm/drm_syncobj.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/agpvar.h>
|
||||
|
||||
#include "display/intel_frontbuffer.h"
|
||||
|
||||
#include "gem/i915_gem_ioctls.h"
|
||||
@ -294,10 +291,6 @@ struct i915_execbuffer {
|
||||
bool has_llc : 1;
|
||||
bool has_fence : 1;
|
||||
bool needs_unfenced : 1;
|
||||
|
||||
struct agp_map *map;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
} reloc_cache;
|
||||
|
||||
u64 invalid_flags; /** Set of execobj.flags that are invalid */
|
||||
@ -1133,9 +1126,6 @@ static void reloc_cache_init(struct reloc_cache *cache,
|
||||
cache->has_fence = cache->graphics_ver < 4;
|
||||
cache->needs_unfenced = INTEL_INFO(i915)->unfenced_needs_alignment;
|
||||
cache->node.flags = 0;
|
||||
|
||||
cache->map = i915->agph;
|
||||
cache->iot = i915->bst;
|
||||
}
|
||||
|
||||
static inline void *unmask_page(unsigned long p)
|
||||
@ -1168,11 +1158,7 @@ static void reloc_cache_unmap(struct reloc_cache *cache)
|
||||
if (cache->vaddr & KMAP)
|
||||
kunmap_atomic(vaddr);
|
||||
else
|
||||
#ifdef __linux__
|
||||
io_mapping_unmap_atomic((void __iomem *)vaddr);
|
||||
#else
|
||||
agp_unmap_atomic(cache->map, cache->ioh);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void reloc_cache_remap(struct reloc_cache *cache,
|
||||
@ -1197,14 +1183,8 @@ static void reloc_cache_remap(struct reloc_cache *cache,
|
||||
if (!drm_mm_node_allocated(&cache->node))
|
||||
offset += cache->page << PAGE_SHIFT;
|
||||
|
||||
#ifdef __linux__
|
||||
cache->vaddr = (unsigned long)
|
||||
io_mapping_map_atomic_wc(&ggtt->iomap, offset);
|
||||
#else
|
||||
agp_map_atomic(cache->map, offset, &cache->ioh);
|
||||
cache->vaddr = (unsigned long)
|
||||
bus_space_vaddr(cache->iot, cache->ioh);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1228,11 +1208,7 @@ static void reloc_cache_reset(struct reloc_cache *cache, struct i915_execbuffer
|
||||
struct i915_ggtt *ggtt = cache_to_ggtt(cache);
|
||||
|
||||
intel_gt_flush_ggtt_writes(ggtt->vm.gt);
|
||||
#ifdef __linux__
|
||||
io_mapping_unmap_atomic((void __iomem *)vaddr);
|
||||
#else
|
||||
agp_unmap_atomic(cache->map, cache->ioh);
|
||||
#endif
|
||||
|
||||
if (drm_mm_node_allocated(&cache->node)) {
|
||||
ggtt->vm.clear_range(&ggtt->vm,
|
||||
@ -1299,11 +1275,7 @@ static void *reloc_iomap(struct i915_vma *batch,
|
||||
|
||||
if (cache->vaddr) {
|
||||
intel_gt_flush_ggtt_writes(ggtt->vm.gt);
|
||||
#ifdef __linux__
|
||||
io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr));
|
||||
#else
|
||||
agp_unmap_atomic(cache->map, cache->ioh);
|
||||
#endif
|
||||
} else {
|
||||
struct i915_vma *vma = ERR_PTR(-ENODEV);
|
||||
int err;
|
||||
@ -1365,13 +1337,8 @@ static void *reloc_iomap(struct i915_vma *batch,
|
||||
offset += page << PAGE_SHIFT;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
vaddr = (void __force *)io_mapping_map_atomic_wc(&ggtt->iomap,
|
||||
offset);
|
||||
#else
|
||||
agp_map_atomic(cache->map, offset, &cache->ioh);
|
||||
vaddr = bus_space_vaddr(cache->iot, cache->ioh);
|
||||
#endif
|
||||
cache->page = page;
|
||||
cache->vaddr = (unsigned long)vaddr;
|
||||
|
||||
|
@ -15,9 +15,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
|
||||
unsigned long n,
|
||||
unsigned long size)
|
||||
{
|
||||
STUB();
|
||||
return NULL;
|
||||
#ifdef notyet
|
||||
resource_size_t offset;
|
||||
|
||||
GEM_BUG_ON(!i915_gem_object_is_contiguous(obj));
|
||||
@ -26,7 +23,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
|
||||
offset -= obj->mm.region->region.start;
|
||||
|
||||
return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -521,8 +521,6 @@ i915_gem_object_read_from_page_kmap(struct drm_i915_gem_object *obj, u64 offset,
|
||||
static void
|
||||
i915_gem_object_read_from_page_iomap(struct drm_i915_gem_object *obj, u64 offset, void *dst, int size)
|
||||
{
|
||||
STUB();
|
||||
#ifdef notyet
|
||||
pgoff_t idx = offset >> PAGE_SHIFT;
|
||||
dma_addr_t dma = i915_gem_object_get_dma_address(obj, idx);
|
||||
void __iomem *src_map;
|
||||
@ -537,7 +535,6 @@ i915_gem_object_read_from_page_iomap(struct drm_i915_gem_object *obj, u64 offset
|
||||
memcpy_fromio(dst, src_ptr, size);
|
||||
|
||||
io_mapping_unmap(src_map);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool object_has_mappable_iomem(struct drm_i915_gem_object *obj)
|
||||
|
@ -329,9 +329,6 @@ static void *i915_gem_object_map_page(struct drm_i915_gem_object *obj,
|
||||
static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
|
||||
enum i915_map_type type)
|
||||
{
|
||||
STUB();
|
||||
return NULL;
|
||||
#ifdef notyet
|
||||
resource_size_t iomap = obj->mm.region->iomap.base -
|
||||
obj->mm.region->region.start;
|
||||
unsigned long n_pfn = obj->base.size >> PAGE_SHIFT;
|
||||
@ -357,76 +354,6 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
|
||||
kvfree(pfns);
|
||||
|
||||
return vaddr ?: ERR_PTR(-ENOMEM);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
|
||||
enum i915_map_type type)
|
||||
{
|
||||
unsigned long n_pages = obj->base.size >> PAGE_SHIFT;
|
||||
struct sg_table *sgt = obj->mm.pages;
|
||||
struct vm_page *stack_pages[32];
|
||||
struct vm_page **pages = stack_pages;
|
||||
struct vm_struct *area;
|
||||
pgprot_t pgprot;
|
||||
void *addr;
|
||||
|
||||
if (!i915_gem_object_has_struct_page(obj) && type != I915_MAP_WC)
|
||||
return NULL;
|
||||
|
||||
#if 0
|
||||
/* A single page can always be kmapped */
|
||||
if (n_pages == 1 && type == I915_MAP_WB)
|
||||
return kmap(sg_page(sgt->sgl));
|
||||
#endif
|
||||
|
||||
if (n_pages > ARRAY_SIZE(stack_pages)) {
|
||||
/* Too big for stack -- allocate temporary array instead */
|
||||
pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL);
|
||||
if (!pages)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
MISSING_CASE(type);
|
||||
/* fallthrough - to use PAGE_KERNEL anyway */
|
||||
case I915_MAP_WB:
|
||||
pgprot = PAGE_KERNEL;
|
||||
break;
|
||||
case I915_MAP_WC:
|
||||
pgprot = pgprot_writecombine(PAGE_KERNEL_IO);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i915_gem_object_has_struct_page(obj)) {
|
||||
struct sgt_iter iter;
|
||||
struct vm_page *page;
|
||||
unsigned long i = 0;
|
||||
|
||||
for_each_sgt_page(page, iter, sgt)
|
||||
pages[i++] = page;
|
||||
} else {
|
||||
STUB();
|
||||
#ifdef notyet
|
||||
resource_size_t iomap;
|
||||
struct sgt_iter iter;
|
||||
pte_t **ptes = mem;
|
||||
dma_addr_t addr;
|
||||
|
||||
iomap = obj->mm.region->iomap.base;
|
||||
iomap -= obj->mm.region->region.start;
|
||||
|
||||
for_each_sgt_daddr(addr, iter, sgt)
|
||||
**ptes++ = iomap_pte(iomap, addr, pgprot);
|
||||
#endif
|
||||
}
|
||||
addr = vmap(pages, n_pages, 0, pgprot);
|
||||
|
||||
if (pages != stack_pages)
|
||||
kvfree(pages);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* get, pin, and map the pages of the object into kernel space */
|
||||
|
@ -821,19 +821,41 @@ static int init_stolen_lmem(struct intel_memory_region *mem)
|
||||
return 0;
|
||||
}
|
||||
|
||||
STUB();
|
||||
return -ENOSYS;
|
||||
#ifdef notyet
|
||||
#ifdef __linux__
|
||||
if (mem->io_size &&
|
||||
!io_mapping_init_wc(&mem->iomap, mem->io_start, mem->io_size))
|
||||
goto err_cleanup;
|
||||
#else
|
||||
if (mem->io_size) {
|
||||
paddr_t start, end;
|
||||
struct vm_page *pgs;
|
||||
int i;
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
start = atop(mem->io_start);
|
||||
end = start + atop(mem->io_size);
|
||||
uvm_page_physload(start, end, start, end, PHYSLOAD_DEVICE);
|
||||
|
||||
pgs = PHYS_TO_VM_PAGE(mem->io_start);
|
||||
for (i = 0; i < atop(mem->io_size); i++)
|
||||
atomic_setbits_int(&(pgs[i].pg_flags), PG_PMAP_WC);
|
||||
|
||||
if (bus_space_map(i915->bst, mem->io_start, mem->io_size,
|
||||
BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh))
|
||||
panic("can't map stolen lmem");
|
||||
|
||||
mem->iomap.base = mem->io_start;
|
||||
mem->iomap.size = mem->io_size;
|
||||
mem->iomap.iomem = bus_space_vaddr(i915->bst, bsh);
|
||||
}
|
||||
#endif
|
||||
|
||||
drm_dbg(&i915->drm, "Stolen Local memory IO start: %pa\n",
|
||||
&mem->io_start);
|
||||
drm_dbg(&i915->drm, "Stolen Local DSM base: %pa\n", &mem->region.start);
|
||||
|
||||
return 0;
|
||||
|
||||
#ifdef __linux__
|
||||
err_cleanup:
|
||||
i915_gem_cleanup_stolen(mem->i915);
|
||||
return err;
|
||||
|
@ -715,9 +715,6 @@ static int i915_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource
|
||||
static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
|
||||
unsigned long page_offset)
|
||||
{
|
||||
STUB();
|
||||
return 0;
|
||||
#ifdef notyet
|
||||
struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
|
||||
struct scatterlist *sg;
|
||||
unsigned long base;
|
||||
@ -730,7 +727,6 @@ static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
|
||||
sg = i915_gem_object_page_iter_get_sg(obj, &obj->ttm.get_io_page, page_offset, &ofs);
|
||||
|
||||
return ((base + sg_dma_address(sg)) >> PAGE_SHIFT) + ofs;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int i915_ttm_access_memory(struct ttm_buffer_object *bo,
|
||||
|
@ -272,6 +272,7 @@ struct i915_ttm_memcpy_arg {
|
||||
bool clear;
|
||||
struct i915_refct_sgt *src_rsgt;
|
||||
struct i915_refct_sgt *dst_rsgt;
|
||||
bus_space_tag_t memt;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -304,11 +305,8 @@ struct i915_ttm_memcpy_work {
|
||||
|
||||
static void i915_ttm_move_memcpy(struct i915_ttm_memcpy_arg *arg)
|
||||
{
|
||||
STUB();
|
||||
#ifdef notyet
|
||||
ttm_move_memcpy(arg->clear, arg->num_pages,
|
||||
arg->dst_iter, arg->src_iter);
|
||||
#endif
|
||||
arg->dst_iter, arg->src_iter, arg->memt);
|
||||
}
|
||||
|
||||
static void i915_ttm_memcpy_init(struct i915_ttm_memcpy_arg *arg,
|
||||
@ -317,8 +315,6 @@ static void i915_ttm_memcpy_init(struct i915_ttm_memcpy_arg *arg,
|
||||
struct ttm_tt *dst_ttm,
|
||||
struct i915_refct_sgt *dst_rsgt)
|
||||
{
|
||||
STUB();
|
||||
#ifdef notyet
|
||||
struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
|
||||
struct intel_memory_region *dst_reg, *src_reg;
|
||||
|
||||
@ -342,7 +338,8 @@ static void i915_ttm_memcpy_init(struct i915_ttm_memcpy_arg *arg,
|
||||
arg->dst_rsgt = i915_refct_sgt_get(dst_rsgt);
|
||||
arg->src_rsgt = clear ? NULL :
|
||||
i915_ttm_resource_get_st(obj, bo->resource);
|
||||
#endif
|
||||
|
||||
arg->memt = bo->bdev->memt;
|
||||
}
|
||||
|
||||
static void i915_ttm_memcpy_release(struct i915_ttm_memcpy_arg *arg)
|
||||
|
@ -28,9 +28,6 @@
|
||||
#include "intel_gtt.h"
|
||||
#include "gen8_ppgtt.h"
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/agpvar.h>
|
||||
|
||||
static void i915_ggtt_color_adjust(const struct drm_mm_node *node,
|
||||
unsigned long color,
|
||||
u64 *start,
|
||||
@ -53,7 +50,6 @@ static void i915_ggtt_color_adjust(const struct drm_mm_node *node,
|
||||
static int ggtt_init_hw(struct i915_ggtt *ggtt)
|
||||
{
|
||||
struct drm_i915_private *i915 = ggtt->vm.i915;
|
||||
int i;
|
||||
|
||||
i915_address_space_init(&ggtt->vm, VM_CLASS_GGTT);
|
||||
|
||||
@ -77,6 +73,9 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt)
|
||||
ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start,
|
||||
ggtt->mappable_end);
|
||||
#else
|
||||
bus_space_handle_t bsh;
|
||||
int i;
|
||||
|
||||
/* XXX would be a lot nicer to get agp info before now */
|
||||
uvm_page_physload(atop(ggtt->gmadr.start),
|
||||
atop(ggtt->gmadr.start + ggtt->mappable_end),
|
||||
@ -94,11 +93,13 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt)
|
||||
for (i = 0; i < atop(ggtt->mappable_end); i++)
|
||||
atomic_setbits_int(&(i915->pgs[i].pg_flags),
|
||||
PG_PMAP_WC);
|
||||
if (agp_init_map(i915->bst, ggtt->gmadr.start,
|
||||
if (bus_space_map(i915->bst, ggtt->gmadr.start,
|
||||
ggtt->mappable_end,
|
||||
BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
|
||||
&i915->agph))
|
||||
BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh))
|
||||
panic("can't map aperture");
|
||||
ggtt->iomap.base = ggtt->gmadr.start;
|
||||
ggtt->iomap.size = ggtt->mappable_end;
|
||||
ggtt->iomap.iomem = bus_space_vaddr(i915->bst, bsh);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -358,9 +358,7 @@ struct i915_address_space {
|
||||
struct i915_ggtt {
|
||||
struct i915_address_space vm;
|
||||
|
||||
#ifdef notyet
|
||||
struct io_mapping iomap; /* Mapping to our CPU mappable region */
|
||||
#endif
|
||||
struct resource gmadr; /* GMADR resource */
|
||||
resource_size_t mappable_end; /* End offset that we can CPU map */
|
||||
|
||||
|
@ -153,15 +153,36 @@ region_lmem_release(struct intel_memory_region *mem)
|
||||
static int
|
||||
region_lmem_init(struct intel_memory_region *mem)
|
||||
{
|
||||
STUB();
|
||||
return -ENOSYS;
|
||||
#ifdef notyet
|
||||
int ret;
|
||||
|
||||
#ifdef __linux__
|
||||
if (!io_mapping_init_wc(&mem->iomap,
|
||||
mem->io_start,
|
||||
mem->io_size))
|
||||
return -EIO;
|
||||
#else
|
||||
struct drm_i915_private *i915 = mem->i915;
|
||||
paddr_t start, end;
|
||||
struct vm_page *pgs;
|
||||
int i;
|
||||
bus_space_handle_t bsh;
|
||||
|
||||
start = atop(mem->io_start);
|
||||
end = start + atop(mem->io_size);
|
||||
uvm_page_physload(start, end, start, end, PHYSLOAD_DEVICE);
|
||||
|
||||
pgs = PHYS_TO_VM_PAGE(mem->io_start);
|
||||
for (i = 0; i < atop(mem->io_size); i++)
|
||||
atomic_setbits_int(&(pgs[i].pg_flags), PG_PMAP_WC);
|
||||
|
||||
if (bus_space_map(i915->bst, mem->io_start, mem->io_size,
|
||||
BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, &bsh))
|
||||
panic("can't map lmem");
|
||||
|
||||
mem->iomap.base = mem->io_start;
|
||||
mem->iomap.size = mem->io_size;
|
||||
mem->iomap.iomem = bus_space_vaddr(i915->bst, bsh);
|
||||
#endif
|
||||
|
||||
ret = intel_region_ttm_init(mem);
|
||||
if (ret)
|
||||
@ -170,10 +191,11 @@ region_lmem_init(struct intel_memory_region *mem)
|
||||
return 0;
|
||||
|
||||
out_no_buddy:
|
||||
#ifdef __linux__
|
||||
io_mapping_fini(&mem->iomap);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct intel_memory_region_ops intel_region_lmem_ops = {
|
||||
|
@ -190,8 +190,6 @@ xehp_load_dss_mask(struct intel_uncore *uncore,
|
||||
int numregs,
|
||||
...)
|
||||
{
|
||||
STUB();
|
||||
#ifdef notyet
|
||||
va_list argp;
|
||||
u32 fuse_val[I915_MAX_SS_FUSE_REGS] = {};
|
||||
int i;
|
||||
@ -205,7 +203,6 @@ xehp_load_dss_mask(struct intel_uncore *uncore,
|
||||
va_end(argp);
|
||||
|
||||
bitmap_from_arr32(ssmask->xehp, fuse_val, numregs * 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void xehp_sseu_info_init(struct intel_gt *gt)
|
||||
|
@ -248,6 +248,12 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
|
||||
if (ret < 0)
|
||||
goto err_workqueues;
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
dev_priv->bdev.iot = dev_priv->iot;
|
||||
dev_priv->bdev.memt = dev_priv->bst;
|
||||
dev_priv->bdev.dmat = dev_priv->dmat;
|
||||
#endif
|
||||
|
||||
ret = intel_region_ttm_device_init(dev_priv);
|
||||
if (ret)
|
||||
goto err_ttm;
|
||||
@ -2254,6 +2260,7 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
dev_priv->pc = pa->pa_pc;
|
||||
dev_priv->tag = pa->pa_tag;
|
||||
dev_priv->iot = pa->pa_iot;
|
||||
dev_priv->dmat = pa->pa_dmat;
|
||||
dev_priv->bst = pa->pa_memt;
|
||||
dev_priv->memex = pa->pa_memex;
|
||||
|
@ -215,8 +215,8 @@ struct inteldrm_softc {
|
||||
#ifdef __OpenBSD__
|
||||
struct device sc_dev;
|
||||
bus_dma_tag_t dmat;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_tag_t bst;
|
||||
struct agp_map *agph;
|
||||
bus_space_handle_t opregion_ioh;
|
||||
bus_space_handle_t opregion_rvda_ioh;
|
||||
bus_size_t opregion_rvda_size;
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include <drm/drm_cache.h>
|
||||
#include <drm/drm_vma_manager.h>
|
||||
|
||||
#include <dev/pci/agpvar.h>
|
||||
|
||||
#include "display/intel_display.h"
|
||||
#include "display/intel_frontbuffer.h"
|
||||
|
||||
@ -279,7 +277,6 @@ err_unlock:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static inline bool
|
||||
gtt_user_read(struct io_mapping *mapping,
|
||||
loff_t base, int offset,
|
||||
@ -303,34 +300,6 @@ gtt_user_read(struct io_mapping *mapping,
|
||||
}
|
||||
return unwritten;
|
||||
}
|
||||
#else
|
||||
static inline bool
|
||||
gtt_user_read(struct drm_i915_private *dev_priv,
|
||||
loff_t base, int offset,
|
||||
char __user *user_data, int length)
|
||||
{
|
||||
bus_space_handle_t bsh;
|
||||
void __iomem *vaddr;
|
||||
unsigned long unwritten;
|
||||
|
||||
/* We can use the cpu mem copy function because this is X86. */
|
||||
agp_map_atomic(dev_priv->agph, base, &bsh);
|
||||
vaddr = bus_space_vaddr(dev_priv->bst, bsh);
|
||||
unwritten = __copy_to_user_inatomic(user_data,
|
||||
(void __force *)vaddr + offset,
|
||||
length);
|
||||
agp_unmap_atomic(dev_priv->agph, bsh);
|
||||
if (unwritten) {
|
||||
agp_map_subregion(dev_priv->agph, base, PAGE_SIZE, &bsh);
|
||||
vaddr = bus_space_vaddr(dev_priv->bst, bsh);
|
||||
unwritten = copy_to_user(user_data,
|
||||
(void __force *)vaddr + offset,
|
||||
length);
|
||||
agp_unmap_subregion(dev_priv->agph, bsh, PAGE_SIZE);
|
||||
}
|
||||
return unwritten;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct i915_vma *i915_gem_gtt_prepare(struct drm_i915_gem_object *obj,
|
||||
struct drm_mm_node *node,
|
||||
@ -460,7 +429,7 @@ i915_gem_gtt_pread(struct drm_i915_gem_object *obj,
|
||||
page_base += offset & LINUX_PAGE_MASK;
|
||||
}
|
||||
|
||||
if (gtt_user_read(i915, page_base, page_offset,
|
||||
if (gtt_user_read(&ggtt->iomap, page_base, page_offset,
|
||||
user_data, page_length)) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
@ -542,7 +511,7 @@ out:
|
||||
/* This is the fast write path which cannot handle
|
||||
* page faults in the source data
|
||||
*/
|
||||
#ifdef __linux__
|
||||
|
||||
static inline bool
|
||||
ggtt_write(struct io_mapping *mapping,
|
||||
loff_t base, int offset,
|
||||
@ -565,33 +534,6 @@ ggtt_write(struct io_mapping *mapping,
|
||||
|
||||
return unwritten;
|
||||
}
|
||||
#else
|
||||
static inline bool
|
||||
ggtt_write(struct drm_i915_private *dev_priv,
|
||||
loff_t base, int offset,
|
||||
char __user *user_data, int length)
|
||||
{
|
||||
bus_space_handle_t bsh;
|
||||
void __iomem *vaddr;
|
||||
unsigned long unwritten;
|
||||
|
||||
/* We can use the cpu mem copy function because this is X86. */
|
||||
agp_map_atomic(dev_priv->agph, base, &bsh);
|
||||
vaddr = bus_space_vaddr(dev_priv->bst, bsh);
|
||||
unwritten = __copy_from_user_inatomic_nocache((void __force *)vaddr + offset,
|
||||
user_data, length);
|
||||
agp_unmap_atomic(dev_priv->agph, bsh);
|
||||
if (unwritten) {
|
||||
agp_map_subregion(dev_priv->agph, base, PAGE_SIZE, &bsh);
|
||||
vaddr = bus_space_vaddr(dev_priv->bst, bsh);
|
||||
unwritten = copy_from_user((void __force *)vaddr + offset,
|
||||
user_data, length);
|
||||
agp_unmap_subregion(dev_priv->agph, bsh, PAGE_SIZE);
|
||||
}
|
||||
|
||||
return unwritten;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* i915_gem_gtt_pwrite_fast - This is the fast pwrite path, where we copy the data directly from the
|
||||
@ -674,7 +616,7 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj,
|
||||
* If the object is non-shmem backed, we retry again with the
|
||||
* path that handles page fault.
|
||||
*/
|
||||
if (ggtt_write(i915, page_base, page_offset,
|
||||
if (ggtt_write(&ggtt->iomap, page_base, page_offset,
|
||||
user_data, page_length)) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include "i915_vma.h"
|
||||
#include "i915_vma_resource.h"
|
||||
|
||||
#include <dev/pci/agpvar.h>
|
||||
|
||||
static inline void assert_vma_held_evict(const struct i915_vma *vma)
|
||||
{
|
||||
/*
|
||||
@ -582,22 +580,9 @@ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
|
||||
ptr = i915_gem_object_lmem_io_map(vma->obj, 0,
|
||||
vma->obj->base.size);
|
||||
} else if (i915_vma_is_map_and_fenceable(vma)) {
|
||||
#ifdef __linux__
|
||||
ptr = io_mapping_map_wc(&i915_vm_to_ggtt(vma->vm)->iomap,
|
||||
i915_vma_offset(vma),
|
||||
i915_vma_size(vma));
|
||||
#else
|
||||
{
|
||||
struct drm_i915_private *dev_priv = vma->vm->i915;
|
||||
err = agp_map_subregion(dev_priv->agph, i915_vma_offset(vma),
|
||||
i915_vma_size(vma), &vma->bsh);
|
||||
if (err) {
|
||||
err = -err;
|
||||
goto err;
|
||||
}
|
||||
ptr = bus_space_vaddr(dev_priv->bst, vma->bsh);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
ptr = (void __iomem *)
|
||||
i915_gem_object_pin_map(vma->obj, I915_MAP_WC);
|
||||
@ -616,10 +601,8 @@ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
|
||||
if (unlikely(cmpxchg(&vma->iomap, NULL, ptr))) {
|
||||
if (page_unmask_bits(ptr))
|
||||
__i915_gem_object_release_map(vma->obj);
|
||||
#ifdef __linux__
|
||||
else
|
||||
io_mapping_unmap(ptr);
|
||||
#endif
|
||||
ptr = vma->iomap;
|
||||
}
|
||||
}
|
||||
@ -1879,14 +1862,8 @@ static void __i915_vma_iounmap(struct i915_vma *vma)
|
||||
|
||||
if (page_unmask_bits(vma->iomap))
|
||||
__i915_gem_object_release_map(vma->obj);
|
||||
else {
|
||||
#ifdef __linux__
|
||||
else
|
||||
io_mapping_unmap(vma->iomap);
|
||||
#else
|
||||
struct drm_i915_private *dev_priv = vma->vm->i915;
|
||||
agp_unmap_subregion(dev_priv->agph, vma->bsh, vma->node.size);
|
||||
#endif
|
||||
}
|
||||
vma->iomap = NULL;
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,7 @@ struct intel_memory_region {
|
||||
|
||||
const struct intel_memory_region_ops *ops;
|
||||
|
||||
#ifdef notyet
|
||||
struct io_mapping iomap;
|
||||
#endif
|
||||
struct resource region;
|
||||
|
||||
resource_size_t io_start;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bitmap.h,v 1.6 2024/01/06 09:33:08 kettenis Exp $ */
|
||||
/* $OpenBSD: bitmap.h,v 1.8 2024/03/20 22:52:44 bluhm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
|
||||
*
|
||||
@ -97,11 +97,28 @@ bitmap_complement(void *d, void *s, u_int n)
|
||||
dst[b >> 5] = ~src[b >> 5];
|
||||
}
|
||||
|
||||
static inline bool
|
||||
bitmap_intersects(const void *s1, const void *s2, u_int n)
|
||||
{
|
||||
const u_int *b1 = s1;
|
||||
const u_int *b2 = s2;
|
||||
u_int b;
|
||||
|
||||
for (b = 0; b < n; b += 32)
|
||||
if (b1[b >> 5] & b2[b >> 5])
|
||||
return true;
|
||||
if ((n % 32) != 0)
|
||||
if ((b1[n >> 5] & b2[b >> 5]) & (0xffffffff >> (32 - (n % 32))))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitmap_copy(void *d, void *s, u_int n)
|
||||
bitmap_copy(void *d, const void *s, u_int n)
|
||||
{
|
||||
u_int *dst = d;
|
||||
u_int *src = s;
|
||||
const u_int *src = s;
|
||||
u_int b;
|
||||
|
||||
for (b = 0; b < n; b += 32)
|
||||
@ -109,7 +126,7 @@ bitmap_copy(void *d, void *s, u_int n)
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitmap_to_arr32(void *d, unsigned long *src, u_int n)
|
||||
bitmap_to_arr32(void *d, const unsigned long *src, u_int n)
|
||||
{
|
||||
u_int *dst = d;
|
||||
u_int b;
|
||||
@ -128,6 +145,27 @@ bitmap_to_arr32(void *d, unsigned long *src, u_int n)
|
||||
dst[n >> 5] &= (0xffffffff >> (32 - (n % 32)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
bitmap_from_arr32(unsigned long *dst, const void *s, u_int n)
|
||||
{
|
||||
const u_int *src = s;
|
||||
u_int b;
|
||||
|
||||
#ifdef __LP64__
|
||||
for (b = 0; b < n; b += 32) {
|
||||
dst[b >> 6] = src[b >> 5];
|
||||
b += 32;
|
||||
if (b < n)
|
||||
dst[b >> 6] |= ((unsigned long)src[b >> 5]) << 32;
|
||||
}
|
||||
if ((n % 64) != 0)
|
||||
dst[n >> 6] &= (0xffffffffffffffffUL >> (64 - (n % 64)));
|
||||
#else
|
||||
bitmap_copy(dst, s, n);
|
||||
if ((n % 32) != 0)
|
||||
dst[n >> 5] &= (0xffffffff >> (32 - (n % 32)));
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
bitmap_weight(const void *p, u_int n)
|
||||
|
@ -3,4 +3,45 @@
|
||||
#ifndef _LINUX_IO_MAPPING_H
|
||||
#define _LINUX_IO_MAPPING_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct io_mapping {
|
||||
resource_size_t base;
|
||||
unsigned long size;
|
||||
void *iomem;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
io_mapping_map_wc(struct io_mapping *map, unsigned long off, unsigned long size)
|
||||
{
|
||||
return ((uint8_t *)map->iomem + off);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_mapping_unmap(void *va)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void *
|
||||
io_mapping_map_local_wc(struct io_mapping *map, unsigned long off)
|
||||
{
|
||||
return ((uint8_t *)map->iomem + off);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_mapping_unmap_local(void *va)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void *
|
||||
io_mapping_map_atomic_wc(struct io_mapping *map, unsigned long off)
|
||||
{
|
||||
return ((uint8_t *)map->iomem + off);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_mapping_unmap_atomic(void *va)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: vmalloc.h,v 1.6 2024/01/16 23:38:13 jsg Exp $ */
|
||||
/* $OpenBSD: vmalloc.h,v 1.7 2024/03/20 02:42:17 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
|
||||
*
|
||||
@ -25,6 +25,7 @@
|
||||
#include <linux/types.h> /* for pgprot_t */
|
||||
|
||||
void *vmap(struct vm_page **, unsigned int, unsigned long, pgprot_t);
|
||||
void *vmap_pfn(unsigned long *, unsigned int, pgprot_t);
|
||||
void vunmap(void *, size_t);
|
||||
|
||||
static inline void *
|
||||
|
@ -564,32 +564,16 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
addr = io_mapping_map_local_wc(iter_io->iomap, iter_io->cache.offs +
|
||||
(((resource_size_t)i - iter_io->cache.i)
|
||||
<< PAGE_SHIFT));
|
||||
#else
|
||||
if (bus_space_map(bst, iter_io->cache.offs +
|
||||
(((resource_size_t)i - iter_io->cache.i) << PAGE_SHIFT),
|
||||
PAGE_SIZE, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
|
||||
&dmap->bsh)) {
|
||||
printf("%s bus_space_map failed\n", __func__);
|
||||
addr = 0;
|
||||
} else {
|
||||
addr = bus_space_vaddr(bst, dmap->bsh);
|
||||
}
|
||||
#endif
|
||||
iosys_map_set_vaddr_iomem(dmap, addr);
|
||||
}
|
||||
|
||||
static void ttm_kmap_iter_iomap_unmap_local(struct ttm_kmap_iter *iter,
|
||||
struct iosys_map *map, bus_space_tag_t bst)
|
||||
{
|
||||
#ifdef notyet
|
||||
io_mapping_unmap_local(map->vaddr_iomem);
|
||||
#else
|
||||
bus_space_unmap(bst, map->bsh, PAGE_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct ttm_kmap_iter_ops ttm_kmap_iter_io_ops = {
|
||||
|
@ -151,6 +151,9 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,
|
||||
ttm->swap_storage = NULL;
|
||||
ttm->sg = bo->sg;
|
||||
ttm->caching = caching;
|
||||
ttm->dmat = bo->bdev->dmat;
|
||||
ttm->map = NULL;
|
||||
ttm->segs = NULL;
|
||||
}
|
||||
|
||||
int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
|
||||
@ -184,9 +187,11 @@ void ttm_tt_fini(struct ttm_tt *ttm)
|
||||
ttm->dma_address = NULL;
|
||||
ttm->orders = NULL;
|
||||
|
||||
bus_dmamap_destroy(ttm->dmat, ttm->map);
|
||||
km_free(ttm->segs, round_page(ttm->num_pages *
|
||||
sizeof(bus_dma_segment_t)), &kv_any, &kp_zero);
|
||||
if (ttm->map)
|
||||
bus_dmamap_destroy(ttm->dmat, ttm->map);
|
||||
if (ttm->segs)
|
||||
km_free(ttm->segs, round_page(ttm->num_pages *
|
||||
sizeof(bus_dma_segment_t)), &kv_any, &kp_zero);
|
||||
}
|
||||
EXPORT_SYMBOL(ttm_tt_fini);
|
||||
|
||||
@ -210,8 +215,6 @@ int ttm_sg_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
|
||||
ttm->segs = km_alloc(round_page(ttm->num_pages *
|
||||
sizeof(bus_dma_segment_t)), &kv_any, &kp_zero, &kd_waitok);
|
||||
|
||||
ttm->dmat = bo->bdev->dmat;
|
||||
|
||||
if (bo->bdev->pool.use_dma32 == false)
|
||||
flags |= BUS_DMA_64BIT;
|
||||
if (bus_dmamap_create(ttm->dmat, ttm->num_pages << PAGE_SHIFT,
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: aucat.1,v 1.119 2023/01/10 20:48:34 ratchov Exp $
|
||||
.\" $OpenBSD: aucat.1,v 1.120 2024/03/20 08:42:11 ratchov Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
|
||||
.\"
|
||||
@ -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: January 10 2023 $
|
||||
.Dd $Mdocdate: March 20 2024 $
|
||||
.Dt AUCAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -24,13 +24,13 @@
|
||||
.Nm aucat
|
||||
.Op Fl dn
|
||||
.Op Fl b Ar size
|
||||
.Op Fl c Ar min : Ns Ar max
|
||||
.Op Fl c Ar channels
|
||||
.Op Fl e Ar enc
|
||||
.Op Fl f Ar device
|
||||
.Op Fl g Ar position
|
||||
.Op Fl h Ar fmt
|
||||
.Op Fl i Ar file
|
||||
.Op Fl j Ar flag
|
||||
.Op Fl m Ar min : Ns Ar max Ns / Ns Ar min : Ns Ar max
|
||||
.Op Fl o Ar file
|
||||
.Op Fl p Ar position
|
||||
.Op Fl q Ar port
|
||||
@ -78,11 +78,9 @@ The options are as follows:
|
||||
.It Fl b Ar size
|
||||
The buffer size of the audio device in frames.
|
||||
Default is 7680.
|
||||
.It Fl c Ar min : Ns Ar max
|
||||
The range of audio file channel numbers.
|
||||
The default is
|
||||
.Cm 0:1 ,
|
||||
i.e. stereo.
|
||||
.It Fl c Ar channels
|
||||
The audio file channels count.
|
||||
The default is 2, i.e. stereo.
|
||||
.It Fl d
|
||||
Increase log verbosity.
|
||||
.It Fl e Ar enc
|
||||
@ -146,21 +144,9 @@ Play this audio file.
|
||||
If the option argument is
|
||||
.Sq -
|
||||
then standard input will be used.
|
||||
.It Fl j Ar flag
|
||||
Control whether source channels are joined or expanded if
|
||||
they don't match the destination number of channels.
|
||||
If the flag is
|
||||
.Cm off ,
|
||||
then each source channel is routed to a single destination channel,
|
||||
possibly discarding channels.
|
||||
If the flag is
|
||||
.Cm on ,
|
||||
then a single source may be sent to multiple destinations
|
||||
and multiple sources may be mixed into a single destination.
|
||||
For instance, this feature could be used to convert
|
||||
a stereo file into a mono file mixing left and right channels together.
|
||||
The default is
|
||||
.Cm off .
|
||||
.It Fl m Ar min : Ns Ar max Ns / Ns Ar min : Ns Ar max
|
||||
Map the given range of source channels into the given range of
|
||||
destination channels.
|
||||
.It Fl n
|
||||
Off-line mode.
|
||||
Read input files and store the result in the output files,
|
||||
@ -198,7 +184,7 @@ The default is 127, i.e. no attenuation.
|
||||
.Pp
|
||||
On the command line,
|
||||
per-file parameters
|
||||
.Pq Fl cehjrv
|
||||
.Pq Fl cehmrv
|
||||
must precede the file definition
|
||||
.Pq Fl io .
|
||||
.Pp
|
||||
@ -282,13 +268,13 @@ Record channels 2 and 3 into one stereo file and
|
||||
channels 6 and 7 into another stereo file using a 44.1kHz sampling
|
||||
rate for both:
|
||||
.Bd -literal -offset indent
|
||||
$ aucat -r 44100 -c 2:3 -o file1.wav -c 6:7 -o file2.wav
|
||||
$ aucat -r 44100 -m 2:3/0:1 -o file1.wav -m 6:7/0:1 -o file2.wav
|
||||
.Ed
|
||||
.Pp
|
||||
Split a stereo file into two mono files:
|
||||
.Bd -literal -offset indent
|
||||
$ aucat -n -i stereo.wav -c 0:0 -o left.wav \e
|
||||
-c 1:1 -o right.wav
|
||||
$ aucat -n -i stereo.wav -c 1 -m 0:0/0:0 -o left.wav \e
|
||||
-m 1:1/0:0 -o right.wav
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr cdio 1 ,
|
||||
|
@ -75,14 +75,14 @@ struct slot {
|
||||
int volctl; /* volume in the 0..127 range */
|
||||
struct abuf buf; /* file i/o buffer */
|
||||
int bpf; /* bytes per frame */
|
||||
int cmin, cmax; /* file channel range */
|
||||
int imin, imax, omin, omax; /* channel mapping ranges */
|
||||
struct cmap cmap; /* channel mapper state */
|
||||
struct resamp resamp; /* resampler state */
|
||||
struct conv conv; /* format encoder state */
|
||||
int join; /* channel join factor */
|
||||
int expand; /* channel expand factor */
|
||||
void *resampbuf, *convbuf; /* conversion tmp buffers */
|
||||
int dup; /* mono-to-stereo and alike */
|
||||
int dup; /* compat with legacy -j option */
|
||||
int round; /* slot-side block size */
|
||||
int mode; /* MODE_{PLAY,REC} */
|
||||
#define SLOT_CFG 0 /* buffers not allocated yet */
|
||||
@ -136,9 +136,9 @@ const unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
|
||||
const unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
|
||||
|
||||
char usagestr[] = "usage: aucat [-dn] [-b size] "
|
||||
"[-c min:max] [-e enc] [-f device] [-g position]\n\t"
|
||||
"[-h fmt] [-i file] [-j flag] [-o file] [-p position] [-q port]\n\t"
|
||||
"[-r rate] [-v volume]\n";
|
||||
"[-c channels] [-e enc] [-f device] [-g position]\n\t"
|
||||
"[-h fmt] [-i file] [-m min:max/min:max] [-o file] [-p position]\n\t"
|
||||
"[-q port] [-r rate] [-v volume]\n";
|
||||
|
||||
static void *
|
||||
allocbuf(int nfr, int nch)
|
||||
@ -218,19 +218,22 @@ slot_fill(struct slot *s)
|
||||
|
||||
static int
|
||||
slot_new(char *path, int mode, struct aparams *par, int hdr,
|
||||
int cmin, int cmax, int rate, int dup, int vol, long long pos)
|
||||
int imin, int imax, int omin, int omax, int nch,
|
||||
int rate, int dup, int vol, long long pos)
|
||||
{
|
||||
struct slot *s, **ps;
|
||||
|
||||
s = xmalloc(sizeof(struct slot));
|
||||
if (!afile_open(&s->afile, path, hdr,
|
||||
mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE,
|
||||
par, rate, cmax - cmin + 1)) {
|
||||
par, rate, nch)) {
|
||||
xfree(s);
|
||||
return 0;
|
||||
}
|
||||
s->cmin = cmin;
|
||||
s->cmax = cmin + s->afile.nch - 1;
|
||||
s->imin = (imin != -1) ? imin : 0;
|
||||
s->imax = (imax != -1) ? imax : s->imin + s->afile.nch - 1;
|
||||
s->omin = (omin != -1) ? omin : 0;
|
||||
s->omax = (omax != -1) ? omax : s->omin + s->afile.nch - 1;
|
||||
s->dup = dup;
|
||||
s->vol = MIDI_TO_ADATA(vol);
|
||||
s->mode = mode;
|
||||
@ -240,11 +243,17 @@ slot_new(char *path, int mode, struct aparams *par, int hdr,
|
||||
slot_log(s);
|
||||
log_puts(": ");
|
||||
log_puts(s->mode == SIO_PLAY ? "play" : "rec");
|
||||
log_puts(", chan ");
|
||||
log_putu(s->cmin);
|
||||
log_puts(":");
|
||||
log_putu(s->cmax);
|
||||
log_puts(", ");
|
||||
log_putu(s->afile.nch);
|
||||
log_puts("ch (");
|
||||
log_putu(s->imin);
|
||||
log_puts(":");
|
||||
log_putu(s->imax);
|
||||
log_puts("/");
|
||||
log_putu(s->omin);
|
||||
log_puts(":");
|
||||
log_putu(s->omax);
|
||||
log_puts("), ");
|
||||
log_putu(s->afile.rate);
|
||||
log_puts("Hz, ");
|
||||
switch (s->afile.fmt) {
|
||||
@ -283,7 +292,7 @@ slot_new(char *path, int mode, struct aparams *par, int hdr,
|
||||
static void
|
||||
slot_init(struct slot *s)
|
||||
{
|
||||
unsigned int slot_nch, bufsz;
|
||||
unsigned int inch, onch, bufsz;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (s->pstate != SLOT_CFG) {
|
||||
@ -292,7 +301,7 @@ slot_init(struct slot *s)
|
||||
panic();
|
||||
}
|
||||
#endif
|
||||
s->bpf = s->afile.par.bps * (s->cmax - s->cmin + 1);
|
||||
s->bpf = s->afile.par.bps * s->afile.nch;
|
||||
s->round = ((long long)dev_round * s->afile.rate +
|
||||
dev_rate - 1) / dev_rate;
|
||||
|
||||
@ -310,54 +319,50 @@ slot_init(struct slot *s)
|
||||
}
|
||||
#endif
|
||||
|
||||
slot_nch = s->cmax - s->cmin + 1;
|
||||
s->convbuf = NULL;
|
||||
s->resampbuf = NULL;
|
||||
s->join = 1;
|
||||
s->expand = 1;
|
||||
inch = s->imax - s->imin + 1;
|
||||
onch = s->omax - s->omin + 1;
|
||||
if (s->dup) {
|
||||
/* compat with legacy -j option */
|
||||
if (s->mode == SIO_PLAY)
|
||||
onch = dev_pchan;
|
||||
else
|
||||
inch = dev_rchan;
|
||||
}
|
||||
if (onch > inch)
|
||||
s->expand = onch / inch;
|
||||
else if (onch < inch)
|
||||
s->join = inch / onch;
|
||||
if (s->mode & SIO_PLAY) {
|
||||
if (s->dup) {
|
||||
if (dev_pchan > slot_nch)
|
||||
s->expand = dev_pchan / slot_nch;
|
||||
else if (dev_pchan < slot_nch)
|
||||
s->join = slot_nch / dev_pchan;
|
||||
}
|
||||
cmap_init(&s->cmap,
|
||||
s->cmin, s->cmax,
|
||||
s->cmin, s->cmax,
|
||||
0, dev_pchan - 1,
|
||||
0, dev_pchan - 1);
|
||||
0, s->afile.nch - 1, s->imin, s->imax,
|
||||
0, dev_pchan - 1, s->omin, s->omax);
|
||||
if (s->afile.fmt != AFILE_FMT_PCM ||
|
||||
!aparams_native(&s->afile.par)) {
|
||||
dec_init(&s->conv, &s->afile.par, slot_nch);
|
||||
s->convbuf = allocbuf(s->round, slot_nch);
|
||||
dec_init(&s->conv, &s->afile.par, s->afile.nch);
|
||||
s->convbuf = allocbuf(s->round, s->afile.nch);
|
||||
}
|
||||
if (s->afile.rate != dev_rate) {
|
||||
resamp_init(&s->resamp, s->afile.rate, dev_rate,
|
||||
slot_nch);
|
||||
s->resampbuf = allocbuf(dev_round, slot_nch);
|
||||
s->afile.nch);
|
||||
s->resampbuf = allocbuf(dev_round, s->afile.nch);
|
||||
}
|
||||
}
|
||||
if (s->mode & SIO_REC) {
|
||||
if (s->dup) {
|
||||
if (dev_rchan > slot_nch)
|
||||
s->join = dev_rchan / slot_nch;
|
||||
else if (dev_rchan < slot_nch)
|
||||
s->expand = slot_nch / dev_rchan;
|
||||
}
|
||||
cmap_init(&s->cmap,
|
||||
0, dev_rchan - 1,
|
||||
0, dev_rchan - 1,
|
||||
s->cmin, s->cmax,
|
||||
s->cmin, s->cmax);
|
||||
0, dev_rchan - 1, s->imin, s->imax,
|
||||
0, s->afile.nch - 1, s->omin, s->omax);
|
||||
if (s->afile.rate != dev_rate) {
|
||||
resamp_init(&s->resamp, dev_rate, s->afile.rate,
|
||||
slot_nch);
|
||||
s->resampbuf = allocbuf(dev_round, slot_nch);
|
||||
s->afile.nch);
|
||||
s->resampbuf = allocbuf(dev_round, s->afile.nch);
|
||||
}
|
||||
if (!aparams_native(&s->afile.par)) {
|
||||
enc_init(&s->conv, &s->afile.par, slot_nch);
|
||||
s->convbuf = allocbuf(s->round, slot_nch);
|
||||
enc_init(&s->conv, &s->afile.par, s->afile.nch);
|
||||
s->convbuf = allocbuf(s->round, s->afile.nch);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -368,13 +373,13 @@ slot_init(struct slot *s)
|
||||
*/
|
||||
if (s->resampbuf) {
|
||||
memset(s->resampbuf, 0,
|
||||
dev_round * slot_nch * sizeof(adata_t));
|
||||
dev_round * s->afile.nch * sizeof(adata_t));
|
||||
} else if (s->convbuf) {
|
||||
memset(s->convbuf, 0,
|
||||
s->round * slot_nch * sizeof(adata_t));
|
||||
s->round * s->afile.nch * sizeof(adata_t));
|
||||
} else {
|
||||
memset(s->buf.data, 0,
|
||||
bufsz * slot_nch * sizeof(adata_t));
|
||||
bufsz * s->afile.nch * sizeof(adata_t));
|
||||
}
|
||||
}
|
||||
s->pstate = SLOT_INIT;
|
||||
@ -487,7 +492,7 @@ slot_getcnt(struct slot *s, int *icnt, int *ocnt)
|
||||
static void
|
||||
play_filt_resamp(struct slot *s, void *res_in, void *out, int icnt, int ocnt)
|
||||
{
|
||||
int i, offs, vol, nch;
|
||||
int i, offs, vol, inch, onch;
|
||||
void *in;
|
||||
|
||||
if (s->resampbuf) {
|
||||
@ -496,18 +501,24 @@ play_filt_resamp(struct slot *s, void *res_in, void *out, int icnt, int ocnt)
|
||||
} else
|
||||
in = res_in;
|
||||
|
||||
nch = s->cmap.nch;
|
||||
inch = s->imax - s->imin + 1;
|
||||
onch = s->omax - s->omin + 1;
|
||||
vol = s->vol / s->join; /* XXX */
|
||||
cmap_add(&s->cmap, in, out, vol, ocnt);
|
||||
|
||||
offs = 0;
|
||||
for (i = s->join - 1; i > 0; i--) {
|
||||
offs += nch;
|
||||
offs += onch;
|
||||
if (offs + s->cmap.nch > s->afile.nch)
|
||||
break;
|
||||
cmap_add(&s->cmap, (adata_t *)in + offs, out, vol, ocnt);
|
||||
}
|
||||
|
||||
offs = 0;
|
||||
for (i = s->expand - 1; i > 0; i--) {
|
||||
offs += nch;
|
||||
offs += inch;
|
||||
if (offs + s->cmap.nch > dev_pchan)
|
||||
break;
|
||||
cmap_add(&s->cmap, in, (adata_t *)out + offs, vol, ocnt);
|
||||
}
|
||||
}
|
||||
@ -581,23 +592,28 @@ slot_mix_badd(struct slot *s, adata_t *odata)
|
||||
static void
|
||||
rec_filt_resamp(struct slot *s, void *in, void *res_out, int icnt, int ocnt)
|
||||
{
|
||||
int i, vol, offs, nch;
|
||||
int i, vol, offs, inch, onch;
|
||||
void *out = res_out;
|
||||
|
||||
out = (s->resampbuf) ? s->resampbuf : res_out;
|
||||
|
||||
nch = s->cmap.nch;
|
||||
inch = s->imax - s->imin + 1;
|
||||
onch = s->omax - s->omin + 1;
|
||||
vol = ADATA_UNIT / s->join;
|
||||
cmap_copy(&s->cmap, in, out, vol, icnt);
|
||||
|
||||
offs = 0;
|
||||
for (i = s->join - 1; i > 0; i--) {
|
||||
offs += nch;
|
||||
offs += onch;
|
||||
if (offs + s->cmap.nch > dev_rchan)
|
||||
break;
|
||||
cmap_add(&s->cmap, (adata_t *)in + offs, out, vol, icnt);
|
||||
}
|
||||
offs = 0;
|
||||
for (i = s->expand - 1; i > 0; i--) {
|
||||
offs += nch;
|
||||
offs += inch;
|
||||
if (offs + s->cmap.nch > s->afile.nch)
|
||||
break;
|
||||
cmap_copy(&s->cmap, in, (adata_t *)out + offs, vol, icnt);
|
||||
}
|
||||
if (s->resampbuf)
|
||||
@ -683,12 +699,12 @@ dev_open(char *dev, int mode, int bufsz, char *port)
|
||||
if (s->afile.rate > rate)
|
||||
rate = s->afile.rate;
|
||||
if (s->mode == SIO_PLAY) {
|
||||
if (s->cmax > pmax)
|
||||
pmax = s->cmax;
|
||||
if (s->omax > pmax)
|
||||
pmax = s->omax;
|
||||
}
|
||||
if (s->mode == SIO_REC) {
|
||||
if (s->cmax > rmax)
|
||||
rmax = s->cmax;
|
||||
if (s->imax > rmax)
|
||||
rmax = s->imax;
|
||||
}
|
||||
}
|
||||
sio_initpar(&par);
|
||||
@ -1078,8 +1094,10 @@ offline(void)
|
||||
for (s = slot_list; s != NULL; s = s->next) {
|
||||
if (s->afile.rate > rate)
|
||||
rate = s->afile.rate;
|
||||
if (s->cmax > cmax)
|
||||
cmax = s->cmax;
|
||||
if (s->imax > cmax)
|
||||
cmax = s->imax;
|
||||
if (s->omax > cmax)
|
||||
cmax = s->omax;
|
||||
}
|
||||
dev_sh = NULL;
|
||||
dev_name = "offline";
|
||||
@ -1323,26 +1341,78 @@ opt_hdr(char *s, int *hdr)
|
||||
}
|
||||
|
||||
static int
|
||||
opt_ch(char *s, int *rcmin, int *rcmax)
|
||||
opt_map(char *str, int *rimin, int *rimax, int *romin, int *romax)
|
||||
{
|
||||
char *next, *end;
|
||||
long cmin, cmax;
|
||||
char *s, *next;
|
||||
long imin, imax, omin, omax;
|
||||
|
||||
errno = 0;
|
||||
cmin = strtol(s, &next, 10);
|
||||
s = str;
|
||||
imin = strtol(s, &next, 10);
|
||||
if (next == s || *next != ':')
|
||||
goto failed;
|
||||
cmax = strtol(++next, &end, 10);
|
||||
if (end == next || *end != '\0')
|
||||
s = next + 1;
|
||||
imax = strtol(s, &next, 10);
|
||||
if (next == s || *next != '/')
|
||||
goto failed;
|
||||
if (cmin < 0 || cmax < cmin || cmax >= NCHAN_MAX)
|
||||
s = next + 1;
|
||||
omin = strtol(s, &next, 10);
|
||||
if (next == s || *next != ':')
|
||||
goto failed;
|
||||
*rcmin = cmin;
|
||||
*rcmax = cmax;
|
||||
s = next + 1;
|
||||
omax = strtol(s, &next, 10);
|
||||
if (next == s || *next != '\0')
|
||||
goto failed;
|
||||
if (imin < 0 || imax < imin || imax >= NCHAN_MAX)
|
||||
goto failed;
|
||||
if (omin < 0 || omax < omin || omax >= NCHAN_MAX)
|
||||
goto failed;
|
||||
*rimin = imin;
|
||||
*rimax = imax;
|
||||
*romin = omin;
|
||||
*romax = omax;
|
||||
return 1;
|
||||
failed:
|
||||
log_puts(s);
|
||||
log_puts(": channel range expected\n");
|
||||
log_puts(str);
|
||||
log_puts(": channel mapping expected\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
opt_nch(char *str, int *rnch, int *roff)
|
||||
{
|
||||
char *s, *next;
|
||||
long nch, off, cmin, cmax;
|
||||
|
||||
errno = 0;
|
||||
s = str;
|
||||
nch = strtol(s, &next, 10);
|
||||
if (next == s)
|
||||
goto failed;
|
||||
if (*next == ':') {
|
||||
/* compat with legacy -c syntax */
|
||||
s = next + 1;
|
||||
cmin = nch;
|
||||
cmax = strtol(s, &next, 10);
|
||||
if (next == s)
|
||||
goto failed;
|
||||
if (cmin < 0 || cmax < cmin || cmax >= NCHAN_MAX)
|
||||
goto failed;
|
||||
nch = cmax - cmin + 1;
|
||||
off = cmin;
|
||||
} else {
|
||||
off = 0;
|
||||
if (nch < 0 || nch >= NCHAN_MAX)
|
||||
goto failed;
|
||||
}
|
||||
if (*next != '\0')
|
||||
goto failed;
|
||||
*rnch = nch;
|
||||
*roff = off;
|
||||
return 1;
|
||||
failed:
|
||||
log_puts(str);
|
||||
log_puts(": channel count expected\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1381,7 +1451,7 @@ opt_pos(char *s, long long *pos)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int dup, cmin, cmax, rate, vol, bufsz, hdr, mode;
|
||||
int dup, imin, imax, omin, omax, nch, off, rate, vol, bufsz, hdr, mode;
|
||||
char *port, *dev;
|
||||
struct aparams par;
|
||||
int n_flag, c;
|
||||
@ -1393,9 +1463,10 @@ main(int argc, char **argv)
|
||||
vol = 127;
|
||||
dup = 0;
|
||||
bufsz = 0;
|
||||
nch = 2;
|
||||
off = 0;
|
||||
rate = DEFAULT_RATE;
|
||||
cmin = 0;
|
||||
cmax = 1;
|
||||
imin = imax = omin = omax = -1;
|
||||
par.bits = ADATA_BITS;
|
||||
par.bps = APARAMS_BPS(par.bits);
|
||||
par.le = ADATA_LE;
|
||||
@ -1409,14 +1480,14 @@ main(int argc, char **argv)
|
||||
pos = 0;
|
||||
|
||||
while ((c = getopt(argc, argv,
|
||||
"b:c:de:f:g:h:i:j:no:p:q:r:t:v:")) != -1) {
|
||||
"b:c:de:f:g:h:i:j:m:no:p:q:r:t:v:")) != -1) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
if (!opt_num(optarg, 1, RATE_MAX, &bufsz))
|
||||
return 1;
|
||||
break;
|
||||
case 'c':
|
||||
if (!opt_ch(optarg, &cmin, &cmax))
|
||||
if (!opt_nch(optarg, &nch, &off))
|
||||
return 1;
|
||||
break;
|
||||
case 'd':
|
||||
@ -1438,22 +1509,41 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
break;
|
||||
case 'i':
|
||||
if (off > 0) {
|
||||
/* compat with legacy -c syntax */
|
||||
omin = off;
|
||||
omax = off + nch - 1;
|
||||
}
|
||||
if (!slot_new(optarg, SIO_PLAY,
|
||||
&par, hdr, cmin, cmax, rate, dup, vol, pos))
|
||||
&par, hdr, imin, imax, omin, omax,
|
||||
nch, rate, dup, vol, pos))
|
||||
return 1;
|
||||
mode |= SIO_PLAY;
|
||||
imin = imax = omin = omax = -1;
|
||||
break;
|
||||
case 'j':
|
||||
/* compat with legacy -j option */
|
||||
if (!opt_onoff(optarg, &dup))
|
||||
return 1;
|
||||
break;
|
||||
case 'm':
|
||||
if (!opt_map(optarg, &imin, &imax, &omin, &omax))
|
||||
return 1;
|
||||
break;
|
||||
case 'n':
|
||||
n_flag = 1;
|
||||
break;
|
||||
case 'o':
|
||||
if (off > 0) {
|
||||
/* compat with legacy -c syntax */
|
||||
imin = off;
|
||||
imax = off + nch - 1;
|
||||
}
|
||||
if (!slot_new(optarg, SIO_REC,
|
||||
&par, hdr, cmin, cmax, rate, dup, 0, pos))
|
||||
&par, hdr, imin, imax, omin, omax,
|
||||
nch, rate, dup, 0, pos))
|
||||
return 1;
|
||||
imin = imax = omin = omax = -1;
|
||||
mode |= SIO_REC;
|
||||
break;
|
||||
case 'p':
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dsp.c,v 1.18 2022/12/26 19:16:00 jmc Exp $ */
|
||||
/* $OpenBSD: dsp.c,v 1.19 2024/03/20 08:42:11 ratchov Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
|
||||
*
|
||||
@ -992,33 +992,35 @@ cmap_init(struct cmap *p,
|
||||
int imin, int imax, int isubmin, int isubmax,
|
||||
int omin, int omax, int osubmin, int osubmax)
|
||||
{
|
||||
int cmin, cmax;
|
||||
int inch, onch, nch;
|
||||
|
||||
cmin = -NCHAN_MAX;
|
||||
if (osubmin > cmin)
|
||||
cmin = osubmin;
|
||||
if (omin > cmin)
|
||||
cmin = omin;
|
||||
if (isubmin > cmin)
|
||||
cmin = isubmin;
|
||||
if (imin > cmin)
|
||||
cmin = imin;
|
||||
/*
|
||||
* Ignore channels outside of the available sets
|
||||
*/
|
||||
if (isubmin < imin)
|
||||
isubmin = imin;
|
||||
if (isubmax > imax)
|
||||
isubmax = imax;
|
||||
if (osubmin < omin)
|
||||
osubmin = omin;
|
||||
if (osubmax > omax)
|
||||
osubmax = omax;
|
||||
|
||||
cmax = NCHAN_MAX;
|
||||
if (osubmax < cmax)
|
||||
cmax = osubmax;
|
||||
if (omax < cmax)
|
||||
cmax = omax;
|
||||
if (isubmax < cmax)
|
||||
cmax = isubmax;
|
||||
if (imax < cmax)
|
||||
cmax = imax;
|
||||
/*
|
||||
* Shrink the input or the output subset to make both subsets of
|
||||
* the same size
|
||||
*/
|
||||
inch = isubmax - isubmin + 1;
|
||||
onch = osubmax - osubmin + 1;
|
||||
nch = (inch < onch) ? inch : onch;
|
||||
isubmax = isubmin + nch - 1;
|
||||
osubmax = osubmin + nch - 1;
|
||||
|
||||
p->ostart = cmin - omin;
|
||||
p->onext = omax - cmax;
|
||||
p->istart = cmin - imin;
|
||||
p->inext = imax - cmax;
|
||||
p->nch = cmax - cmin + 1;
|
||||
p->ostart = osubmin - omin;
|
||||
p->onext = omax - osubmax;
|
||||
p->istart = isubmin - imin;
|
||||
p->inext = imax - isubmax;
|
||||
p->nch = nch;
|
||||
#ifdef DEBUG
|
||||
if (log_level >= 3) {
|
||||
log_puts("cmap: nch = ");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sender.c,v 1.32 2024/02/27 11:28:30 claudio Exp $ */
|
||||
/* $OpenBSD: sender.c,v 1.33 2024/03/20 09:26:42 claudio Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
@ -588,7 +588,8 @@ rsync_sender(struct sess *sess, int fdin,
|
||||
&up, &wbuf, &wbufsz, &wbufmax, fl)) {
|
||||
ERRX1("send_up_fsm");
|
||||
goto out;
|
||||
} else if (phase > 1)
|
||||
}
|
||||
if (phase > 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -664,7 +665,8 @@ rsync_sender(struct sess *sess, int fdin,
|
||||
if (!io_read_int(sess, fdin, &idx)) {
|
||||
ERRX1("io_read_int");
|
||||
goto out;
|
||||
} else if (idx != -1) {
|
||||
}
|
||||
if (idx != -1) {
|
||||
ERRX("read incorrect update complete ack");
|
||||
goto out;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: parse.y,v 1.456 2024/03/18 14:54:52 claudio Exp $ */
|
||||
/* $OpenBSD: parse.y,v 1.457 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -1894,7 +1894,7 @@ peeropts : REMOTEAS as4number {
|
||||
uint16_t afi;
|
||||
|
||||
if ($3 == SAFI_NONE) {
|
||||
for (aid = 0; aid < AID_MAX; aid++) {
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++) {
|
||||
if (aid2afi(aid, &afi, &safi) == -1 ||
|
||||
afi != $2)
|
||||
continue;
|
||||
@ -1927,11 +1927,11 @@ peeropts : REMOTEAS as4number {
|
||||
int8_t *ap = curpeer->conf.capabilities.add_path;
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
for (i = AID_MIN; i < AID_MAX; i++)
|
||||
if ($4)
|
||||
*ap++ |= CAPA_AP_RECV;
|
||||
ap[i] |= CAPA_AP_RECV;
|
||||
else
|
||||
*ap++ &= ~CAPA_AP_RECV;
|
||||
ap[i] &= ~CAPA_AP_RECV;
|
||||
}
|
||||
| ANNOUNCE ADDPATH SEND STRING addpathextra addpathmax {
|
||||
int8_t *ap = curpeer->conf.capabilities.add_path;
|
||||
@ -1945,9 +1945,7 @@ peeropts : REMOTEAS as4number {
|
||||
"for 'add-path send no'");
|
||||
YYERROR;
|
||||
}
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
*ap++ &= ~CAPA_AP_SEND;
|
||||
break;
|
||||
mode = ADDPATH_EVAL_NONE;
|
||||
} else if (!strcmp($4, "all")) {
|
||||
free($4);
|
||||
if ($5 != 0 || $6 != 0) {
|
||||
@ -1971,8 +1969,12 @@ peeropts : REMOTEAS as4number {
|
||||
free($4);
|
||||
YYERROR;
|
||||
}
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
*ap++ |= CAPA_AP_SEND;
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (mode != ADDPATH_EVAL_NONE)
|
||||
ap[i] |= CAPA_AP_SEND;
|
||||
else
|
||||
ap[i] &= ~CAPA_AP_SEND;
|
||||
}
|
||||
curpeer->conf.eval.mode = mode;
|
||||
curpeer->conf.eval.extrapaths = $5;
|
||||
curpeer->conf.eval.maxpaths = $6;
|
||||
@ -4611,7 +4613,6 @@ struct peer *
|
||||
alloc_peer(void)
|
||||
{
|
||||
struct peer *p;
|
||||
uint8_t i;
|
||||
|
||||
if ((p = calloc(1, sizeof(struct peer))) == NULL)
|
||||
fatal("new_peer");
|
||||
@ -4622,8 +4623,6 @@ alloc_peer(void)
|
||||
p->conf.distance = 1;
|
||||
p->conf.export_type = EXPORT_UNSET;
|
||||
p->conf.announce_capa = 1;
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
p->conf.capabilities.mp[i] = 0;
|
||||
p->conf.capabilities.refresh = 1;
|
||||
p->conf.capabilities.grestart.restart = 1;
|
||||
p->conf.capabilities.as4byte = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: printconf.c,v 1.169 2024/01/10 13:31:09 claudio Exp $ */
|
||||
/* $OpenBSD: printconf.c,v 1.170 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -920,7 +920,7 @@ print_announce(struct peer_config *p, const char *c)
|
||||
if (p->announce_capa == 0)
|
||||
printf("%s\tannounce capabilities no\n", c);
|
||||
|
||||
for (aid = 0; aid < AID_MAX; aid++)
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++)
|
||||
if (p->capabilities.mp[aid])
|
||||
printf("%s\tannounce %s\n", c, aid2str(aid));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rde.c,v 1.623 2024/02/22 06:45:22 miod Exp $ */
|
||||
/* $OpenBSD: rde.c,v 1.624 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -442,7 +442,7 @@ rde_dispatch_imsg_session(struct imsgbuf *imsgbuf)
|
||||
log_warnx("%s: wrong imsg len", __func__);
|
||||
break;
|
||||
}
|
||||
if (aid >= AID_MAX) {
|
||||
if (aid < AID_MIN || aid >= AID_MAX) {
|
||||
log_warnx("%s: bad AID", __func__);
|
||||
break;
|
||||
}
|
||||
@ -1328,7 +1328,7 @@ rde_dispatch_imsg_peer(struct rde_peer *peer, void *bula)
|
||||
log_warnx("route refresh: wrong imsg len");
|
||||
break;
|
||||
}
|
||||
if (rr.aid >= AID_MAX) {
|
||||
if (rr.aid < AID_MIN || rr.aid >= AID_MAX) {
|
||||
log_peer_warnx(&peer->conf,
|
||||
"route refresh: bad AID %d", rr.aid);
|
||||
break;
|
||||
@ -3326,7 +3326,7 @@ rde_update_queue_pending(void)
|
||||
continue;
|
||||
if (peer->throttled)
|
||||
continue;
|
||||
for (aid = 0; aid < AID_MAX; aid++) {
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++) {
|
||||
if (!RB_EMPTY(&peer->updates[aid]) ||
|
||||
!RB_EMPTY(&peer->withdraws[aid]))
|
||||
return 1;
|
||||
@ -3821,7 +3821,7 @@ rde_softreconfig_in_done(void *arg, uint8_t dummy)
|
||||
peer->reconf_out = 0;
|
||||
} else if (peer->export_type == EXPORT_DEFAULT_ROUTE) {
|
||||
/* just resend the default route */
|
||||
for (aid = 0; aid < AID_MAX; aid++) {
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++) {
|
||||
if (peer->capa.mp[aid])
|
||||
up_generate_default(peer, aid);
|
||||
}
|
||||
@ -3831,7 +3831,7 @@ rde_softreconfig_in_done(void *arg, uint8_t dummy)
|
||||
RECONF_RELOAD;
|
||||
} else if (peer->reconf_rib) {
|
||||
/* dump the full table to neighbors that changed rib */
|
||||
for (aid = 0; aid < AID_MAX; aid++) {
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++) {
|
||||
if (peer->capa.mp[aid])
|
||||
peer_dump(peer, aid);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rde_peer.c,v 1.35 2024/02/03 09:26:52 jsg Exp $ */
|
||||
/* $OpenBSD: rde_peer.c,v 1.36 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -44,18 +44,15 @@ peer_has_as4byte(struct rde_peer *peer)
|
||||
return (peer->capa.as4byte);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if ADD_PATH is enabled for aid and mode (rx / tx). If aid is
|
||||
* AID_UNSPEC then the function returns true if any aid has mode enabled.
|
||||
*/
|
||||
int
|
||||
peer_has_add_path(struct rde_peer *peer, uint8_t aid, int mode)
|
||||
{
|
||||
if (aid >= AID_MAX)
|
||||
return 0;
|
||||
if (aid == AID_UNSPEC) {
|
||||
/* check if at capability is set for at least one AID */
|
||||
for (aid = AID_MIN; aid < AID_MAX; aid++)
|
||||
if (peer->capa.add_path[aid] & mode)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
return (peer->capa.add_path[aid] & mode);
|
||||
}
|
||||
|
||||
@ -444,7 +441,7 @@ peer_up(struct rde_peer *peer, struct session_up *sup)
|
||||
}
|
||||
peer->state = PEER_UP;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (peer->capa.mp[i])
|
||||
peer_dump(peer, i);
|
||||
}
|
||||
@ -500,7 +497,7 @@ peer_flush(struct rde_peer *peer, uint8_t aid, time_t staletime)
|
||||
/* every route is gone so reset staletime */
|
||||
if (aid == AID_UNSPEC) {
|
||||
uint8_t i;
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
for (i = AID_MIN; i < AID_MAX; i++)
|
||||
peer->staletime[i] = 0;
|
||||
} else {
|
||||
peer->staletime[aid] = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: session.c,v 1.463 2024/02/19 10:15:35 job Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.464 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
|
||||
@ -68,7 +68,7 @@ void session_tcp_established(struct peer *);
|
||||
void session_capa_ann_none(struct peer *);
|
||||
int session_capa_add(struct ibuf *, uint8_t, uint8_t);
|
||||
int session_capa_add_mp(struct ibuf *, uint8_t);
|
||||
int session_capa_add_afi(struct peer *, struct ibuf *, uint8_t, uint8_t);
|
||||
int session_capa_add_afi(struct ibuf *, uint8_t, uint8_t);
|
||||
struct bgp_msg *session_newmsg(enum msg_type, uint16_t);
|
||||
int session_sendmsg(struct bgp_msg *, struct peer *);
|
||||
void session_open(struct peer *);
|
||||
@ -1357,8 +1357,7 @@ session_capa_add_mp(struct ibuf *buf, uint8_t aid)
|
||||
}
|
||||
|
||||
int
|
||||
session_capa_add_afi(struct peer *p, struct ibuf *b, uint8_t aid,
|
||||
uint8_t flags)
|
||||
session_capa_add_afi(struct ibuf *b, uint8_t aid, uint8_t flags)
|
||||
{
|
||||
u_int errs = 0;
|
||||
uint16_t afi;
|
||||
@ -1492,7 +1491,7 @@ session_open(struct peer *p)
|
||||
}
|
||||
|
||||
/* multiprotocol extensions, RFC 4760 */
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
for (i = AID_MIN; i < AID_MAX; i++)
|
||||
if (p->capa.ann.mp[i]) { /* 4 bytes data */
|
||||
errs += session_capa_add(opb, CAPA_MP, 4);
|
||||
errs += session_capa_add_mp(opb, i);
|
||||
@ -1517,7 +1516,7 @@ session_open(struct peer *p)
|
||||
int rst = 0;
|
||||
uint16_t hdr = 0;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (p->capa.neg.grestart.flags[i] & CAPA_GR_RESTARTING)
|
||||
rst++;
|
||||
}
|
||||
@ -1536,7 +1535,7 @@ session_open(struct peer *p)
|
||||
}
|
||||
|
||||
/* advertisement of multiple paths, RFC7911 */
|
||||
if (p->capa.ann.add_path[0]) { /* variable */
|
||||
if (p->capa.ann.add_path[AID_MIN]) { /* variable */
|
||||
uint8_t aplen;
|
||||
|
||||
if (mpcapa)
|
||||
@ -1547,12 +1546,12 @@ session_open(struct peer *p)
|
||||
if (mpcapa) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (p->capa.ann.mp[i]) {
|
||||
errs += session_capa_add_afi(p, opb,
|
||||
errs += session_capa_add_afi(opb,
|
||||
i, p->capa.ann.add_path[i]);
|
||||
}
|
||||
}
|
||||
} else { /* AID_INET */
|
||||
errs += session_capa_add_afi(p, opb, AID_INET,
|
||||
errs += session_capa_add_afi(opb, AID_INET,
|
||||
p->capa.ann.add_path[AID_INET]);
|
||||
}
|
||||
}
|
||||
@ -1759,7 +1758,7 @@ session_neighbor_rrefresh(struct peer *p)
|
||||
if (!(p->capa.neg.refresh || p->capa.neg.enhanced_rr))
|
||||
return (-1);
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (p->capa.neg.mp[i] != 0)
|
||||
session_rrefresh(p, i, ROUTE_REFRESH_REQUEST);
|
||||
}
|
||||
@ -1828,7 +1827,7 @@ session_graceful_restart(struct peer *p)
|
||||
timer_set(&p->timers, Timer_RestartTimeout,
|
||||
p->capa.neg.grestart.timeout);
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (p->capa.neg.grestart.flags[i] & CAPA_GR_PRESENT) {
|
||||
if (imsg_rde(IMSG_SESSION_STALE, p->conf.id,
|
||||
&i, sizeof(i)) == -1)
|
||||
@ -1854,7 +1853,7 @@ session_graceful_stop(struct peer *p)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
/*
|
||||
* Only flush if the peer is restarting and the timeout fired.
|
||||
* In all other cases the session was already flushed when the
|
||||
@ -2485,7 +2484,6 @@ parse_notification(struct peer *peer)
|
||||
uint8_t capa_code;
|
||||
uint8_t capa_len;
|
||||
size_t reason_len;
|
||||
uint8_t i;
|
||||
|
||||
/* just log */
|
||||
p = peer->rbuf->rptr;
|
||||
@ -2545,8 +2543,8 @@ parse_notification(struct peer *peer)
|
||||
datalen -= capa_len;
|
||||
switch (capa_code) {
|
||||
case CAPA_MP:
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
peer->capa.ann.mp[i] = 0;
|
||||
memset(peer->capa.ann.mp, 0,
|
||||
sizeof(peer->capa.ann.mp));
|
||||
log_peer_warnx(&peer->conf,
|
||||
"disabling multiprotocol capability");
|
||||
break;
|
||||
@ -2840,12 +2838,11 @@ capa_neg_calc(struct peer *p, uint8_t *suberr)
|
||||
(p->capa.ann.refresh && p->capa.peer.refresh) != 0;
|
||||
p->capa.neg.enhanced_rr =
|
||||
(p->capa.ann.enhanced_rr && p->capa.peer.enhanced_rr) != 0;
|
||||
|
||||
p->capa.neg.as4byte =
|
||||
(p->capa.ann.as4byte && p->capa.peer.as4byte) != 0;
|
||||
|
||||
/* MP: both side must agree on the AFI,SAFI pair */
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if (p->capa.ann.mp[i] && p->capa.peer.mp[i])
|
||||
p->capa.neg.mp[i] = 1;
|
||||
else
|
||||
@ -2866,7 +2863,7 @@ capa_neg_calc(struct peer *p, uint8_t *suberr)
|
||||
* supporting graceful restart.
|
||||
*/
|
||||
|
||||
for (i = 0; i < AID_MAX; i++) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
int8_t negflags;
|
||||
|
||||
/* disable GR if the AFI/SAFI is not present */
|
||||
@ -2898,26 +2895,24 @@ capa_neg_calc(struct peer *p, uint8_t *suberr)
|
||||
if (p->capa.ann.grestart.restart == 0)
|
||||
p->capa.neg.grestart.restart = 0;
|
||||
|
||||
|
||||
/*
|
||||
* ADD-PATH: set only those bits where both sides agree.
|
||||
* For this compare our send bit with the recv bit from the peer
|
||||
* and vice versa.
|
||||
* The flags are stored from this systems view point.
|
||||
* At index 0 the flags are set if any per-AID flag is set.
|
||||
*/
|
||||
memset(p->capa.neg.add_path, 0, sizeof(p->capa.neg.add_path));
|
||||
if (p->capa.ann.add_path[0]) {
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if ((p->capa.ann.add_path[i] & CAPA_AP_RECV) &&
|
||||
(p->capa.peer.add_path[i] & CAPA_AP_SEND)) {
|
||||
p->capa.neg.add_path[i] |= CAPA_AP_RECV;
|
||||
p->capa.neg.add_path[0] |= CAPA_AP_RECV;
|
||||
}
|
||||
if ((p->capa.ann.add_path[i] & CAPA_AP_SEND) &&
|
||||
(p->capa.peer.add_path[i] & CAPA_AP_RECV)) {
|
||||
p->capa.neg.add_path[i] |= CAPA_AP_SEND;
|
||||
p->capa.neg.add_path[0] |= CAPA_AP_SEND;
|
||||
}
|
||||
for (i = AID_MIN; i < AID_MAX; i++) {
|
||||
if ((p->capa.ann.add_path[i] & CAPA_AP_RECV) &&
|
||||
(p->capa.peer.add_path[i] & CAPA_AP_SEND)) {
|
||||
p->capa.neg.add_path[i] |= CAPA_AP_RECV;
|
||||
p->capa.neg.add_path[0] |= CAPA_AP_RECV;
|
||||
}
|
||||
if ((p->capa.ann.add_path[i] & CAPA_AP_SEND) &&
|
||||
(p->capa.peer.add_path[i] & CAPA_AP_RECV)) {
|
||||
p->capa.neg.add_path[i] |= CAPA_AP_SEND;
|
||||
p->capa.neg.add_path[0] |= CAPA_AP_SEND;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3323,7 +3318,7 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
|
||||
log_warnx("no such peer: id=%u", peerid);
|
||||
break;
|
||||
}
|
||||
if (rr.aid >= AID_MAX)
|
||||
if (rr.aid < AID_MIN || rr.aid >= AID_MAX)
|
||||
fatalx("IMSG_REFRESH: bad AID");
|
||||
session_rrefresh(p, rr.aid, rr.subtype);
|
||||
break;
|
||||
@ -3338,7 +3333,7 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
|
||||
log_warnx("no such peer: id=%u", peerid);
|
||||
break;
|
||||
}
|
||||
if (aid >= AID_MAX)
|
||||
if (aid < AID_MIN || aid >= AID_MAX)
|
||||
fatalx("IMSG_SESSION_RESTARTED: bad AID");
|
||||
if (p->capa.neg.grestart.flags[aid] &
|
||||
CAPA_GR_RESTARTING) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: util.c,v 1.82 2024/02/22 06:45:22 miod Exp $ */
|
||||
/* $OpenBSD: util.c,v 1.83 2024/03/20 09:35:46 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -922,7 +922,7 @@ aid2str(uint8_t aid)
|
||||
int
|
||||
aid2afi(uint8_t aid, uint16_t *afi, uint8_t *safi)
|
||||
{
|
||||
if (aid < AID_MAX) {
|
||||
if (aid != AID_UNSPEC && aid < AID_MAX) {
|
||||
*afi = aid_vals[aid].afi;
|
||||
*safi = aid_vals[aid].safi;
|
||||
return (0);
|
||||
@ -935,7 +935,7 @@ afi2aid(uint16_t afi, uint8_t safi, uint8_t *aid)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
for (i = AID_MIN; i < AID_MAX; i++)
|
||||
if (aid_vals[i].afi == afi && aid_vals[i].safi == safi) {
|
||||
*aid = i;
|
||||
return (0);
|
||||
@ -960,7 +960,7 @@ af2aid(sa_family_t af, uint8_t safi, uint8_t *aid)
|
||||
if (safi == 0) /* default to unicast subclass */
|
||||
safi = SAFI_UNICAST;
|
||||
|
||||
for (i = 0; i < AID_MAX; i++)
|
||||
for (i = AID_UNSPEC; i < AID_MAX; i++)
|
||||
if (aid_vals[i].af == af && aid_vals[i].safi == safi) {
|
||||
*aid = i;
|
||||
return (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: x509.c,v 1.82 2024/03/19 05:04:13 tb Exp $ */
|
||||
/* $OpenBSD: x509.c,v 1.83 2024/03/20 04:36:30 job Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
|
||||
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -536,7 +536,23 @@ x509_get_sia(X509 *x, const char *fn, char **sia)
|
||||
continue;
|
||||
|
||||
if (strncasecmp(*sia, "rsync://", 8) == 0) {
|
||||
const char *p = *sia + strlen("rsync://");
|
||||
size_t fnlen, plen;
|
||||
|
||||
rsync_found = 1;
|
||||
|
||||
if (filemode)
|
||||
continue;
|
||||
|
||||
fnlen = strlen(fn);
|
||||
plen = strlen(p);
|
||||
|
||||
if (fnlen < plen || strcmp(p, fn + fnlen - plen) != 0) {
|
||||
warnx("%s: mismatch between pathname and SIA "
|
||||
"(%s)", fn, *sia);
|
||||
goto out;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: smtp_session.c,v 1.441 2024/01/28 17:23:17 op Exp $ */
|
||||
/* $OpenBSD: smtp_session.c,v 1.442 2024/03/20 17:52:43 op Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
|
||||
@ -2481,7 +2481,7 @@ smtp_tx_rcpt_to(struct smtp_tx *tx, const char *line)
|
||||
|
||||
if ((p = strchr(opt, ';')) == NULL ||
|
||||
!valid_xtext(p + 1) ||
|
||||
strlcpy(opt, tx->evp.dsn_orcpt, len) >= len) {
|
||||
strlcpy(tx->evp.dsn_orcpt, opt, len) >= len) {
|
||||
smtp_reply(tx->session,
|
||||
"553 ORCPT address syntax error");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user