sync with OpenBSD -current
This commit is contained in:
parent
9fbd947ba3
commit
8873eac723
33 changed files with 1109 additions and 413 deletions
|
@ -1,4 +1,4 @@
|
|||
$OpenBSD: pcidevs,v 1.2058 2023/11/29 06:46:29 jmatthew Exp $
|
||||
$OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp $
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -818,6 +818,22 @@ product AMD 19_6X_DF_5 0x14e4 19h/6xh Data Fabric
|
|||
product AMD 19_6X_DF_6 0x14e5 19h/6xh Data Fabric
|
||||
product AMD 19_6X_DF_7 0x14e6 19h/6xh Data Fabric
|
||||
product AMD 19_6X_DF_8 0x14e7 19h/6xh Data Fabric
|
||||
product AMD 19_7X_RC 0x14e8 19h/7xh Root Complex
|
||||
product AMD 19_7X_IOMMU 0x14e9 19h/7xh IOMMU
|
||||
product AMD 19_7X_HB 0x14ea 19h/7xh Host
|
||||
product AMD 19_7X_PCIE_1 0x14eb 19h/7xh PCIE
|
||||
product AMD 19_7X_PCIE_2 0x14ed 19h/7xh PCIE
|
||||
product AMD 19_7X_PCIE_3 0x14ee 19h/7xh PCIE
|
||||
product AMD 19_7X_PCIE_4 0x14ef 19h/7xh PCIE
|
||||
product AMD 19_7X_DF_1 0x14f0 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_2 0x14f1 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_3 0x14f2 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_4 0x14f3 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_5 0x14f4 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_6 0x14f5 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_7 0x14f6 19h/7xh Data Fabric
|
||||
product AMD 19_7X_DF_8 0x14f7 19h/7xh Data Fabric
|
||||
product AMD 19_7X_IPU 0x1502 19h/7xh IPU
|
||||
product AMD 14_HB 0x1510 14h Host
|
||||
product AMD 14_PCIE_1 0x1512 14h PCIE
|
||||
product AMD 14_PCIE_2 0x1513 14h PCIE
|
||||
|
@ -855,6 +871,11 @@ product AMD 16_3X_MISC_2 0x1585 16h Misc Cfg
|
|||
product AMD 19_6X_XHCI_1 0x15b6 19h/6xh xHCI
|
||||
product AMD 19_6X_XHCI_2 0x15b7 19h/6xh xHCI
|
||||
product AMD 19_6X_XHCI_3 0x15b8 19h/6xh xHCI
|
||||
product AMD 19_7X_XHCI_1 0x15b9 19h/7xh xHCI
|
||||
product AMD 19_7X_XHCI_2 0x15ba 19h/7xh xHCI
|
||||
product AMD 19_7X_XHCI_3 0x15c0 19h/7xh xHCI
|
||||
product AMD 19_7X_XHCI_4 0x15c1 19h/7xh xHCI
|
||||
product AMD 19_7X_PSP 0x15c7 19h/7xh PSP
|
||||
product AMD 17_1X_RC 0x15d0 17h/1xh Root Complex
|
||||
product AMD 17_1X_IOMMU 0x15d1 17h/1xh IOMMU
|
||||
product AMD 17_1X_PCIE_1 0x15d3 17h/1xh PCIE
|
||||
|
@ -906,6 +927,8 @@ product AMD 17_90_DF_4 0x1664 17h/90h Data Fabric
|
|||
product AMD 17_90_DF_5 0x1665 17h/90h Data Fabric
|
||||
product AMD 17_90_DF_6 0x1666 17h/90h Data Fabric
|
||||
product AMD 17_90_DF_7 0x1667 17h/90h Data Fabric
|
||||
product AMD 19_7X_USB4_1 0x1668 19h/7xh USB4
|
||||
product AMD 19_7X_USB4_2 0x1669 19h/7xh USB4
|
||||
product AMD 19_5X_DF_0 0x166a 19h/5xh Data Fabric
|
||||
product AMD 19_5X_DF_1 0x166b 19h/5xh Data Fabric
|
||||
product AMD 19_5X_DF_2 0x166c 19h/5xh Data Fabric
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*
|
||||
* generated from:
|
||||
* OpenBSD: pcidevs,v 1.2058 2023/11/29 06:46:29 jmatthew Exp
|
||||
* OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp
|
||||
*/
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
||||
|
@ -823,6 +823,22 @@
|
|||
#define PCI_PRODUCT_AMD_19_6X_DF_6 0x14e5 /* 19h/6xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_6X_DF_7 0x14e6 /* 19h/6xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_6X_DF_8 0x14e7 /* 19h/6xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_RC 0x14e8 /* 19h/7xh Root Complex */
|
||||
#define PCI_PRODUCT_AMD_19_7X_IOMMU 0x14e9 /* 19h/7xh IOMMU */
|
||||
#define PCI_PRODUCT_AMD_19_7X_HB 0x14ea /* 19h/7xh Host */
|
||||
#define PCI_PRODUCT_AMD_19_7X_PCIE_1 0x14eb /* 19h/7xh PCIE */
|
||||
#define PCI_PRODUCT_AMD_19_7X_PCIE_2 0x14ed /* 19h/7xh PCIE */
|
||||
#define PCI_PRODUCT_AMD_19_7X_PCIE_3 0x14ee /* 19h/7xh PCIE */
|
||||
#define PCI_PRODUCT_AMD_19_7X_PCIE_4 0x14ef /* 19h/7xh PCIE */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_1 0x14f0 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_2 0x14f1 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_3 0x14f2 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_4 0x14f3 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_5 0x14f4 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_6 0x14f5 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_7 0x14f6 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_DF_8 0x14f7 /* 19h/7xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_IPU 0x1502 /* 19h/7xh IPU */
|
||||
#define PCI_PRODUCT_AMD_14_HB 0x1510 /* 14h Host */
|
||||
#define PCI_PRODUCT_AMD_14_PCIE_1 0x1512 /* 14h PCIE */
|
||||
#define PCI_PRODUCT_AMD_14_PCIE_2 0x1513 /* 14h PCIE */
|
||||
|
@ -860,6 +876,11 @@
|
|||
#define PCI_PRODUCT_AMD_19_6X_XHCI_1 0x15b6 /* 19h/6xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_6X_XHCI_2 0x15b7 /* 19h/6xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_6X_XHCI_3 0x15b8 /* 19h/6xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_7X_XHCI_1 0x15b9 /* 19h/7xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_7X_XHCI_2 0x15ba /* 19h/7xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_7X_XHCI_3 0x15c0 /* 19h/7xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_7X_XHCI_4 0x15c1 /* 19h/7xh xHCI */
|
||||
#define PCI_PRODUCT_AMD_19_7X_PSP 0x15c7 /* 19h/7xh PSP */
|
||||
#define PCI_PRODUCT_AMD_17_1X_RC 0x15d0 /* 17h/1xh Root Complex */
|
||||
#define PCI_PRODUCT_AMD_17_1X_IOMMU 0x15d1 /* 17h/1xh IOMMU */
|
||||
#define PCI_PRODUCT_AMD_17_1X_PCIE_1 0x15d3 /* 17h/1xh PCIE */
|
||||
|
@ -911,6 +932,8 @@
|
|||
#define PCI_PRODUCT_AMD_17_90_DF_5 0x1665 /* 17h/90h Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_17_90_DF_6 0x1666 /* 17h/90h Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_17_90_DF_7 0x1667 /* 17h/90h Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_7X_USB4_1 0x1668 /* 19h/7xh USB4 */
|
||||
#define PCI_PRODUCT_AMD_19_7X_USB4_2 0x1669 /* 19h/7xh USB4 */
|
||||
#define PCI_PRODUCT_AMD_19_5X_DF_0 0x166a /* 19h/5xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_5X_DF_1 0x166b /* 19h/5xh Data Fabric */
|
||||
#define PCI_PRODUCT_AMD_19_5X_DF_2 0x166c /* 19h/5xh Data Fabric */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*
|
||||
* generated from:
|
||||
* OpenBSD: pcidevs,v 1.2058 2023/11/29 06:46:29 jmatthew Exp
|
||||
* OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp
|
||||
*/
|
||||
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
@ -1535,6 +1535,70 @@ static const struct pci_known_product pci_known_products[] = {
|
|||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_6X_DF_8,
|
||||
"19h/6xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_RC,
|
||||
"19h/7xh Root Complex",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_IOMMU,
|
||||
"19h/7xh IOMMU",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_HB,
|
||||
"19h/7xh Host",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PCIE_1,
|
||||
"19h/7xh PCIE",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PCIE_2,
|
||||
"19h/7xh PCIE",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PCIE_3,
|
||||
"19h/7xh PCIE",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PCIE_4,
|
||||
"19h/7xh PCIE",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_1,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_2,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_3,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_4,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_5,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_6,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_7,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_DF_8,
|
||||
"19h/7xh Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_IPU,
|
||||
"19h/7xh IPU",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_14_HB,
|
||||
"14h Host",
|
||||
|
@ -1683,6 +1747,26 @@ static const struct pci_known_product pci_known_products[] = {
|
|||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_6X_XHCI_3,
|
||||
"19h/6xh xHCI",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_1,
|
||||
"19h/7xh xHCI",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_2,
|
||||
"19h/7xh xHCI",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_3,
|
||||
"19h/7xh xHCI",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_4,
|
||||
"19h/7xh xHCI",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PSP,
|
||||
"19h/7xh PSP",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_1X_RC,
|
||||
"17h/1xh Root Complex",
|
||||
|
@ -1887,6 +1971,14 @@ static const struct pci_known_product pci_known_products[] = {
|
|||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_90_DF_7,
|
||||
"17h/90h Data Fabric",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_USB4_1,
|
||||
"19h/7xh USB4",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_USB4_2,
|
||||
"19h/7xh USB4",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_5X_DF_0,
|
||||
"19h/5xh Data Fabric",
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/* $OpenBSD: ugold.c,v 1.23 2023/04/19 04:51:53 miod Exp $ */
|
||||
/* $OpenBSD: ugold.c,v 1.24 2023/11/30 20:08:23 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Takayoshi SASANO <uaa@openbsd.org>
|
||||
* Copyright (c) 2013 Martin Pieuchot <mpi@openbsd.org>
|
||||
* Copyright (c) 2015 Joerg Jung <jung@openbsd.org>
|
||||
* Copyright (c) 2023 Miodrag Vallat.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -44,11 +45,13 @@
|
|||
#define UGOLD_CMD_DATA 0x80
|
||||
#define UGOLD_CMD_INIT 0x82
|
||||
|
||||
#define UGOLD_TYPE_INVALID -1
|
||||
#define UGOLD_TYPE_SI7005 1
|
||||
#define UGOLD_TYPE_SI7006 2
|
||||
#define UGOLD_TYPE_SHT1X 3
|
||||
#define UGOLD_TYPE_GOLD 4
|
||||
#define UGOLD_TYPE_TEMPERX 5
|
||||
#define UGOLD_TYPE_DS75 6
|
||||
|
||||
/*
|
||||
* This driver uses three known commands for the TEMPer and TEMPerHUM
|
||||
|
@ -69,6 +72,13 @@
|
|||
static uint8_t cmd_data[8] = { 0x01, 0x80, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00 };
|
||||
static uint8_t cmd_init[8] = { 0x01, 0x82, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00 };
|
||||
static uint8_t cmd_type[8] = { 0x01, 0x86, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00 };
|
||||
/*
|
||||
* The following command is also recognized and reports some kind of status
|
||||
* byte (i.e. 87 xx 00 00 00 00 00 00).
|
||||
{ 0x01, 0x87, 0xee, 0x01, 0x00, 0x00, 0x00, 0x00 };
|
||||
*/
|
||||
|
||||
struct ugold_softc;
|
||||
|
||||
struct ugold_softc {
|
||||
struct uhidev sc_hdev;
|
||||
|
@ -77,15 +87,21 @@ struct ugold_softc {
|
|||
int sc_num_sensors;
|
||||
int sc_type;
|
||||
|
||||
char sc_model[16 + 1];
|
||||
unsigned int sc_model_len;
|
||||
|
||||
struct ksensor sc_sensor[UGOLD_MAX_SENSORS];
|
||||
struct ksensordev sc_sensordev;
|
||||
struct sensor_task *sc_sensortask;
|
||||
|
||||
void (*sc_intr)(struct ugold_softc *, uint8_t *, u_int);
|
||||
};
|
||||
|
||||
const struct usb_devno ugold_devs[] = {
|
||||
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPER },
|
||||
{ USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TEMPERHUM },
|
||||
{ USB_VENDOR_PCSENSORS, USB_PRODUCT_PCSENSORS_TEMPER },
|
||||
{ USB_VENDOR_RDING, USB_PRODUCT_RDING_TEMPER },
|
||||
{ USB_VENDOR_WCH2, USB_PRODUCT_WCH2_TEMPER },
|
||||
};
|
||||
|
||||
|
@ -93,8 +109,10 @@ int ugold_match(struct device *, void *, void *);
|
|||
void ugold_attach(struct device *, struct device *, void *);
|
||||
int ugold_detach(struct device *, int);
|
||||
|
||||
void ugold_ds75_intr(struct uhidev *, void *, u_int);
|
||||
void ugold_si700x_intr(struct uhidev *, void *, u_int);
|
||||
void ugold_setup_sensors(struct ugold_softc *);
|
||||
void ugold_intr(struct uhidev *, void *, u_int);
|
||||
void ugold_ds75_intr(struct ugold_softc *, uint8_t *, u_int);
|
||||
void ugold_si700x_intr(struct ugold_softc *, uint8_t *, u_int);
|
||||
void ugold_refresh(void *);
|
||||
|
||||
int ugold_issue_cmd(struct ugold_softc *, uint8_t *, int);
|
||||
|
@ -146,14 +164,16 @@ ugold_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_udev = uha->parent->sc_udev;
|
||||
sc->sc_hdev.sc_parent = uha->parent;
|
||||
sc->sc_hdev.sc_report_id = uha->reportid;
|
||||
sc->sc_hdev.sc_intr = ugold_intr;
|
||||
switch (uha->uaa->product) {
|
||||
case USB_PRODUCT_MICRODIA_TEMPER:
|
||||
sc->sc_hdev.sc_intr = ugold_ds75_intr;
|
||||
sc->sc_intr = ugold_ds75_intr;
|
||||
break;
|
||||
case USB_PRODUCT_MICRODIA_TEMPERHUM:
|
||||
case USB_PRODUCT_PCSENSORS_TEMPER:
|
||||
case USB_PRODUCT_RDING_TEMPER:
|
||||
case USB_PRODUCT_WCH2_TEMPER:
|
||||
sc->sc_hdev.sc_intr = ugold_si700x_intr;
|
||||
sc->sc_intr = ugold_si700x_intr;
|
||||
break;
|
||||
default:
|
||||
printf(", unknown product\n");
|
||||
|
@ -174,33 +194,7 @@ ugold_attach(struct device *parent, struct device *self, void *aux)
|
|||
strlcpy(sc->sc_sensordev.xname, sc->sc_hdev.sc_dev.dv_xname,
|
||||
sizeof(sc->sc_sensordev.xname));
|
||||
|
||||
switch (uha->uaa->product) {
|
||||
case USB_PRODUCT_MICRODIA_TEMPER:
|
||||
/* 2 temperature sensors */
|
||||
sc->sc_sensor[UGOLD_INNER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_INNER].desc, "inner",
|
||||
sizeof(sc->sc_sensor[UGOLD_INNER].desc));
|
||||
sc->sc_sensor[UGOLD_OUTER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_OUTER].desc, "outer",
|
||||
sizeof(sc->sc_sensor[UGOLD_OUTER].desc));
|
||||
break;
|
||||
case USB_PRODUCT_MICRODIA_TEMPERHUM:
|
||||
case USB_PRODUCT_PCSENSORS_TEMPER:
|
||||
case USB_PRODUCT_WCH2_TEMPER:
|
||||
/* 1 temperature and 1 humidity sensor */
|
||||
sc->sc_sensor[UGOLD_INNER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_INNER].desc, "inner",
|
||||
sizeof(sc->sc_sensor[UGOLD_INNER].desc));
|
||||
sc->sc_sensor[UGOLD_HUM].type = SENSOR_HUMIDITY;
|
||||
strlcpy(sc->sc_sensor[UGOLD_HUM].desc, "RH",
|
||||
sizeof(sc->sc_sensor[UGOLD_HUM].desc));
|
||||
break;
|
||||
default:
|
||||
printf(", unknown product\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 0.1Hz */
|
||||
/* 0.166Hz */
|
||||
sc->sc_sensortask = sensor_task_register(sc, ugold_refresh, 6);
|
||||
if (sc->sc_sensortask == NULL) {
|
||||
printf(", unable to register update task\n");
|
||||
|
@ -208,6 +202,9 @@ ugold_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
printf("\n");
|
||||
|
||||
/* speed up sensor identification */
|
||||
ugold_refresh(sc);
|
||||
|
||||
sensordev_install(&sc->sc_sensordev);
|
||||
}
|
||||
|
||||
|
@ -222,8 +219,10 @@ ugold_detach(struct device *self, int flags)
|
|||
sensordev_deinstall(&sc->sc_sensordev);
|
||||
}
|
||||
|
||||
for (i = 0; i < sc->sc_num_sensors; i++)
|
||||
sensor_detach(&sc->sc_sensordev, &sc->sc_sensor[i]);
|
||||
if (sc->sc_type != UGOLD_TYPE_INVALID) {
|
||||
for (i = 0; i < sc->sc_num_sensors; i++)
|
||||
sensor_detach(&sc->sc_sensordev, &sc->sc_sensor[i]);
|
||||
}
|
||||
|
||||
if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
|
||||
uhidev_close(&sc->sc_hdev);
|
||||
|
@ -231,6 +230,72 @@ ugold_detach(struct device *self, int flags)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ugold_setup_sensors(struct ugold_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (sc->sc_type) {
|
||||
default:
|
||||
return;
|
||||
case UGOLD_TYPE_SI7005:
|
||||
case UGOLD_TYPE_SI7006:
|
||||
case UGOLD_TYPE_SHT1X:
|
||||
case UGOLD_TYPE_TEMPERX:
|
||||
/* 1 temperature and 1 humidity sensor */
|
||||
sc->sc_sensor[UGOLD_INNER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_INNER].desc, "inner",
|
||||
sizeof(sc->sc_sensor[UGOLD_INNER].desc));
|
||||
sc->sc_sensor[UGOLD_HUM].type = SENSOR_HUMIDITY;
|
||||
strlcpy(sc->sc_sensor[UGOLD_HUM].desc, "RH",
|
||||
sizeof(sc->sc_sensor[UGOLD_HUM].desc));
|
||||
break;
|
||||
case UGOLD_TYPE_GOLD:
|
||||
case UGOLD_TYPE_DS75:
|
||||
/* up to 2 temperature sensors */
|
||||
sc->sc_sensor[UGOLD_INNER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_INNER].desc, "inner",
|
||||
sizeof(sc->sc_sensor[UGOLD_INNER].desc));
|
||||
sc->sc_sensor[UGOLD_OUTER].type = SENSOR_TEMP;
|
||||
strlcpy(sc->sc_sensor[UGOLD_OUTER].desc, "outer",
|
||||
sizeof(sc->sc_sensor[UGOLD_OUTER].desc));
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < sc->sc_num_sensors; i++) {
|
||||
sc->sc_sensor[i].flags |= SENSOR_FINVALID;
|
||||
sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
strnvis(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *start, *end;
|
||||
int c;
|
||||
|
||||
for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
|
||||
if (c >= 0x20 && c <= 0x7f) {
|
||||
if (c == '\\') {
|
||||
/* need space for the extra '\\' */
|
||||
if (dst + 2 > end)
|
||||
break;
|
||||
*dst++ = '\\';
|
||||
}
|
||||
*dst++ = c;
|
||||
} else {
|
||||
if (dst + 4 > end)
|
||||
break;
|
||||
*dst++ = '\\';
|
||||
*dst++ = ((u_char)c >> 6 & 07) + '0';
|
||||
*dst++ = ((u_char)c >> 3 & 07) + '0';
|
||||
*dst++ = ((u_char)c & 07) + '0';
|
||||
}
|
||||
src++;
|
||||
}
|
||||
if (siz > 0)
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
static int
|
||||
ugold_ds75_temp(uint8_t msb, uint8_t lsb)
|
||||
{
|
||||
|
@ -239,39 +304,42 @@ ugold_ds75_temp(uint8_t msb, uint8_t lsb)
|
|||
}
|
||||
|
||||
static void
|
||||
ugold_ds75_type(struct ugold_softc *sc, uint8_t *buf, u_int len)
|
||||
ugold_ds75_type(struct ugold_softc *sc)
|
||||
{
|
||||
if (memcmp(buf, "TEMPer1F", len) == 0 ||
|
||||
memcmp(buf, "TEMPer2F", len) == 0 ||
|
||||
memcmp(buf, "TEMPerF1", len) == 0)
|
||||
return; /* skip first half of the answer */
|
||||
char model[4 * sizeof(sc->sc_model) + 1];
|
||||
|
||||
printf("%s: %d sensor%s type ds75/12bit (temperature)\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, sc->sc_num_sensors,
|
||||
(sc->sc_num_sensors == 1) ? "" : "s");
|
||||
strnvis(model, sc->sc_model, sizeof model);
|
||||
|
||||
sc->sc_type = -1; /* ignore type */
|
||||
if (memcmp(sc->sc_model, "TEMPer1F", 8) == 0 ||
|
||||
memcmp(sc->sc_model, "TEMPer2F", 8) == 0 ||
|
||||
memcmp(sc->sc_model, "TEMPerF1", 8) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_DS75;
|
||||
ugold_setup_sensors(sc);
|
||||
printf("%s: \"%s\", %d sensor%s"
|
||||
" type ds75/12bit (temperature)\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, model, sc->sc_num_sensors,
|
||||
(sc->sc_num_sensors == 1) ? "" : "s");
|
||||
ugold_refresh(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s: unknown model \"%s\"\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, model);
|
||||
sc->sc_num_sensors = 0;
|
||||
sc->sc_type = UGOLD_TYPE_INVALID;
|
||||
}
|
||||
|
||||
void
|
||||
ugold_ds75_intr(struct uhidev *addr, void *ibuf, u_int len)
|
||||
ugold_ds75_intr(struct ugold_softc *sc, uint8_t *buf, u_int len)
|
||||
{
|
||||
struct ugold_softc *sc = (struct ugold_softc *)addr;
|
||||
uint8_t *buf = ibuf;
|
||||
int i, temp;
|
||||
int temp;
|
||||
|
||||
switch (buf[0]) {
|
||||
case UGOLD_CMD_INIT:
|
||||
if (sc->sc_num_sensors)
|
||||
if (sc->sc_num_sensors != 0)
|
||||
break;
|
||||
|
||||
sc->sc_num_sensors = min(buf[1], UGOLD_MAX_SENSORS) /* XXX */;
|
||||
|
||||
for (i = 0; i < sc->sc_num_sensors; i++) {
|
||||
sc->sc_sensor[i].flags |= SENSOR_FINVALID;
|
||||
sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]);
|
||||
}
|
||||
|
||||
sc->sc_num_sensors = imin(buf[1], UGOLD_MAX_SENSORS) /* XXX */;
|
||||
ugold_refresh(sc);
|
||||
break;
|
||||
case UGOLD_CMD_DATA:
|
||||
switch (buf[1]) {
|
||||
|
@ -286,17 +354,16 @@ ugold_ds75_intr(struct uhidev *addr, void *ibuf, u_int len)
|
|||
sc->sc_sensor[UGOLD_INNER].flags &= ~SENSOR_FINVALID;
|
||||
break;
|
||||
default:
|
||||
#ifdef UGOLD_DEBUG
|
||||
printf("%s: invalid data length (%d bytes)\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, buf[1]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!sc->sc_type) { /* type command returns arbitrary string */
|
||||
ugold_ds75_type(sc, buf, len);
|
||||
break;
|
||||
}
|
||||
printf("%s: unknown command 0x%02x\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, buf[0]);
|
||||
ugold_ds75_type(sc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,74 +429,146 @@ ugold_si700x_rhum(int type, uint8_t msb, uint8_t lsb, int temp)
|
|||
}
|
||||
|
||||
static void
|
||||
ugold_si700x_type(struct ugold_softc *sc, uint8_t *buf, u_int len)
|
||||
ugold_si700x_type(struct ugold_softc *sc)
|
||||
{
|
||||
if (memcmp(buf, "TEMPerHu", len) == 0 ||
|
||||
memcmp(buf, "TEMPer1F", len) == 0 ||
|
||||
memcmp(buf, "TEMPerX_", len) == 0 ||
|
||||
memcmp(buf, "TEMPerGo", len) == 0)
|
||||
return; /* skip equal first half of the answer */
|
||||
char model[4 * sizeof(sc->sc_model) + 1];
|
||||
const char *descr;
|
||||
int nsensors = 0;
|
||||
|
||||
printf("%s: %d sensor%s type ", sc->sc_hdev.sc_dev.dv_xname,
|
||||
sc->sc_num_sensors, (sc->sc_num_sensors == 1) ? "" : "s");
|
||||
strnvis(model, sc->sc_model, sizeof model);
|
||||
|
||||
if (memcmp(buf, "mM12V1.0", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SI7005;
|
||||
printf("si7005 (temperature and humidity)\n");
|
||||
} else if (memcmp(buf, "mM12V1.2", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SI7006;
|
||||
printf("si7006 (temperature and humidity)\n");
|
||||
} else if (memcmp(buf, "_H1V1.5F", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SHT1X;
|
||||
printf("sht1x (temperature and humidity)\n");
|
||||
} else if (memcmp(buf, "V3.1 ", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_TEMPERX;
|
||||
printf("temperx (temperature and humidity)\n");
|
||||
} else if (memcmp(buf, "V3.3 ", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_TEMPERX;
|
||||
printf("temperx (temperature and humidity)\n");
|
||||
} else if (memcmp(buf, "ld_V3.1 ", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_GOLD;
|
||||
printf("gold (temperature only)\n");
|
||||
} else if (memcmp(buf, "ld_V3.4 ", len) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_GOLD;
|
||||
printf("gold (temperature only)\n");
|
||||
} else {
|
||||
sc->sc_type = -1;
|
||||
printf("unknown\n");
|
||||
/* TEMPerHUM prefix */
|
||||
if (sc->sc_model_len >= 9 &&
|
||||
memcmp(sc->sc_model, "TEMPerHum", 9) == 0) {
|
||||
if (memcmp(sc->sc_model + 9, "M12V1.0", 16 - 9) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SI7005;
|
||||
descr = "si7005 (temperature and humidity)";
|
||||
goto identified;
|
||||
}
|
||||
if (memcmp(sc->sc_model + 9, "M12V1.2", 16 - 9) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SI7006;
|
||||
descr = "si7006 (temperature and humidity)";
|
||||
goto identified;
|
||||
}
|
||||
}
|
||||
if (sc->sc_model_len >= 9 &&
|
||||
memcmp(sc->sc_model, "TEMPerHUM", 9) == 0) {
|
||||
if (memcmp(sc->sc_model + 9, "_V4.0 ", 16 - 9) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_TEMPERX;
|
||||
descr = "temperx (temperature and humidity)";
|
||||
goto identified;
|
||||
}
|
||||
}
|
||||
|
||||
/* TEMPerX prefix */
|
||||
if (sc->sc_model_len >= 8 &&
|
||||
memcmp(sc->sc_model, "TEMPerX_", 8) == 0) {
|
||||
if (memcmp(sc->sc_model + 8, "V3.1 ", 16 - 8) == 0 ||
|
||||
memcmp(sc->sc_model + 8, "V3.3 ", 16 - 8) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_TEMPERX;
|
||||
descr = "temperx (temperature and humidity)";
|
||||
goto identified;
|
||||
}
|
||||
}
|
||||
|
||||
/* TEMPer1F or TEMPer2_ prefixes */
|
||||
if (sc->sc_model_len >= 16 &&
|
||||
memcmp(sc->sc_model, "TEMPer1F_H1V1.5F", 16) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_SHT1X;
|
||||
descr = "sht1x (temperature and humidity)";
|
||||
goto identified;
|
||||
}
|
||||
if (sc->sc_model_len >= 16 &&
|
||||
(memcmp(sc->sc_model, "TEMPer1F_V4.1\0\0\0", 16) == 0 ||
|
||||
memcmp(sc->sc_model, "TEMPer2_V4.1\0\0\0\0", 16) == 0)) {
|
||||
sc->sc_type = UGOLD_TYPE_GOLD;
|
||||
/*
|
||||
* TEMPer1F devices lack the internal sensor, but will never
|
||||
* report data for it, so it will never gets marked as valid.
|
||||
* We thus keep the value of sc_num_sensors unchanged at 2,
|
||||
* and make sure we will only report one single sensor below.
|
||||
*/
|
||||
if (sc->sc_model[6] == '1')
|
||||
nsensors = 1;
|
||||
descr = "gold (temperature only)";
|
||||
goto identified;
|
||||
}
|
||||
|
||||
/* TEMPerGold prefix */
|
||||
if (sc->sc_model_len >= 11 &&
|
||||
memcmp(sc->sc_model, "TEMPerGold_", 11) == 0) {
|
||||
if (memcmp(sc->sc_model + 11, "V3.1 ", 16 - 11) == 0 ||
|
||||
memcmp(sc->sc_model + 11, "V3.4 ", 16 - 11) == 0) {
|
||||
sc->sc_type = UGOLD_TYPE_GOLD;
|
||||
sc->sc_num_sensors = 1;
|
||||
descr = "gold (temperature only)";
|
||||
goto identified;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s: unknown model \"%s\"\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, model);
|
||||
sc->sc_num_sensors = 0;
|
||||
sc->sc_type = UGOLD_TYPE_INVALID;
|
||||
return;
|
||||
|
||||
identified:
|
||||
ugold_setup_sensors(sc);
|
||||
if (nsensors == 0)
|
||||
nsensors = sc->sc_num_sensors;
|
||||
printf("%s: \"%s\", %d sensor%s type %s\n", sc->sc_hdev.sc_dev.dv_xname,
|
||||
model, nsensors, (nsensors == 1) ? "" : "s", descr);
|
||||
ugold_refresh(sc);
|
||||
}
|
||||
|
||||
void
|
||||
ugold_si700x_intr(struct uhidev *addr, void *ibuf, u_int len)
|
||||
ugold_si700x_intr(struct ugold_softc *sc, uint8_t *buf, u_int len)
|
||||
{
|
||||
struct ugold_softc *sc = (struct ugold_softc *)addr;
|
||||
uint8_t *buf = ibuf;
|
||||
int i, temp, rhum;
|
||||
int temp, sensor, rhum;
|
||||
|
||||
switch (buf[0]) {
|
||||
case UGOLD_CMD_INIT:
|
||||
if (sc->sc_num_sensors)
|
||||
if (sc->sc_num_sensors != 0)
|
||||
break;
|
||||
|
||||
if (sc->sc_type == UGOLD_TYPE_GOLD)
|
||||
sc->sc_num_sensors = 1;
|
||||
else
|
||||
sc->sc_num_sensors = min(buf[1],
|
||||
UGOLD_MAX_SENSORS) /* XXX */;
|
||||
|
||||
for (i = 0; i < sc->sc_num_sensors; i++) {
|
||||
sc->sc_sensor[i].flags |= SENSOR_FINVALID;
|
||||
sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]);
|
||||
}
|
||||
/* XXX some devices report 0x04 here */
|
||||
sc->sc_num_sensors = imin(buf[1], UGOLD_MAX_SENSORS);
|
||||
ugold_refresh(sc);
|
||||
break;
|
||||
case UGOLD_CMD_DATA:
|
||||
if (buf[1] != 4 && buf[1] != 64 && buf[1] != 128)
|
||||
printf("%s: invalid data length (%d bytes)\n",
|
||||
if (sc->sc_type == UGOLD_TYPE_GOLD) {
|
||||
if (buf[1] == 0x80)
|
||||
sensor = UGOLD_INNER;
|
||||
else if (buf[1] == 0x01)
|
||||
sensor = UGOLD_OUTER;
|
||||
else
|
||||
sensor = -1;
|
||||
} else {
|
||||
if (buf[1] == 0x04 || buf[1] == 0x20 ||
|
||||
buf[1] == 0x40 || buf[1] == 0x80)
|
||||
sensor = UGOLD_INNER;
|
||||
else
|
||||
sensor = -1;
|
||||
}
|
||||
if (sensor < 0) {
|
||||
/* unexpected data, ignore */
|
||||
#ifdef UGOLD_DEBUG
|
||||
printf("%s: unexpected sensor id %02x\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, buf[1]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
temp = ugold_si700x_temp(sc->sc_type, buf[2], buf[3]);
|
||||
sc->sc_sensor[UGOLD_INNER].value = (temp * 1000) + 273150000;
|
||||
sc->sc_sensor[UGOLD_INNER].flags &= ~SENSOR_FINVALID;
|
||||
sc->sc_sensor[sensor].value = (temp * 1000) + 273150000;
|
||||
/*
|
||||
* TEMPer1F and TEMPer2 report 200C when the sensor probe is
|
||||
* missing or not plugged correctly.
|
||||
*/
|
||||
if (sc->sc_type == UGOLD_TYPE_GOLD && temp == 200000)
|
||||
sc->sc_sensor[sensor].flags |= SENSOR_FINVALID;
|
||||
else
|
||||
sc->sc_sensor[sensor].flags &= ~SENSOR_FINVALID;
|
||||
|
||||
if (sc->sc_type != UGOLD_TYPE_GOLD) {
|
||||
rhum = ugold_si700x_rhum(sc->sc_type, buf[4], buf[5], temp);
|
||||
sc->sc_sensor[UGOLD_HUM].value = rhum;
|
||||
|
@ -437,12 +576,58 @@ ugold_si700x_intr(struct uhidev *addr, void *ibuf, u_int len)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if (!sc->sc_type) { /* type command returns arbitrary string */
|
||||
ugold_si700x_type(sc, buf, len);
|
||||
ugold_si700x_type(sc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ugold_intr(struct uhidev *addr, void *ibuf, u_int len)
|
||||
{
|
||||
struct ugold_softc *sc = (struct ugold_softc *)addr;
|
||||
uint8_t *buf = ibuf;
|
||||
unsigned long chunk;
|
||||
|
||||
#ifdef UGOLD_DEBUG
|
||||
{
|
||||
printf("%s: %u bytes\n", sc->sc_hdev.sc_dev.dv_xname, len);
|
||||
u_int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (i != 0 && (i % 8) == 0)
|
||||
printf("\n");
|
||||
printf("%02x ", buf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (buf[0]) {
|
||||
case UGOLD_CMD_INIT:
|
||||
case UGOLD_CMD_DATA:
|
||||
(*sc->sc_intr)(sc, buf, len);
|
||||
break;
|
||||
default:
|
||||
if (!sc->sc_type) {
|
||||
/*
|
||||
* Exact sensor type is not known yet, type command
|
||||
* returns arbitrary string.
|
||||
*/
|
||||
chunk = ulmin(len,
|
||||
sizeof(sc->sc_model) - 1 - sc->sc_model_len);
|
||||
if (chunk != 0) {
|
||||
memcpy(sc->sc_model + sc->sc_model_len, buf,
|
||||
chunk);
|
||||
sc->sc_model_len += chunk;
|
||||
}
|
||||
if (sc->sc_model_len > 8) {
|
||||
/* should have enough data now */
|
||||
(*sc->sc_intr)(sc, buf, len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
printf("%s: unknown command 0x%02x\n",
|
||||
sc->sc_hdev.sc_dev.dv_xname, buf[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,6 +637,13 @@ ugold_refresh(void *arg)
|
|||
struct ugold_softc *sc = arg;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Don't waste time talking to the device if we don't understand
|
||||
* its language.
|
||||
*/
|
||||
if (sc->sc_type == UGOLD_TYPE_INVALID)
|
||||
return;
|
||||
|
||||
if (!sc->sc_num_sensors) {
|
||||
ugold_issue_cmd(sc, cmd_init, sizeof(cmd_init));
|
||||
return;
|
||||
|
|
57
sys/net/pf.c
57
sys/net/pf.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pf.c,v 1.1188 2023/10/10 16:26:06 bluhm Exp $ */
|
||||
/* $OpenBSD: pf.c,v 1.1189 2023/12/01 10:28:32 sashan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
|
@ -469,6 +469,15 @@ pf_state_list_remove(struct pf_state_list *pfs, struct pf_state *st)
|
|||
pf_state_unref(st); /* list no longer references the state */
|
||||
}
|
||||
|
||||
void
|
||||
pf_update_state_timeout(struct pf_state *st, int to)
|
||||
{
|
||||
mtx_enter(&st->mtx);
|
||||
if (st->timeout != PFTM_UNLINKED)
|
||||
st->timeout = to;
|
||||
mtx_leave(&st->mtx);
|
||||
}
|
||||
|
||||
int
|
||||
pf_src_connlimit(struct pf_state **stp)
|
||||
{
|
||||
|
@ -549,7 +558,7 @@ pf_src_connlimit(struct pf_state **stp)
|
|||
((*stp)->rule.ptr->flush &
|
||||
PF_FLUSH_GLOBAL ||
|
||||
(*stp)->rule.ptr == st->rule.ptr)) {
|
||||
st->timeout = PFTM_PURGE;
|
||||
pf_update_state_timeout(st, PFTM_PURGE);
|
||||
pf_set_protostate(st, PF_PEER_BOTH,
|
||||
TCPS_CLOSED);
|
||||
killed++;
|
||||
|
@ -563,7 +572,7 @@ pf_src_connlimit(struct pf_state **stp)
|
|||
}
|
||||
|
||||
/* kill this state */
|
||||
(*stp)->timeout = PFTM_PURGE;
|
||||
pf_update_state_timeout(*stp, PFTM_PURGE);
|
||||
pf_set_protostate(*stp, PF_PEER_BOTH, TCPS_CLOSED);
|
||||
return (1);
|
||||
}
|
||||
|
@ -1758,10 +1767,13 @@ pf_remove_state(struct pf_state *st)
|
|||
{
|
||||
PF_ASSERT_LOCKED();
|
||||
|
||||
if (st->timeout == PFTM_UNLINKED)
|
||||
mtx_enter(&st->mtx);
|
||||
if (st->timeout == PFTM_UNLINKED) {
|
||||
mtx_leave(&st->mtx);
|
||||
return;
|
||||
|
||||
}
|
||||
st->timeout = PFTM_UNLINKED;
|
||||
mtx_leave(&st->mtx);
|
||||
|
||||
/* handle load balancing related tasks */
|
||||
pf_postprocess_addr(st);
|
||||
|
@ -1816,7 +1828,8 @@ pf_remove_divert_state(struct pf_state_key *sk)
|
|||
sist->dst.state < TCPS_FIN_WAIT_2) {
|
||||
pf_set_protostate(sist, PF_PEER_BOTH,
|
||||
TCPS_TIME_WAIT);
|
||||
sist->timeout = PFTM_TCP_CLOSED;
|
||||
pf_update_state_timeout(sist,
|
||||
PFTM_TCP_CLOSED);
|
||||
sist->expire = getuptime();
|
||||
}
|
||||
sist->state_flags |= PFSTATE_INP_UNLINKED;
|
||||
|
@ -5036,18 +5049,18 @@ pf_tcp_track_full(struct pf_pdesc *pd, struct pf_state **stp, u_short *reason,
|
|||
(*stp)->expire = getuptime();
|
||||
if (src->state >= TCPS_FIN_WAIT_2 &&
|
||||
dst->state >= TCPS_FIN_WAIT_2)
|
||||
(*stp)->timeout = PFTM_TCP_CLOSED;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_CLOSED);
|
||||
else if (src->state >= TCPS_CLOSING &&
|
||||
dst->state >= TCPS_CLOSING)
|
||||
(*stp)->timeout = PFTM_TCP_FIN_WAIT;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_FIN_WAIT);
|
||||
else if (src->state < TCPS_ESTABLISHED ||
|
||||
dst->state < TCPS_ESTABLISHED)
|
||||
(*stp)->timeout = PFTM_TCP_OPENING;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_OPENING);
|
||||
else if (src->state >= TCPS_CLOSING ||
|
||||
dst->state >= TCPS_CLOSING)
|
||||
(*stp)->timeout = PFTM_TCP_CLOSING;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_CLOSING);
|
||||
else
|
||||
(*stp)->timeout = PFTM_TCP_ESTABLISHED;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_ESTABLISHED);
|
||||
|
||||
/* Fall through to PASS packet */
|
||||
} else if ((dst->state < TCPS_SYN_SENT ||
|
||||
|
@ -5229,18 +5242,18 @@ pf_tcp_track_sloppy(struct pf_pdesc *pd, struct pf_state **stp,
|
|||
(*stp)->expire = getuptime();
|
||||
if (src->state >= TCPS_FIN_WAIT_2 &&
|
||||
dst->state >= TCPS_FIN_WAIT_2)
|
||||
(*stp)->timeout = PFTM_TCP_CLOSED;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_CLOSED);
|
||||
else if (src->state >= TCPS_CLOSING &&
|
||||
dst->state >= TCPS_CLOSING)
|
||||
(*stp)->timeout = PFTM_TCP_FIN_WAIT;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_FIN_WAIT);
|
||||
else if (src->state < TCPS_ESTABLISHED ||
|
||||
dst->state < TCPS_ESTABLISHED)
|
||||
(*stp)->timeout = PFTM_TCP_OPENING;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_OPENING);
|
||||
else if (src->state >= TCPS_CLOSING ||
|
||||
dst->state >= TCPS_CLOSING)
|
||||
(*stp)->timeout = PFTM_TCP_CLOSING;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_CLOSING);
|
||||
else
|
||||
(*stp)->timeout = PFTM_TCP_ESTABLISHED;
|
||||
pf_update_state_timeout(*stp, PFTM_TCP_ESTABLISHED);
|
||||
|
||||
return (PF_PASS);
|
||||
}
|
||||
|
@ -5377,7 +5390,7 @@ pf_test_state(struct pf_pdesc *pd, struct pf_state **stp, u_short *reason)
|
|||
addlog("\n");
|
||||
}
|
||||
/* XXX make sure it's the same direction ?? */
|
||||
(*stp)->timeout = PFTM_PURGE;
|
||||
pf_update_state_timeout(*stp, PFTM_PURGE);
|
||||
pf_state_unref(*stp);
|
||||
*stp = NULL;
|
||||
pf_mbuf_link_inpcb(pd->m, inp);
|
||||
|
@ -5417,9 +5430,9 @@ pf_test_state(struct pf_pdesc *pd, struct pf_state **stp, u_short *reason)
|
|||
(*stp)->expire = getuptime();
|
||||
if (src->state == PFUDPS_MULTIPLE &&
|
||||
dst->state == PFUDPS_MULTIPLE)
|
||||
(*stp)->timeout = PFTM_UDP_MULTIPLE;
|
||||
pf_update_state_timeout(*stp, PFTM_UDP_MULTIPLE);
|
||||
else
|
||||
(*stp)->timeout = PFTM_UDP_SINGLE;
|
||||
pf_update_state_timeout(*stp, PFTM_UDP_SINGLE);
|
||||
break;
|
||||
default:
|
||||
/* update states */
|
||||
|
@ -5432,9 +5445,9 @@ pf_test_state(struct pf_pdesc *pd, struct pf_state **stp, u_short *reason)
|
|||
(*stp)->expire = getuptime();
|
||||
if (src->state == PFOTHERS_MULTIPLE &&
|
||||
dst->state == PFOTHERS_MULTIPLE)
|
||||
(*stp)->timeout = PFTM_OTHER_MULTIPLE;
|
||||
pf_update_state_timeout(*stp, PFTM_OTHER_MULTIPLE);
|
||||
else
|
||||
(*stp)->timeout = PFTM_OTHER_SINGLE;
|
||||
pf_update_state_timeout(*stp, PFTM_OTHER_SINGLE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5585,7 +5598,7 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **stp,
|
|||
return (ret);
|
||||
|
||||
(*stp)->expire = getuptime();
|
||||
(*stp)->timeout = PFTM_ICMP_ERROR_REPLY;
|
||||
pf_update_state_timeout(*stp, PFTM_ICMP_ERROR_REPLY);
|
||||
|
||||
/* translate source/destination address, if necessary */
|
||||
if ((*stp)->key[PF_SK_WIRE] != (*stp)->key[PF_SK_STACK]) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.c,v 1.279 2023/11/29 18:30:48 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.c,v 1.280 2023/12/01 15:30:46 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -268,6 +268,7 @@ in_pcballoc(struct socket *so, struct inpcbtable *table, int wait)
|
|||
int
|
||||
in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
struct socket *so = inp->inp_socket;
|
||||
u_int16_t lport = 0;
|
||||
int wild = 0;
|
||||
|
@ -341,7 +342,10 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
|
|||
}
|
||||
}
|
||||
inp->inp_lport = lport;
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -480,6 +484,7 @@ in_pcbpickport(u_int16_t *lport, const void *laddr, int wild,
|
|||
int
|
||||
in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
struct in_addr ina;
|
||||
struct sockaddr_in *sin;
|
||||
struct inpcb *t;
|
||||
|
@ -526,7 +531,10 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||
}
|
||||
inp->inp_faddr = sin->sin_addr;
|
||||
inp->inp_fport = sin->sin_port;
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
|
||||
#if NSTOEPLITZ > 0
|
||||
inp->inp_flowid = stoeplitz_ip4port(inp->inp_faddr.s_addr,
|
||||
inp->inp_laddr.s_addr, inp->inp_fport, inp->inp_lport);
|
||||
|
@ -544,20 +552,7 @@ in_pcbdisconnect(struct inpcb *inp)
|
|||
pf_inp_unlink(inp);
|
||||
}
|
||||
#endif
|
||||
switch (sotopf(inp->inp_socket)) {
|
||||
#ifdef INET6
|
||||
case PF_INET6:
|
||||
inp->inp_faddr6 = in6addr_any;
|
||||
break;
|
||||
#endif
|
||||
case PF_INET:
|
||||
inp->inp_faddr.s_addr = INADDR_ANY;
|
||||
break;
|
||||
}
|
||||
|
||||
inp->inp_fport = 0;
|
||||
inp->inp_flowid = 0;
|
||||
in_pcbrehash(inp);
|
||||
if (inp->inp_socket->so_state & SS_NOFDREF)
|
||||
in_pcbdetach(inp);
|
||||
}
|
||||
|
@ -1044,11 +1039,11 @@ in_pcbrehash(struct inpcb *inp)
|
|||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
MUTEX_ASSERT_LOCKED(&table->inpt_mtx);
|
||||
|
||||
LIST_REMOVE(inp, inp_lhash);
|
||||
LIST_REMOVE(inp, inp_hash);
|
||||
in_pcbhash_insert(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1266,3 +1261,87 @@ in_pcblookup_listen(struct inpcbtable *table, struct in_addr laddr,
|
|||
#endif
|
||||
return (inp);
|
||||
}
|
||||
|
||||
int
|
||||
in_pcbset_rtableid(struct inpcb *inp, u_int rtableid)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
if (inp->inp_lport) {
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
return (EBUSY);
|
||||
}
|
||||
inp->inp_rtableid = rtableid;
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
in_pcbset_laddr(struct inpcb *inp, const struct sockaddr *sa, u_int rtableid)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
inp->inp_rtableid = rtableid;
|
||||
#ifdef INET6
|
||||
if (ISSET(inp->inp_flags, INP_IPV6)) {
|
||||
const struct sockaddr_in6 *sin6;
|
||||
|
||||
KASSERT(sa->sa_family == AF_INET6);
|
||||
sin6 = satosin6_const(sa);
|
||||
inp->inp_lport = sin6->sin6_port;
|
||||
inp->inp_laddr6 = sin6->sin6_addr;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
const struct sockaddr_in *sin;
|
||||
|
||||
KASSERT(sa->sa_family == AF_INET);
|
||||
sin = satosin_const(sa);
|
||||
inp->inp_lport = sin->sin_port;
|
||||
inp->inp_laddr = sin->sin_addr;
|
||||
}
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
in_pcbunset_faddr(struct inpcb *inp)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
#ifdef INET6
|
||||
if (ISSET(inp->inp_flags, INP_IPV6))
|
||||
inp->inp_faddr6 = in6addr_any;
|
||||
else
|
||||
#endif
|
||||
inp->inp_faddr.s_addr = INADDR_ANY;
|
||||
inp->inp_fport = 0;
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
in_pcbunset_laddr(struct inpcb *inp)
|
||||
{
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
#ifdef INET6
|
||||
if (ISSET(inp->inp_flags, INP_IPV6)) {
|
||||
inp->inp_faddr6 = in6addr_any;
|
||||
inp->inp_laddr6 = in6addr_any;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
inp->inp_faddr.s_addr = INADDR_ANY;
|
||||
inp->inp_laddr.s_addr = INADDR_ANY;
|
||||
}
|
||||
inp->inp_fport = 0;
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in_pcb.h,v 1.140 2023/11/29 18:30:48 bluhm Exp $ */
|
||||
/* $OpenBSD: in_pcb.h,v 1.141 2023/12/01 15:30:46 bluhm Exp $ */
|
||||
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -335,5 +335,10 @@ void in6_pcbnotify(struct inpcbtable *, struct sockaddr_in6 *,
|
|||
int in6_selecthlim(struct inpcb *);
|
||||
int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *,
|
||||
struct proc *);
|
||||
int in_pcbset_rtableid(struct inpcb *, u_int);
|
||||
void in_pcbset_laddr(struct inpcb *, const struct sockaddr *, u_int);
|
||||
void in_pcbunset_faddr(struct inpcb *);
|
||||
void in_pcbunset_laddr(struct inpcb *);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _NETINET_IN_PCB_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_output.c,v 1.391 2023/11/26 22:08:10 bluhm Exp $ */
|
||||
/* $OpenBSD: ip_output.c,v 1.392 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1082,12 +1082,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
|
|||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (inp->inp_lport) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
inp->inp_rtableid = rtid;
|
||||
in_pcbrehash(inp);
|
||||
error = in_pcbset_rtableid(inp, rtid);
|
||||
break;
|
||||
case IP_PIPEX:
|
||||
if (m != NULL && m->m_len == sizeof(int))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_input.c,v 1.396 2023/11/30 10:21:56 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_input.c,v 1.397 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -3489,6 +3489,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
|
|||
struct tcpcb *tp = NULL;
|
||||
struct mbuf *am;
|
||||
struct socket *oso;
|
||||
u_int rtableid;
|
||||
|
||||
NET_ASSERT_LOCKED();
|
||||
|
||||
|
@ -3553,37 +3554,25 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
|
|||
#endif /* INET6 */
|
||||
{
|
||||
inp->inp_ip.ip_ttl = oldinp->inp_ip.ip_ttl;
|
||||
inp->inp_options = ip_srcroute(m);
|
||||
if (inp->inp_options == NULL) {
|
||||
inp->inp_options = sc->sc_ipopts;
|
||||
sc->sc_ipopts = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* inherit rtable from listening socket */
|
||||
rtableid = sc->sc_rtableid;
|
||||
#if NPF > 0
|
||||
if (m->m_pkthdr.pf.flags & PF_TAG_DIVERTED) {
|
||||
struct pf_divert *divert;
|
||||
|
||||
divert = pf_find_divert(m);
|
||||
KASSERT(divert != NULL);
|
||||
inp->inp_rtableid = divert->rdomain;
|
||||
} else
|
||||
#endif
|
||||
/* inherit rtable from listening socket */
|
||||
inp->inp_rtableid = sc->sc_rtableid;
|
||||
|
||||
inp->inp_lport = th->th_dport;
|
||||
switch (src->sa_family) {
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
inp->inp_laddr6 = satosin6(dst)->sin6_addr;
|
||||
break;
|
||||
#endif /* INET6 */
|
||||
case AF_INET:
|
||||
inp->inp_laddr = satosin(dst)->sin_addr;
|
||||
inp->inp_options = ip_srcroute(m);
|
||||
if (inp->inp_options == NULL) {
|
||||
inp->inp_options = sc->sc_ipopts;
|
||||
sc->sc_ipopts = NULL;
|
||||
}
|
||||
break;
|
||||
rtableid = divert->rdomain;
|
||||
}
|
||||
in_pcbrehash(inp);
|
||||
#endif
|
||||
in_pcbset_laddr(inp, dst, rtableid);
|
||||
|
||||
/*
|
||||
* Give the new socket our cached route reference.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_usrreq.c,v 1.224 2023/11/28 13:23:20 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_usrreq.c,v 1.226 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -635,7 +635,6 @@ tcp_connect(struct socket *so, struct mbuf *nam)
|
|||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
error = in6_pcbconnect(inp, nam);
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
{
|
||||
|
@ -650,13 +649,14 @@ tcp_connect(struct socket *so, struct mbuf *nam)
|
|||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
error = in_pcbconnect(inp, nam);
|
||||
}
|
||||
error = in_pcbconnect(inp, nam);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
tp->t_template = tcp_template(tp);
|
||||
if (tp->t_template == 0) {
|
||||
in_pcbunset_faddr(inp);
|
||||
in_pcbdisconnect(inp);
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: udp_usrreq.c,v 1.310 2023/11/29 18:30:48 bluhm Exp $ */
|
||||
/* $OpenBSD: udp_usrreq.c,v 1.312 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1153,15 +1153,13 @@ udp_connect(struct socket *so, struct mbuf *addr)
|
|||
if (inp->inp_flags & INP_IPV6) {
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6))
|
||||
return (EISCONN);
|
||||
error = in6_pcbconnect(inp, addr);
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
{
|
||||
if (inp->inp_faddr.s_addr != INADDR_ANY)
|
||||
return (EISCONN);
|
||||
error = in_pcbconnect(inp, addr);
|
||||
}
|
||||
|
||||
error = in_pcbconnect(inp, addr);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1186,14 +1184,7 @@ udp_disconnect(struct socket *so)
|
|||
if (inp->inp_faddr.s_addr == INADDR_ANY)
|
||||
return (ENOTCONN);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
if (inp->inp_flags & INP_IPV6)
|
||||
inp->inp_laddr6 = in6addr_any;
|
||||
else
|
||||
#endif /* INET6 */
|
||||
inp->inp_laddr.s_addr = INADDR_ANY;
|
||||
|
||||
in_pcbunset_laddr(inp);
|
||||
in_pcbdisconnect(inp);
|
||||
so->so_state &= ~SS_ISCONNECTED; /* XXX */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in6_pcb.c,v 1.126 2023/11/29 18:30:48 bluhm Exp $ */
|
||||
/* $OpenBSD: in6_pcb.c,v 1.128 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -245,7 +245,8 @@ in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
|
|||
int
|
||||
in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
||||
{
|
||||
struct in6_addr *in6a = NULL;
|
||||
struct inpcbtable *table = inp->inp_table;
|
||||
const struct in6_addr *in6a;
|
||||
struct sockaddr_in6 *sin6;
|
||||
struct inpcb *t;
|
||||
int error;
|
||||
|
@ -312,6 +313,10 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||
}
|
||||
inp->inp_faddr6 = sin6->sin6_addr;
|
||||
inp->inp_fport = sin6->sin6_port;
|
||||
mtx_enter(&table->inpt_mtx);
|
||||
in_pcbrehash(inp);
|
||||
mtx_leave(&table->inpt_mtx);
|
||||
|
||||
inp->inp_flowinfo &= ~IPV6_FLOWLABEL_MASK;
|
||||
if (ip6_auto_flowlabel)
|
||||
inp->inp_flowinfo |=
|
||||
|
@ -320,7 +325,6 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
|
|||
inp->inp_flowid = stoeplitz_ip6port(&inp->inp_faddr6,
|
||||
&inp->inp_laddr6, inp->inp_fport, inp->inp_lport);
|
||||
#endif
|
||||
in_pcbrehash(inp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: in6_src.c,v 1.87 2023/11/28 13:23:20 bluhm Exp $ */
|
||||
/* $OpenBSD: in6_src.c,v 1.88 2023/12/01 14:08:04 bluhm Exp $ */
|
||||
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -91,7 +91,7 @@ int in6_selectif(struct sockaddr_in6 *, struct ip6_pktopts *,
|
|||
* the values set at pcb level can be overridden via cmsg.
|
||||
*/
|
||||
int
|
||||
in6_pcbselsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
|
||||
in6_pcbselsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
|
||||
struct inpcb *inp, struct ip6_pktopts *opts)
|
||||
{
|
||||
struct ip6_moptions *mopts = inp->inp_moptions6;
|
||||
|
@ -249,7 +249,7 @@ in6_pcbselsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
|
|||
* an entry to the caller for later use.
|
||||
*/
|
||||
int
|
||||
in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
|
||||
in6_selectsrc(const struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
|
||||
struct ip6_moptions *mopts, unsigned int rtableid)
|
||||
{
|
||||
struct ifnet *ifp = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_output.c,v 1.281 2023/11/28 13:23:20 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_output.c,v 1.282 2023/12/01 15:30:47 bluhm Exp $ */
|
||||
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1381,12 +1381,7 @@ do { \
|
|||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (inp->inp_lport) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
inp->inp_rtableid = rtid;
|
||||
in_pcbrehash(inp);
|
||||
error = in_pcbset_rtableid(inp, rtid);
|
||||
break;
|
||||
case IPV6_PIPEX:
|
||||
if (m != NULL && m->m_len == sizeof(int))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_var.h,v 1.107 2023/11/26 22:08:10 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_var.h,v 1.108 2023/12/01 14:08:04 bluhm Exp $ */
|
||||
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -365,9 +365,9 @@ int rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
|||
int dest6_input(struct mbuf **, int *, int, int);
|
||||
int none_input(struct mbuf **, int *, int);
|
||||
|
||||
int in6_pcbselsrc(struct in6_addr **, struct sockaddr_in6 *,
|
||||
int in6_pcbselsrc(const struct in6_addr **, struct sockaddr_in6 *,
|
||||
struct inpcb *, struct ip6_pktopts *);
|
||||
int in6_selectsrc(struct in6_addr **, struct sockaddr_in6 *,
|
||||
int in6_selectsrc(const struct in6_addr **, struct sockaddr_in6 *,
|
||||
struct ip6_moptions *, unsigned int);
|
||||
struct rtentry *in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
|
||||
struct route_in6 *, unsigned int rtableid);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: raw_ip6.c,v 1.175 2023/11/28 13:23:20 bluhm Exp $ */
|
||||
/* $OpenBSD: raw_ip6.c,v 1.176 2023/12/01 14:08:04 bluhm Exp $ */
|
||||
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -451,7 +451,7 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
|
|||
* Source address selection.
|
||||
*/
|
||||
{
|
||||
struct in6_addr *in6a;
|
||||
const struct in6_addr *in6a;
|
||||
|
||||
error = in6_pcbselsrc(&in6a, satosin6(dstaddr), in6p, optp);
|
||||
if (error)
|
||||
|
@ -683,7 +683,7 @@ rip6_connect(struct socket *so, struct mbuf *nam)
|
|||
{
|
||||
struct inpcb *in6p = sotoinpcb(so);
|
||||
struct sockaddr_in6 *addr;
|
||||
struct in6_addr *in6a = NULL;
|
||||
const struct in6_addr *in6a;
|
||||
int error;
|
||||
|
||||
soassertlocked(so);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: udp6_output.c,v 1.61 2023/11/28 13:23:20 bluhm Exp $ */
|
||||
/* $OpenBSD: udp6_output.c,v 1.62 2023/12/01 14:08:04 bluhm Exp $ */
|
||||
/* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -101,7 +101,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
|
|||
int error = 0, priv = 0, hlen, flags;
|
||||
struct ip6_hdr *ip6;
|
||||
struct udphdr *udp6;
|
||||
struct in6_addr *laddr, *faddr;
|
||||
const struct in6_addr *laddr, *faddr;
|
||||
struct ip6_pktopts *optp, opt;
|
||||
struct sockaddr_in6 tmp, valid;
|
||||
struct proc *p = curproc; /* XXX */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mutex.h,v 1.18 2019/04/23 13:35:12 visa Exp $ */
|
||||
/* $OpenBSD: mutex.h,v 1.19 2023/12/01 14:37:22 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
|
||||
|
@ -84,8 +84,8 @@ void __mtx_init(struct mutex *, int);
|
|||
panic("mutex %p held in %s", (mtx), __func__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MUTEX_ASSERT_LOCKED(mtx) do { } while (0)
|
||||
#define MUTEX_ASSERT_UNLOCKED(mtx) do { } while (0)
|
||||
#define MUTEX_ASSERT_LOCKED(mtx) do { (void)(mtx); } while (0)
|
||||
#define MUTEX_ASSERT_UNLOCKED(mtx) do { (void)(mtx); } while (0)
|
||||
#endif
|
||||
|
||||
#define MUTEX_LOCK_OBJECT(mtx) (&(mtx)->mtx_lock_obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue