sync code with last improvements from OpenBSD
This commit is contained in:
parent
4366cfe9ca
commit
d9327f18d0
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: sysctl.2,v 1.53 2023/10/01 15:58:11 krw Exp $
|
||||
.\" $OpenBSD: sysctl.2,v 1.55 2023/10/02 23:38:11 krw Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: October 1 2023 $
|
||||
.Dd $Mdocdate: October 2 2023 $
|
||||
.Dt SYSCTL 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -296,7 +296,7 @@ privileges may change the value.
|
||||
.It Dv HW_SENSORS Ta "node" Ta "not applicable"
|
||||
.It Dv HW_SETPERF Ta "integer" Ta "yes"
|
||||
.It Dv HW_SMT Ta "integer" Ta "yes"
|
||||
.It DV HW_UCOMNAMES Ta "string" Ta "no"
|
||||
.It Dv HW_UCOMNAMES Ta "string" Ta "no"
|
||||
.It Dv HW_USERMEM Ta "integer" Ta "no"
|
||||
.It Dv HW_USERMEM64 Ta "int64_t" Ta "no"
|
||||
.It Dv HW_UUID Ta "string" Ta "no"
|
||||
@ -403,13 +403,13 @@ A comma-separated list of currently attached
|
||||
devices in the following format:
|
||||
.Pp
|
||||
.Sm off
|
||||
.D1 Sy ucom Ar N : Sy usb Ar bus.route.interface
|
||||
.D1 Sy ucom Ar N : Sy usb Ar bus.rootport.route.interface
|
||||
.Sm on
|
||||
.Pp
|
||||
The
|
||||
.Ar route
|
||||
consists of five hexadecimal digits and identifies the port
|
||||
containing the
|
||||
consists of five hexadecimal digits identifying the path from
|
||||
the root port to the port containing the
|
||||
.Ar interface .
|
||||
.It Dv HW_USERMEM
|
||||
The amount of available non-kernel memory in bytes.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: asn1time.c,v 1.17 2023/08/30 10:13:12 job Exp $ */
|
||||
/* $OpenBSD: asn1time.c,v 1.20 2023/10/02 11:14:15 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
@ -28,7 +28,7 @@ struct asn1_time_test {
|
||||
time_t time;
|
||||
};
|
||||
|
||||
struct asn1_time_test asn1_invtime_tests[] = {
|
||||
static const struct asn1_time_test asn1_invtime_tests[] = {
|
||||
{
|
||||
.str = "",
|
||||
},
|
||||
@ -72,7 +72,7 @@ struct asn1_time_test asn1_invtime_tests[] = {
|
||||
},
|
||||
};
|
||||
|
||||
struct asn1_time_test asn1_invgentime_tests[] = {
|
||||
static const struct asn1_time_test asn1_invgentime_tests[] = {
|
||||
/* Generalized time with omitted seconds, should fail */
|
||||
{
|
||||
.str = "201612081934Z",
|
||||
@ -83,22 +83,7 @@ struct asn1_time_test asn1_invgentime_tests[] = {
|
||||
},
|
||||
};
|
||||
|
||||
struct asn1_time_test asn1_goodtime_tests[] = {
|
||||
{
|
||||
.str = "99990908234339Z",
|
||||
.time = 1,
|
||||
},
|
||||
{
|
||||
.str = "201612081934Z",
|
||||
.time = 1,
|
||||
},
|
||||
{
|
||||
.str = "1609082343Z",
|
||||
.time = 0,
|
||||
},
|
||||
};
|
||||
|
||||
struct asn1_time_test asn1_gentime_tests[] = {
|
||||
static const struct asn1_time_test asn1_gentime_tests[] = {
|
||||
{
|
||||
.str = "20161208193400Z",
|
||||
.data = "20161208193400Z",
|
||||
@ -131,7 +116,7 @@ struct asn1_time_test asn1_gentime_tests[] = {
|
||||
},
|
||||
};
|
||||
|
||||
struct asn1_time_test asn1_utctime_tests[] = {
|
||||
static const struct asn1_time_test asn1_utctime_tests[] = {
|
||||
{
|
||||
.str = "700101000000Z",
|
||||
.data = "700101000000Z",
|
||||
@ -211,7 +196,8 @@ asn1_compare_bytes(int test_no, const unsigned char *d1,
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
|
||||
asn1_compare_str(int test_no, const struct asn1_string_st *asn1str,
|
||||
const char *str)
|
||||
{
|
||||
int length = strlen(str);
|
||||
|
||||
@ -230,7 +216,7 @@ asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_invtime_test(int test_no, struct asn1_time_test *att, int gen)
|
||||
asn1_invtime_test(int test_no, const struct asn1_time_test *att, int gen)
|
||||
{
|
||||
ASN1_GENERALIZEDTIME *gt = NULL;
|
||||
ASN1_UTCTIME *ut = NULL;
|
||||
@ -282,7 +268,7 @@ asn1_invtime_test(int test_no, struct asn1_time_test *att, int gen)
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_gentime_test(int test_no, struct asn1_time_test *att)
|
||||
asn1_gentime_test(int test_no, const struct asn1_time_test *att)
|
||||
{
|
||||
const unsigned char *der;
|
||||
unsigned char *p = NULL;
|
||||
@ -361,7 +347,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att)
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_utctime_test(int test_no, struct asn1_time_test *att)
|
||||
asn1_utctime_test(int test_no, const struct asn1_time_test *att)
|
||||
{
|
||||
const unsigned char *der;
|
||||
unsigned char *p = NULL;
|
||||
@ -424,7 +410,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att)
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_time_test(int test_no, struct asn1_time_test *att, int type)
|
||||
asn1_time_test(int test_no, const struct asn1_time_test *att, int type)
|
||||
{
|
||||
ASN1_TIME *t = NULL, *tx509 = NULL;
|
||||
int failure = 1;
|
||||
@ -487,10 +473,97 @@ asn1_time_test(int test_no, struct asn1_time_test *att, int type)
|
||||
return (failure);
|
||||
}
|
||||
|
||||
static int
|
||||
time_t_cmp(time_t t1, time_t t2)
|
||||
{
|
||||
if (t1 < t2)
|
||||
return -1;
|
||||
if (t2 < t1)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_time_compare_families(const struct asn1_time_test *fam1, size_t fam1_size,
|
||||
const struct asn1_time_test *fam2, size_t fam2_size)
|
||||
{
|
||||
const struct asn1_time_test *att1, *att2;
|
||||
ASN1_TIME *t1 = NULL, *t2 = NULL;
|
||||
size_t i, j;
|
||||
int asn1_cmp, time_cmp;
|
||||
int comparison_failure = 0;
|
||||
int failure = 1;
|
||||
|
||||
if ((t1 = ASN1_TIME_new()) == NULL)
|
||||
goto done;
|
||||
if ((t2 = ASN1_TIME_new()) == NULL)
|
||||
goto done;
|
||||
|
||||
for (i = 0; i < fam1_size; i++) {
|
||||
att1 = &fam1[i];
|
||||
|
||||
if (!ASN1_TIME_set_string(t1, att1->str))
|
||||
goto done;
|
||||
for (j = 0; j < fam2_size; j++) {
|
||||
att2 = &fam2[j];
|
||||
|
||||
if (!ASN1_TIME_set_string(t2, att2->str))
|
||||
goto done;
|
||||
|
||||
time_cmp = time_t_cmp(att1->time, att2->time);
|
||||
asn1_cmp = ASN1_TIME_compare(t1, t2);
|
||||
|
||||
if (time_cmp != asn1_cmp) {
|
||||
fprintf(stderr, "%s vs. %s: want %d, got %d\n",
|
||||
att1->str, att2->str, time_cmp, asn1_cmp);
|
||||
comparison_failure |= 1;
|
||||
}
|
||||
|
||||
time_cmp = ASN1_TIME_cmp_time_t(t1, att2->time);
|
||||
if (time_cmp != asn1_cmp) {
|
||||
fprintf(stderr, "%s vs. %lld: want %d, got %d\n",
|
||||
att1->str, (long long)att2->time,
|
||||
asn1_cmp, time_cmp);
|
||||
comparison_failure |= 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX - add ASN1_UTCTIME_cmp_time_t later. Don't want
|
||||
* to mess with LIBRESSL_INTERNAL right before lock.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
failure = comparison_failure;
|
||||
|
||||
done:
|
||||
ASN1_TIME_free(t1);
|
||||
ASN1_TIME_free(t2);
|
||||
|
||||
return failure;
|
||||
}
|
||||
|
||||
static int
|
||||
asn1_time_compare_test(void)
|
||||
{
|
||||
const struct asn1_time_test *gen = asn1_gentime_tests;
|
||||
size_t gen_size = N_GENTIME_TESTS;
|
||||
const struct asn1_time_test *utc = asn1_utctime_tests;
|
||||
size_t utc_size = N_UTCTIME_TESTS;
|
||||
int failed = 0;
|
||||
|
||||
failed |= asn1_time_compare_families(gen, gen_size, gen, gen_size);
|
||||
failed |= asn1_time_compare_families(gen, gen_size, utc, utc_size);
|
||||
failed |= asn1_time_compare_families(utc, utc_size, gen, gen_size);
|
||||
failed |= asn1_time_compare_families(utc, utc_size, utc, utc_size);
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct asn1_time_test *att;
|
||||
const struct asn1_time_test *att;
|
||||
int failed = 0;
|
||||
size_t i;
|
||||
|
||||
@ -528,6 +601,9 @@ main(int argc, char **argv)
|
||||
failed |= asn1_time_test(i, att, V_ASN1_GENERALIZEDTIME);
|
||||
}
|
||||
|
||||
fprintf(stderr, "ASN1_TIME_compare tests...\n");
|
||||
failed |= asn1_time_compare_test();
|
||||
|
||||
/* Check for a leak in ASN1_TIME_normalize(). */
|
||||
failed |= ASN1_TIME_normalize(NULL) != 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.13 2023/08/14 09:26:37 anton Exp $
|
||||
# $OpenBSD: Makefile,v 1.14 2023/10/02 16:11:09 bluhm Exp $
|
||||
|
||||
# Copyright (c) 2021 Moritz Buhl <mbuhl@openbsd.org>
|
||||
#
|
||||
@ -92,7 +92,6 @@ FAILING+= run-cexp_test-7
|
||||
FAILING+= run-ctrig_test-{1,5}
|
||||
FAILING+= run-exponential_test-1
|
||||
FAILING+= run-invtrig_test-7
|
||||
FAILING+= run-nearbyint_test-1
|
||||
. elif ${MACHINE} == macppc
|
||||
FAILING+= run-cexp_test-7
|
||||
FAILING+= run-ctrig_test-{1,5}
|
||||
@ -101,7 +100,6 @@ FAILING+= run-fenv_test-{7,8}
|
||||
FAILING+= run-invtrig_test-7
|
||||
FAILING+= run-logarithm_test-3
|
||||
FAILING+= run-lrint_test-1
|
||||
FAILING+= run-nearbyint_test-1
|
||||
. elif ${MACHINE} == sparc64
|
||||
FAILING+= run-ctrig_test-5
|
||||
FAILING+= run-exponential_test-1
|
||||
@ -109,7 +107,6 @@ FAILING+= run-fma_test-{1,2,4,5,6}
|
||||
FAILING+= run-invtrig_test-{4,7}
|
||||
FAILING+= run-logarithm_test-5
|
||||
FAILING+= run-lrint_test-1
|
||||
FAILING+= run-nearbyint_test-1
|
||||
FAILING+= run-next_test-{1,2,4}
|
||||
FAILING+= run-rem_test-{1,2}
|
||||
FAILING+= run-trig_test-{1,2}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ucom.c,v 1.76 2023/10/01 15:58:11 krw Exp $ */
|
||||
/* $OpenBSD: ucom.c,v 1.77 2023/10/02 23:38:11 krw Exp $ */
|
||||
/* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
@ -75,6 +75,9 @@ int ucomdebug = 0;
|
||||
#define UCOMUNIT(x) (minor(x) & UCOMUNIT_MASK)
|
||||
#define UCOMCUA(x) (minor(x) & UCOMCUA_MASK)
|
||||
|
||||
#define ROUTEROOTPORT(_x) ((_x) & 0xff)
|
||||
#define ROUTESTRING(_x) (((_x) >> 8) & 0xfffff)
|
||||
|
||||
struct ucom_softc {
|
||||
struct device sc_dev; /* base device */
|
||||
|
||||
@ -178,13 +181,15 @@ ucom_match(struct device *parent, void *match, void *aux)
|
||||
void
|
||||
ucom_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
char path[32]; /* "usb000.000.00000.000" */
|
||||
struct ucom_softc *sc = (struct ucom_softc *)self;
|
||||
struct ucom_attach_args *uca = aux;
|
||||
struct tty *tp;
|
||||
uint32_t route;
|
||||
uint8_t bus, ifaceno;
|
||||
|
||||
if (uca->info != NULL)
|
||||
printf(", %s", uca->info);
|
||||
printf("\n");
|
||||
|
||||
sc->sc_uparent = uca->device;
|
||||
sc->sc_iface = uca->iface;
|
||||
@ -199,6 +204,15 @@ ucom_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_parent = uca->arg;
|
||||
sc->sc_portno = uca->portno;
|
||||
|
||||
if (usbd_get_location(sc->sc_uparent, sc->sc_iface, &bus, &route,
|
||||
&ifaceno) == 0) {
|
||||
if (snprintf(path, sizeof(path), "usb%u.%u.%05x.%u", bus,
|
||||
ROUTEROOTPORT(route), ROUTESTRING(route), ifaceno) <
|
||||
sizeof(path))
|
||||
printf(": %s", path);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
tp = ttymalloc(1000000);
|
||||
tp->t_oproc = ucomstart;
|
||||
tp->t_param = ucomparam;
|
||||
@ -1237,7 +1251,7 @@ sysctl_ucominit(void)
|
||||
{
|
||||
static char *ucoms = NULL;
|
||||
static size_t ucomslen = 0;
|
||||
char name[34]; /* sizeof(dv_xname) + strlen(":usb000.00000.000,") */
|
||||
char name[64]; /* dv_xname + ":usb000.000.00000.000," */
|
||||
struct ucom_softc *sc;
|
||||
int rslt;
|
||||
unsigned int unit;
|
||||
@ -1260,9 +1274,11 @@ sysctl_ucominit(void)
|
||||
if (usbd_get_location(sc->sc_uparent, sc->sc_iface,
|
||||
&bus, &route, &ifaceidx) == -1)
|
||||
continue;
|
||||
rslt = snprintf(name, sizeof(name), "%s:usb%u.%05x.%u,",
|
||||
sc->sc_dev.dv_xname, bus, route, ifaceidx);
|
||||
if (rslt < sizeof(name) && (strlen(ucoms) + rslt) < ucomslen)
|
||||
rslt = snprintf(name, sizeof(name),
|
||||
"%s:usb%u.%u.%05x.%u,", sc->sc_dev.dv_xname, bus,
|
||||
ROUTEROOTPORT(route), ROUTESTRING(route), ifaceidx);
|
||||
if (rslt < sizeof(name) && (strlen(ucoms) + rslt) <
|
||||
ucomslen)
|
||||
strlcat(ucoms, name, ucomslen);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: usb_subr.c,v 1.160 2023/10/01 15:58:11 krw Exp $ */
|
||||
/* $OpenBSD: usb_subr.c,v 1.161 2023/10/02 23:38:11 krw Exp $ */
|
||||
/* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
|
||||
|
||||
@ -1343,7 +1343,7 @@ usbd_get_routestring(struct usbd_device *dev, uint32_t *route)
|
||||
* section 8.9 of USB 3.1 Specification for more details.
|
||||
*/
|
||||
r = dev->powersrc ? dev->powersrc->portno : 0;
|
||||
for (hub = dev->myhub; hub && hub->depth; hub = hub->myhub) {
|
||||
for (hub = dev->myhub; hub && hub->depth > 1; hub = hub->myhub) {
|
||||
port = hub->powersrc ? hub->powersrc->portno : 0;
|
||||
if (port > 15)
|
||||
return -1;
|
||||
@ -1351,6 +1351,11 @@ usbd_get_routestring(struct usbd_device *dev, uint32_t *route)
|
||||
r |= port;
|
||||
}
|
||||
|
||||
/* Add in the host root port, of which there may be 255. */
|
||||
port = (hub && hub->powersrc) ? hub->powersrc->portno : 0;
|
||||
r <<= 8;
|
||||
r |= port;
|
||||
|
||||
*route = r;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: cu.1,v 1.22 2022/08/04 04:01:48 jsg Exp $
|
||||
.\" $OpenBSD: cu.1,v 1.24 2023/10/02 23:38:11 krw Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: August 4 2022 $
|
||||
.Dd $Mdocdate: October 2 2023 $
|
||||
.Dt CU 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -60,11 +60,13 @@ should not allow the driver to block waiting for a carrier to be detected.
|
||||
Specify an escape character to use instead of the default tilde.
|
||||
.It Fl l Ar line
|
||||
Specify the line to use.
|
||||
Either of the forms like
|
||||
.Pa cua00
|
||||
Any of the forms
|
||||
.Pa cua00 ,
|
||||
.Pa /dev/cua00 ,
|
||||
or
|
||||
.Pa /dev/cua00
|
||||
.Pa usb0.1.00002.3
|
||||
are permitted.
|
||||
.Pp
|
||||
The default is
|
||||
.Pa /dev/cua00 .
|
||||
See
|
||||
@ -75,6 +77,12 @@ Users in group
|
||||
are permitted to use
|
||||
.Xr cua 4
|
||||
devices by default.
|
||||
.Pp
|
||||
See
|
||||
.Xr sysctl 2
|
||||
.Va hw.ucomnames
|
||||
for available USB serial lines.
|
||||
.Pp
|
||||
.It Fl r
|
||||
Start
|
||||
.Nm
|
||||
@ -199,6 +207,8 @@ host description file
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std cu
|
||||
.Sh SEE ALSO
|
||||
.Xr sysctl 2 ,
|
||||
.Xr cua 4 ,
|
||||
.Xr remote 5
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cu.c,v 1.28 2019/06/28 13:35:00 deraadt Exp $ */
|
||||
/* $OpenBSD: cu.c,v 1.29 2023/10/02 14:48:11 krw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
|
||||
@ -16,10 +16,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <event.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
@ -64,6 +67,8 @@ void stream_error(struct bufferevent *, short, void *);
|
||||
void line_read(struct bufferevent *, void *);
|
||||
void line_error(struct bufferevent *, short, void *);
|
||||
void try_remote(const char *, const char *, const char *);
|
||||
char *get_ucomnames(void);
|
||||
char *find_ucom(const char *, char *);
|
||||
|
||||
__dead void
|
||||
usage(void)
|
||||
@ -78,9 +83,11 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
const char *errstr;
|
||||
char *tmp, *s, *host;
|
||||
char *tmp, *s, *host, *ucomnames;
|
||||
int opt, i, flags;
|
||||
|
||||
ucomnames = get_ucomnames();
|
||||
|
||||
if (pledge("stdio rpath wpath cpath getpw proc exec tty",
|
||||
NULL) == -1)
|
||||
err(1, "pledge");
|
||||
@ -166,6 +173,12 @@ main(int argc, char **argv)
|
||||
if (is_direct == -1)
|
||||
is_direct = 0;
|
||||
|
||||
if (strncasecmp(line_path, "usb", 3) == 0) {
|
||||
tmp = find_ucom(line_path, ucomnames);
|
||||
if (tmp == NULL)
|
||||
errx(1, "No ucom matched '%s'", line_path);
|
||||
line_path = tmp;
|
||||
}
|
||||
if (strchr(line_path, '/') == NULL) {
|
||||
if (asprintf(&tmp, "%s%s", _PATH_DEV, line_path) == -1)
|
||||
err(1, "asprintf");
|
||||
@ -461,3 +474,54 @@ no_change:
|
||||
cu_err(1, "strdup");
|
||||
return (out);
|
||||
}
|
||||
|
||||
char *
|
||||
get_ucomnames(void)
|
||||
{
|
||||
char *names;
|
||||
int mib[2];
|
||||
size_t size;
|
||||
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_UCOMNAMES;
|
||||
names = NULL;
|
||||
size = 0;
|
||||
for (;;) {
|
||||
if (sysctl(mib, 2, NULL, &size, NULL, 0) == -1 || size == 0)
|
||||
err(1, "hw.ucomnames");
|
||||
if ((names = realloc(names, size)) == NULL)
|
||||
err(1, NULL);
|
||||
if (sysctl(mib, 2, names, &size, NULL, 0) != -1)
|
||||
break;
|
||||
if (errno != ENOMEM)
|
||||
err(1, "hw.ucomnames");
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
char *
|
||||
find_ucom(const char *usbid, char *names)
|
||||
{
|
||||
char *cua, *id, *ucom;
|
||||
|
||||
if (names == NULL)
|
||||
return NULL;
|
||||
|
||||
/* names is a comma separated list of "ucom<unit#>-<usb id>". */
|
||||
cua = NULL;
|
||||
for (ucom = strsep(&names, ","); ucom; ucom = strsep(&names, ",")) {
|
||||
if (*ucom == '\0' || strncasecmp(ucom, "ucom", 4))
|
||||
continue;
|
||||
ucom += 4;
|
||||
id = strchr(ucom, ':');
|
||||
if (id == NULL)
|
||||
continue;
|
||||
*id++ = '\0';
|
||||
if (strcasecmp(id, usbid) == 0) {
|
||||
if (asprintf(&cua, "cuaU%s", ucom) == -1)
|
||||
err(1, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cua;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $OpenBSD: version.h,v 1.17 2023/07/28 20:28:11 benno Exp $ */
|
||||
/* $OpenBSD: version.h,v 1.18 2023/10/02 13:31:32 claudio Exp $ */
|
||||
|
||||
#define RPKI_VERSION "8.5"
|
||||
#define RPKI_VERSION "8.6"
|
||||
|
Loading…
Reference in New Issue
Block a user