sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-03 20:46:03 +00:00
parent 02d83d01a6
commit 005bcb25db
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
29 changed files with 312 additions and 230 deletions

View File

@ -1577,6 +1577,7 @@ unsigned ScriptParser::readPhdrType() {
.Case("PT_GNU_RELRO", PT_GNU_RELRO)
.Case("PT_OPENBSD_MUTABLE", PT_OPENBSD_MUTABLE)
.Case("PT_OPENBSD_RANDOMIZE", PT_OPENBSD_RANDOMIZE)
.Case("PT_OPENBSD_SYSCALLS", PT_OPENBSD_SYSCALLS)
.Case("PT_OPENBSD_WXNEEDED", PT_OPENBSD_WXNEEDED)
.Case("PT_OPENBSD_BOOTDATA", PT_OPENBSD_BOOTDATA)
.Default(-1);

View File

@ -2388,6 +2388,11 @@ SmallVector<PhdrEntry *, 0> Writer<ELFT>::createPhdrs(Partition &part) {
if (OutputSection *cmd = findSection(".openbsd.randomdata", partNo))
addHdr(PT_OPENBSD_RANDOMIZE, cmd->getPhdrFlags())->add(cmd);
// PT_OPENBSD_SYSCALLS is an OpenBSD-specific feature. That makes
// the kernel and dynamic linker register system call sites.
if (OutputSection *cmd = findSection(".openbsd.syscalls", partNo))
addHdr(PT_OPENBSD_SYSCALLS, cmd->getPhdrFlags())->add(cmd);
if (config->zGnustack != GnuStackKind::None) {
// PT_GNU_STACK is a special section to tell the loader to make the
// pages for the stack non-executable. If you really want an executable

View File

@ -1405,6 +1405,7 @@ enum {
PT_OPENBSD_RANDOMIZE = 0x65a3dbe6, // Fill with random data.
PT_OPENBSD_WXNEEDED = 0x65a3dbe7, // Program does W^X violations.
PT_OPENBSD_NOBTCFI = 0x65a3dbe8, // Do not enforce branch target CFI
PT_OPENBSD_SYSCALLS = 0x65a3dbe9, // System call sites.
PT_OPENBSD_BOOTDATA = 0x65a41be6, // Section for boot arguments.
// ARM program header types.

View File

@ -259,6 +259,9 @@ static void printProgramHeaders(const ELFFile<ELFT> &Obj, StringRef FileName) {
case ELF::PT_OPENBSD_RANDOMIZE:
outs() << "OPENBSD_RANDOMIZE ";
break;
case ELF::PT_OPENBSD_SYSCALLS:
outs() << "OPENBSD_SYSCALLS ";
break;
case ELF::PT_OPENBSD_WXNEEDED:
outs() << "OPENBSD_WXNEEDED ";
break;

View File

@ -1411,6 +1411,7 @@ static StringRef segmentTypeToString(unsigned Arch, unsigned Type) {
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_MUTABLE);
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_RANDOMIZE);
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_SYSCALLS);
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_WXNEEDED);
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_NOBTCFI);
LLVM_READOBJ_ENUM_CASE(ELF, PT_OPENBSD_BOOTDATA);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: e_rc2.c,v 1.24 2023/11/18 10:46:58 tb Exp $ */
/* $OpenBSD: e_rc2.c,v 1.25 2023/12/02 19:06:22 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -383,15 +383,9 @@ rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
static int
rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
int iv_len;
switch (type) {
case EVP_CTRL_INIT:
data(c)->key_bits = 0;
/* XXX - upper bound? */
if ((iv_len = EVP_CIPHER_CTX_key_length(c)) < 0)
return -1;
data(c)->key_bits = iv_len * 8;
data(c)->key_bits = EVP_CIPHER_CTX_key_length(c) * 8;
return 1;
case EVP_CTRL_GET_RC2_KEY_BITS:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: e_sm4.c,v 1.9 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_sm4.c,v 1.10 2023/12/02 19:07:10 tb Exp $ */
/*
* Copyright (c) 2017, 2019 Ribose Inc
*
@ -154,9 +154,9 @@ static const EVP_CIPHER sm4_cbc = {
.do_cipher = sm4_cbc_cipher,
.cleanup = NULL,
.ctx_size = sizeof(EVP_SM4_KEY),
.set_asn1_parameters = 0,
.get_asn1_parameters = 0,
.ctrl = 0,
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
@ -176,9 +176,9 @@ static const EVP_CIPHER sm4_cfb128 = {
.do_cipher = sm4_cfb128_cipher,
.cleanup = NULL,
.ctx_size = sizeof(EVP_SM4_KEY),
.set_asn1_parameters = 0,
.get_asn1_parameters = 0,
.ctrl = 0,
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
@ -198,9 +198,9 @@ static const EVP_CIPHER sm4_ofb = {
.do_cipher = sm4_ofb_cipher,
.cleanup = NULL,
.ctx_size = sizeof(EVP_SM4_KEY),
.set_asn1_parameters = 0,
.get_asn1_parameters = 0,
.ctrl = 0,
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};

View File

@ -1,4 +1,4 @@
/* $OpenBSD: evp_enc.c,v 1.57 2023/12/01 06:53:18 tb Exp $ */
/* $OpenBSD: evp_enc.c,v 1.58 2023/12/03 11:18:30 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -61,8 +61,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <openssl/opensslconf.h>
#include <openssl/err.h>
@ -211,9 +209,6 @@ EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
return EVP_DecryptFinal_ex(ctx, out, outl);
}
__warn_references(EVP_CipherFinal,
"EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup");
int
EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
@ -333,9 +328,6 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
return 1;
}
__warn_references(EVP_EncryptFinal,
"EVP_EncryptFinal is often misused, please use EVP_EncryptFinal_ex and EVP_CIPHER_CTX_cleanup");
int
EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
@ -458,9 +450,6 @@ EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
return 1;
}
__warn_references(EVP_DecryptFinal,
"EVP_DecryptFinal is often misused, please use EVP_DecryptFinal_ex and EVP_CIPHER_CTX_cleanup");
int
EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{

View File

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
/* $OpenBSD: if_em.c,v 1.367 2023/11/10 15:51:20 bluhm Exp $ */
/* $OpenBSD: if_em.c,v 1.368 2023/12/03 00:19:25 jsg Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@ -168,6 +168,11 @@ const struct pci_matchid em_devices[] = {
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM17 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM18 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM19 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM20 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM21 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM22 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM23 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM24 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V4 },
@ -186,6 +191,11 @@ const struct pci_matchid em_devices[] = {
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V17 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V18 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V19 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V20 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V21 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V22 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V23 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V24 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_COPPER },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_FIBER },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82580_SERDES },

View File

@ -31,7 +31,7 @@
*******************************************************************************/
/* $OpenBSD: if_em_hw.c,v 1.118 2023/09/05 13:06:42 naddy Exp $ */
/* $OpenBSD: if_em_hw.c,v 1.119 2023/12/03 00:19:25 jsg Exp $ */
/*
* if_em_hw.c Shared functions for accessing and configuring the MAC
*/
@ -660,11 +660,23 @@ em_set_mac_type(struct em_hw *hw)
case E1000_DEV_ID_PCH_ADP_I219_V16:
case E1000_DEV_ID_PCH_ADP_I219_LM17:
case E1000_DEV_ID_PCH_ADP_I219_V17:
case E1000_DEV_ID_PCH_RPL_I219_LM22:
case E1000_DEV_ID_PCH_RPL_I219_V22:
case E1000_DEV_ID_PCH_RPL_I219_LM23:
case E1000_DEV_ID_PCH_RPL_I219_V23:
hw->mac_type = em_pch_adp;
break;
case E1000_DEV_ID_PCH_MTP_I219_LM18:
case E1000_DEV_ID_PCH_MTP_I219_V18:
case E1000_DEV_ID_PCH_MTP_I219_LM19:
case E1000_DEV_ID_PCH_MTP_I219_V19:
hw->mac_type = em_pch_adp;
case E1000_DEV_ID_PCH_LNP_I219_LM20:
case E1000_DEV_ID_PCH_LNP_I219_V20:
case E1000_DEV_ID_PCH_LNP_I219_LM21:
case E1000_DEV_ID_PCH_LNP_I219_V21:
case E1000_DEV_ID_PCH_ARL_I219_LM24:
case E1000_DEV_ID_PCH_ARL_I219_V24:
hw->mac_type = em_pch_adp; /* pch_mtp */
break;
case E1000_DEV_ID_EP80579_LAN_1:
hw->mac_type = em_icp_xxxx;

View File

@ -31,7 +31,7 @@
*******************************************************************************/
/* $OpenBSD: if_em_hw.h,v 1.89 2023/09/05 13:06:43 naddy Exp $ */
/* $OpenBSD: if_em_hw.h,v 1.90 2023/12/03 00:19:25 jsg Exp $ */
/* $FreeBSD: if_em_hw.h,v 1.15 2005/05/26 23:32:02 tackerman Exp $ */
/* if_em_hw.h
@ -605,6 +605,16 @@ uint32_t em_translate_82542_register(uint32_t);
#define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B
#define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C
#define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D
#define E1000_DEV_ID_PCH_LNP_I219_LM20 0x550E
#define E1000_DEV_ID_PCH_LNP_I219_V20 0x550F
#define E1000_DEV_ID_PCH_LNP_I219_LM21 0x5510
#define E1000_DEV_ID_PCH_LNP_I219_V21 0x5511
#define E1000_DEV_ID_PCH_RPL_I219_LM22 0x0DC7
#define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8
#define E1000_DEV_ID_PCH_RPL_I219_LM23 0x0DC5
#define E1000_DEV_ID_PCH_RPL_I219_V23 0x0DC6
#define E1000_DEV_ID_PCH_ARL_I219_LM24 0x57A0
#define E1000_DEV_ID_PCH_ARL_I219_V24 0x57A1
#define E1000_DEV_ID_82575EB_PT 0x10A7
#define E1000_DEV_ID_82575EB_PF 0x10A9
#define E1000_DEV_ID_82575GB_QP 0x10D6

View File

@ -1,4 +1,4 @@
$OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp $
$OpenBSD: pcidevs,v 1.2060 2023/12/03 00:14:53 jsg Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/*
@ -3759,6 +3759,10 @@ product INTEL I219_V10 0x0d4f I219-V
product INTEL I219_LM12 0x0d53 I219-LM
product INTEL I219_V12 0x0d55 I219-V
product INTEL I225_IT 0x0d9f I225-IT
product INTEL I219_LM23 0x0dc5 I219-LM
product INTEL I219_V23 0x0dc6 I219-V
product INTEL I219_LM22 0x0dc7 I219-LM
product INTEL I219_V22 0x0dc8 I219-V
product INTEL E5V2_HB 0x0e00 E5 v2 Host
product INTEL E5V2_PCIE_1 0x0e01 E5 v2 PCIE
product INTEL E5V2_PCIE_2 0x0e02 E5 v2 PCIE
@ -5990,6 +5994,10 @@ product INTEL I219_LM18 0x550a I219-LM
product INTEL I219_V18 0x550b I219-V
product INTEL I219_LM19 0x550c I219-LM
product INTEL I219_V19 0x550d I219-V
product INTEL I219_LM20 0x550e I219-LM
product INTEL I219_V20 0x550f I219-V
product INTEL I219_LM21 0x5510 I219-LM
product INTEL I219_V21 0x5511 I219-V
product INTEL DG2_G10_1 0x5690 Arc A770M
product INTEL DG2_G10_2 0x5691 Arc A730M
product INTEL DG2_G10_3 0x5692 Arc A550M
@ -6011,6 +6019,8 @@ product INTEL DG2_G12_5 0x56b2 Graphics
product INTEL DG2_G12_6 0x56b3 Graphics
product INTEL ATS_M150 0x56c0 Flex 170
product INTEL ATS_M75 0x56c1 Flex 140
product INTEL I219_LM24 0x57a0 I219-LM
product INTEL I219_V24 0x57a1 I219-V
product INTEL QEMU_NVME 0x5845 QEMU NVM Express Controller
product INTEL KBL_D_GT1 0x5902 HD Graphics 610
product INTEL CORE7G_U_HB 0x5904 Core 7G Host

View File

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp
* OpenBSD: pcidevs,v 1.2060 2023/12/03 00:14:53 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -3764,6 +3764,10 @@
#define PCI_PRODUCT_INTEL_I219_LM12 0x0d53 /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V12 0x0d55 /* I219-V */
#define PCI_PRODUCT_INTEL_I225_IT 0x0d9f /* I225-IT */
#define PCI_PRODUCT_INTEL_I219_LM23 0x0dc5 /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V23 0x0dc6 /* I219-V */
#define PCI_PRODUCT_INTEL_I219_LM22 0x0dc7 /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V22 0x0dc8 /* I219-V */
#define PCI_PRODUCT_INTEL_E5V2_HB 0x0e00 /* E5 v2 Host */
#define PCI_PRODUCT_INTEL_E5V2_PCIE_1 0x0e01 /* E5 v2 PCIE */
#define PCI_PRODUCT_INTEL_E5V2_PCIE_2 0x0e02 /* E5 v2 PCIE */
@ -5995,6 +5999,10 @@
#define PCI_PRODUCT_INTEL_I219_V18 0x550b /* I219-V */
#define PCI_PRODUCT_INTEL_I219_LM19 0x550c /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V19 0x550d /* I219-V */
#define PCI_PRODUCT_INTEL_I219_LM20 0x550e /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V20 0x550f /* I219-V */
#define PCI_PRODUCT_INTEL_I219_LM21 0x5510 /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V21 0x5511 /* I219-V */
#define PCI_PRODUCT_INTEL_DG2_G10_1 0x5690 /* Arc A770M */
#define PCI_PRODUCT_INTEL_DG2_G10_2 0x5691 /* Arc A730M */
#define PCI_PRODUCT_INTEL_DG2_G10_3 0x5692 /* Arc A550M */
@ -6016,6 +6024,8 @@
#define PCI_PRODUCT_INTEL_DG2_G12_6 0x56b3 /* Graphics */
#define PCI_PRODUCT_INTEL_ATS_M150 0x56c0 /* Flex 170 */
#define PCI_PRODUCT_INTEL_ATS_M75 0x56c1 /* Flex 140 */
#define PCI_PRODUCT_INTEL_I219_LM24 0x57a0 /* I219-LM */
#define PCI_PRODUCT_INTEL_I219_V24 0x57a1 /* I219-V */
#define PCI_PRODUCT_INTEL_QEMU_NVME 0x5845 /* QEMU NVM Express Controller */
#define PCI_PRODUCT_INTEL_KBL_D_GT1 0x5902 /* HD Graphics 610 */
#define PCI_PRODUCT_INTEL_CORE7G_U_HB 0x5904 /* Core 7G Host */

View File

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2059 2023/12/01 05:48:39 jsg Exp
* OpenBSD: pcidevs,v 1.2060 2023/12/03 00:14:53 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -12395,6 +12395,22 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I225_IT,
"I225-IT",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM23,
"I219-LM",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V23,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM22,
"I219-LM",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V22,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E5V2_HB,
"E5 v2 Host",
@ -21319,6 +21335,22 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V19,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM20,
"I219-LM",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V20,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM21,
"I219-LM",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V21,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DG2_G10_1,
"Arc A770M",
@ -21403,6 +21435,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ATS_M75,
"Flex 140",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM24,
"I219-LM",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V24,
"I219-V",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QEMU_NVME,
"QEMU NVM Express Controller",

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rtsock.c,v 1.372 2023/11/12 17:51:41 bluhm Exp $ */
/* $OpenBSD: rtsock.c,v 1.373 2023/12/03 10:51:17 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@ -234,7 +234,8 @@ route_attach(struct socket *so, int proto, int wait)
return (ENOBUFS);
so->so_pcb = rop;
/* Init the timeout structure */
timeout_set_proc(&rop->rop_timeout, rtm_senddesync_timer, so);
timeout_set_flags(&rop->rop_timeout, rtm_senddesync_timer, so,
KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE);
refcnt_init(&rop->rop_refcnt);
rop->rop_socket = so;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in_pcb.c,v 1.280 2023/12/01 15:30:46 bluhm Exp $ */
/* $OpenBSD: in_pcb.c,v 1.281 2023/12/03 20:24:17 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@ -243,13 +243,16 @@ in_pcballoc(struct socket *so, struct inpcbtable *table, int wait)
inp->inp_rtableid = curproc->p_p->ps_rtableid;
inp->inp_hops = -1;
#ifdef INET6
/*
* Small change in this function to set the INP_IPV6 flag so routines
* outside pcb-specific routines don't need to use sotopf(), and all
* of its pointer chasing, later.
*/
if (sotopf(so) == PF_INET6)
switch (so->so_proto->pr_domain->dom_family) {
case PF_INET6:
inp->inp_flags = INP_IPV6;
break;
case PF_INET:
/* inp->inp_flags is initialized to 0 */
break;
default:
unhandled_af(so->so_proto->pr_domain->dom_family);
}
inp->inp_cksum6 = -1;
#endif /* INET6 */
@ -283,9 +286,8 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
(so->so_options & SO_ACCEPTCONN) == 0))
wild = INPLOOKUP_WILDCARD;
switch (sotopf(so)) {
#ifdef INET6
case PF_INET6:
if (ISSET(inp->inp_flags, INP_IPV6)) {
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6))
return (EINVAL);
wild |= INPLOOKUP_IPV6;
@ -300,9 +302,9 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
laddr = &sin6->sin6_addr;
lport = sin6->sin6_port;
}
break;
} else
#endif
case PF_INET:
{
if (inp->inp_laddr.s_addr != INADDR_ANY)
return (EINVAL);
@ -316,9 +318,6 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
laddr = &sin->sin_addr;
lport = sin->sin_port;
}
break;
default:
return (EINVAL);
}
if (lport == 0) {
@ -330,16 +329,12 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
return (EACCES);
}
if (nam) {
switch (sotopf(so)) {
#ifdef INET6
case PF_INET6:
if (ISSET(inp->inp_flags, INP_IPV6))
inp->inp_laddr6 = *(struct in6_addr *)laddr;
break;
else
#endif
case PF_INET:
inp->inp_laddr = *(struct in_addr *)laddr;
break;
}
}
inp->inp_lport = lport;
mtx_enter(&table->inpt_mtx);
@ -491,9 +486,8 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
int error;
#ifdef INET6
if (sotopf(inp->inp_socket) == PF_INET6)
if (ISSET(inp->inp_flags, INP_IPV6))
return (in6_pcbconnect(inp, nam));
KASSERT((inp->inp_flags & INP_IPV6) == 0);
#endif /* INET6 */
if ((error = in_nam2sin(nam, &sin)))
@ -576,7 +570,7 @@ in_pcbdetach(struct inpcb *inp)
inp->inp_route.ro_rt = NULL;
}
#ifdef INET6
if (inp->inp_flags & INP_IPV6) {
if (ISSET(inp->inp_flags, INP_IPV6)) {
ip6_freepcbopts(inp->inp_outputopts6);
ip6_freemoptions(inp->inp_moptions6);
} else
@ -644,7 +638,7 @@ in_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
struct sockaddr_in *sin;
#ifdef INET6
if (sotopf(inp->inp_socket) == PF_INET6) {
if (ISSET(inp->inp_flags, INP_IPV6)) {
in6_setpeeraddr(inp, nam);
return;
}
@ -721,7 +715,7 @@ in_pcbnotifyall(struct inpcbtable *table, struct sockaddr *dst, u_int rtable,
mtx_enter(&table->inpt_mtx);
TAILQ_FOREACH(inp, &table->inpt_queue, inp_queue) {
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
if (ISSET(inp->inp_flags, INP_IPV6))
continue;
#endif
if (inp->inp_faddr.s_addr != faddr.s_addr ||
@ -894,29 +888,27 @@ in_pcbrtentry(struct inpcb *inp)
memset(ro, 0, sizeof(struct route));
#endif
switch(sotopf(inp->inp_socket)) {
#ifdef INET6
case PF_INET6:
if (ISSET(inp->inp_flags, INP_IPV6)) {
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6))
break;
return (NULL);
ro->ro_dst.sa_family = AF_INET6;
ro->ro_dst.sa_len = sizeof(struct sockaddr_in6);
satosin6(&ro->ro_dst)->sin6_addr = inp->inp_faddr6;
ro->ro_tableid = inp->inp_rtableid;
ro->ro_rt = rtalloc_mpath(&ro->ro_dst,
&inp->inp_laddr6.s6_addr32[0], ro->ro_tableid);
break;
} else
#endif /* INET6 */
case PF_INET:
{
if (inp->inp_faddr.s_addr == INADDR_ANY)
break;
return (NULL);
ro->ro_dst.sa_family = AF_INET;
ro->ro_dst.sa_len = sizeof(struct sockaddr_in);
satosin(&ro->ro_dst)->sin_addr = inp->inp_faddr;
ro->ro_tableid = inp->inp_rtableid;
ro->ro_rt = rtalloc_mpath(&ro->ro_dst,
&inp->inp_laddr.s_addr, ro->ro_tableid);
break;
}
}
return (ro->ro_rt);
@ -1059,7 +1051,7 @@ in_pcbhash_insert(struct inpcb *inp)
head = &table->inpt_lhashtbl[lhash & table->inpt_lmask];
LIST_INSERT_HEAD(head, inp, inp_lhash);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
if (ISSET(inp->inp_flags, INP_IPV6))
hash = in6_pcbhash(table, rtable_l2(inp->inp_rtableid),
&inp->inp_faddr6, inp->inp_fport,
&inp->inp_laddr6, inp->inp_lport);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in_pcb.h,v 1.141 2023/12/01 15:30:46 bluhm Exp $ */
/* $OpenBSD: in_pcb.h,v 1.142 2023/12/03 20:24:17 bluhm Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@ -205,7 +205,7 @@ struct inpcbtable {
* These flags' values should be determined by either the transport
* protocol at PRU_BIND, PRU_LISTEN, PRU_CONNECT, etc, or by in_pcb*().
*/
#define INP_IPV6 0x100 /* sotopf(inp->inp_socket) == PF_INET6 */
#define INP_IPV6 0x100 /* socket, proto, domain, family is PF_INET6 */
/*
* Flags in inp_flags for IPV6
@ -273,8 +273,6 @@ extern struct baddynamicports baddynamicports;
extern struct baddynamicports rootonlyports;
extern int in_pcbnotifymiss;
#define sotopf(so) (so->so_proto->pr_domain->dom_family)
void in_init(void);
void in_losing(struct inpcb *);
int in_pcballoc(struct socket *, struct inpcbtable *, int);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_ipsp.c,v 1.277 2023/10/11 22:13:16 tobhe Exp $ */
/* $OpenBSD: ip_ipsp.c,v 1.278 2023/12/03 10:50:25 mvs Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
@ -124,7 +124,8 @@ void ipsp_ids_gc(void *);
LIST_HEAD(, ipsec_ids) ipsp_ids_gc_list =
LIST_HEAD_INITIALIZER(ipsp_ids_gc_list); /* [F] */
struct timeout ipsp_ids_gc_timeout =
TIMEOUT_INITIALIZER_FLAGS(ipsp_ids_gc, NULL, KCLOCK_NONE, TIMEOUT_PROC);
TIMEOUT_INITIALIZER_FLAGS(ipsp_ids_gc, NULL, KCLOCK_NONE,
TIMEOUT_PROC | TIMEOUT_MPSAFE);
static inline int ipsp_ids_cmp(const struct ipsec_ids *,
const struct ipsec_ids *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_usrreq.c,v 1.226 2023/12/01 15:30:47 bluhm Exp $ */
/* $OpenBSD: tcp_usrreq.c,v 1.227 2023/12/03 20:24:17 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@ -312,19 +312,12 @@ tcp_ctloutput(int op, struct socket *so, int level, int optname,
if (inp == NULL)
return (ECONNRESET);
if (level != IPPROTO_TCP) {
switch (so->so_proto->pr_domain->dom_family) {
#ifdef INET6
case PF_INET6:
if (ISSET(inp->inp_flags, INP_IPV6))
error = ip6_ctloutput(op, so, level, optname, m);
break;
else
#endif /* INET6 */
case PF_INET:
error = ip_ctloutput(op, so, level, optname, m);
break;
default:
error = EAFNOSUPPORT; /*?*/
break;
}
return (error);
}
tp = intotcpcb(inp);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: icmp6.c,v 1.250 2023/11/28 13:23:20 bluhm Exp $ */
/* $OpenBSD: icmp6.c,v 1.251 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -1693,7 +1693,7 @@ icmp6_ctloutput(int op, struct socket *so, int level, int optname,
struct mbuf *m)
{
int error = 0;
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
if (level != IPPROTO_ICMPV6)
return EINVAL;
@ -1710,11 +1710,11 @@ icmp6_ctloutput(int op, struct socket *so, int level, int optname,
break;
}
p = mtod(m, struct icmp6_filter *);
if (!p || !in6p->inp_icmp6filt) {
if (!p || !inp->inp_icmp6filt) {
error = EINVAL;
break;
}
bcopy(p, in6p->inp_icmp6filt,
bcopy(p, inp->inp_icmp6filt,
sizeof(struct icmp6_filter));
error = 0;
break;
@ -1732,13 +1732,13 @@ icmp6_ctloutput(int op, struct socket *so, int level, int optname,
{
struct icmp6_filter *p;
if (!in6p->inp_icmp6filt) {
if (!inp->inp_icmp6filt) {
error = EINVAL;
break;
}
m->m_len = sizeof(struct icmp6_filter);
p = mtod(m, struct icmp6_filter *);
bcopy(in6p->inp_icmp6filt, p,
bcopy(inp->inp_icmp6filt, p,
sizeof(struct icmp6_filter));
error = 0;
break;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in6_pcb.c,v 1.128 2023/12/01 15:30:47 bluhm Exp $ */
/* $OpenBSD: in6_pcb.c,v 1.130 2023/12/03 20:36:24 bluhm Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -252,7 +252,7 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
int error;
struct sockaddr_in6 tmp;
KASSERT(inp->inp_flags & INP_IPV6);
KASSERT(ISSET(inp->inp_flags, INP_IPV6));
if ((error = in6_nam2sin6(nam, &sin6)))
return (error);
@ -373,10 +373,10 @@ in6_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
int
in6_sockaddr(struct socket *so, struct mbuf *nam)
{
struct inpcb *in6p;
struct inpcb *inp;
in6p = sotoinpcb(so);
in6_setsockaddr(in6p, nam);
inp = sotoinpcb(so);
in6_setsockaddr(inp, nam);
return (0);
}
@ -384,10 +384,10 @@ in6_sockaddr(struct socket *so, struct mbuf *nam)
int
in6_peeraddr(struct socket *so, struct mbuf *nam)
{
struct inpcb *in6p;
struct inpcb *inp;
in6p = sotoinpcb(so);
in6_setpeeraddr(in6p, nam);
inp = sotoinpcb(so);
in6_setpeeraddr(inp, nam);
return (0);
}
@ -461,7 +461,7 @@ in6_pcbnotify(struct inpcbtable *table, struct sockaddr_in6 *dst,
rw_enter_write(&table->inpt_notify);
mtx_enter(&table->inpt_mtx);
TAILQ_FOREACH(inp, &table->inpt_queue, inp_queue) {
if ((inp->inp_flags & INP_IPV6) == 0)
if (!ISSET(inp->inp_flags, INP_IPV6))
continue;
/*

View File

@ -1,4 +1,4 @@
/* $OpenBSD: in6_src.c,v 1.88 2023/12/01 14:08:04 bluhm Exp $ */
/* $OpenBSD: in6_src.c,v 1.89 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@ -422,10 +422,10 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
}
int
in6_selecthlim(struct inpcb *in6p)
in6_selecthlim(struct inpcb *inp)
{
if (in6p && in6p->inp_hops >= 0)
return (in6p->inp_hops);
if (inp && inp->inp_hops >= 0)
return (inp->inp_hops);
return (ip6_defhlim);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_input.c,v 1.256 2023/09/16 09:33:27 mpi Exp $ */
/* $OpenBSD: ip6_input.c,v 1.257 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@ -1012,11 +1012,11 @@ ip6_unknown_opt(struct mbuf **mp, u_int8_t *optp, int off)
* you are using IP6_EXTHDR_CHECK() not m_pulldown())
*/
void
ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
{
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
if (in6p->inp_socket->so_options & SO_TIMESTAMP) {
if (inp->inp_socket->so_options & SO_TIMESTAMP) {
struct timeval tv;
m_microtime(m, &tv);
@ -1027,7 +1027,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
}
/* RFC 2292 sec. 5 */
if ((in6p->inp_flags & IN6P_PKTINFO) != 0) {
if ((inp->inp_flags & IN6P_PKTINFO) != 0) {
struct in6_pktinfo pi6;
memcpy(&pi6.ipi6_addr, &ip6->ip6_dst, sizeof(struct in6_addr));
if (IN6_IS_SCOPE_EMBED(&pi6.ipi6_addr))
@ -1040,7 +1040,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
mp = &(*mp)->m_next;
}
if ((in6p->inp_flags & IN6P_HOPLIMIT) != 0) {
if ((inp->inp_flags & IN6P_HOPLIMIT) != 0) {
int hlim = ip6->ip6_hlim & 0xff;
*mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int),
IPV6_HOPLIMIT, IPPROTO_IPV6);
@ -1048,7 +1048,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
mp = &(*mp)->m_next;
}
if ((in6p->inp_flags & IN6P_TCLASS) != 0) {
if ((inp->inp_flags & IN6P_TCLASS) != 0) {
u_int32_t flowinfo;
int tclass;
@ -1069,7 +1069,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
* returned to normal user.
* See also RFC 2292 section 6 (or RFC 3542 section 8).
*/
if ((in6p->inp_flags & IN6P_HOPOPTS) != 0) {
if ((inp->inp_flags & IN6P_HOPOPTS) != 0) {
/*
* Check if a hop-by-hop options header is contained in the
* received packet, and if so, store the options as ancillary
@ -1114,7 +1114,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
}
/* IPV6_DSTOPTS and IPV6_RTHDR socket options */
if ((in6p->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) {
if ((inp->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) {
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
int nxt = ip6->ip6_nxt, off = sizeof(struct ip6_hdr);
@ -1162,7 +1162,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
switch (nxt) {
case IPPROTO_DSTOPTS:
if (!(in6p->inp_flags & IN6P_DSTOPTS))
if (!(inp->inp_flags & IN6P_DSTOPTS))
break;
*mp = sbcreatecontrol((caddr_t)ip6e, elen,
@ -1173,7 +1173,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
break;
case IPPROTO_ROUTING:
if (!(in6p->inp_flags & IN6P_RTHDR))
if (!(inp->inp_flags & IN6P_RTHDR))
break;
*mp = sbcreatecontrol((caddr_t)ip6e, elen,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_var.h,v 1.108 2023/12/01 14:08:04 bluhm Exp $ */
/* $OpenBSD: ip6_var.h,v 1.109 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */
/*
@ -301,7 +301,6 @@ extern uint8_t ip6_soiikey[IP6_SOIIKEY_LEN];
extern const struct pr_usrreqs rip6_usrreqs;
struct in6pcb;
struct inpcb;
int icmp6_ctloutput(int, struct socket *, int, int, struct mbuf *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: raw_ip6.c,v 1.176 2023/12/01 14:08:04 bluhm Exp $ */
/* $OpenBSD: raw_ip6.c,v 1.177 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@ -135,7 +135,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
{
struct mbuf *m = *mp;
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct inpcb *in6p;
struct inpcb *inp;
SIMPLEQ_HEAD(, inpcb) inpcblist;
struct in6_addr *key;
struct sockaddr_in6 rip6src;
@ -182,29 +182,29 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
SIMPLEQ_INIT(&inpcblist);
rw_enter_write(&rawin6pcbtable.inpt_notify);
mtx_enter(&rawin6pcbtable.inpt_mtx);
TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) {
if (in6p->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE)
TAILQ_FOREACH(inp, &rawin6pcbtable.inpt_queue, inp_queue) {
if (inp->inp_socket->so_rcv.sb_state & SS_CANTRCVMORE)
continue;
if (rtable_l2(in6p->inp_rtableid) !=
if (rtable_l2(inp->inp_rtableid) !=
rtable_l2(m->m_pkthdr.ph_rtableid))
continue;
if (!(in6p->inp_flags & INP_IPV6))
if (!(inp->inp_flags & INP_IPV6))
continue;
if ((in6p->inp_ipv6.ip6_nxt || proto == IPPROTO_ICMPV6) &&
in6p->inp_ipv6.ip6_nxt != proto)
if ((inp->inp_ipv6.ip6_nxt || proto == IPPROTO_ICMPV6) &&
inp->inp_ipv6.ip6_nxt != proto)
continue;
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->inp_laddr6) &&
!IN6_ARE_ADDR_EQUAL(&in6p->inp_laddr6, key))
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) &&
!IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, key))
continue;
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->inp_faddr6) &&
!IN6_ARE_ADDR_EQUAL(&in6p->inp_faddr6, &ip6->ip6_src))
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6) &&
!IN6_ARE_ADDR_EQUAL(&inp->inp_faddr6, &ip6->ip6_src))
continue;
if (proto == IPPROTO_ICMPV6 && in6p->inp_icmp6filt) {
if (ICMP6_FILTER_WILLBLOCK(type, in6p->inp_icmp6filt))
if (proto == IPPROTO_ICMPV6 && inp->inp_icmp6filt) {
if (ICMP6_FILTER_WILLBLOCK(type, inp->inp_icmp6filt))
continue;
}
if (proto != IPPROTO_ICMPV6 && in6p->inp_cksum6 != -1) {
if (proto != IPPROTO_ICMPV6 && inp->inp_cksum6 != -1) {
rip6stat_inc(rip6s_isum);
/*
* Although in6_cksum() does not need the position of
@ -214,7 +214,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
* invalid. Avoid overflow with user supplied offset.
*/
if (m->m_pkthdr.len < *offp + 2 ||
m->m_pkthdr.len - *offp - 2 < in6p->inp_cksum6 ||
m->m_pkthdr.len - *offp - 2 < inp->inp_cksum6 ||
in6_cksum(m, proto, *offp,
m->m_pkthdr.len - *offp)) {
rip6stat_inc(rip6s_badsum);
@ -222,8 +222,8 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
}
}
in_pcbref(in6p);
SIMPLEQ_INSERT_TAIL(&inpcblist, in6p, inp_notify);
in_pcbref(inp);
SIMPLEQ_INSERT_TAIL(&inpcblist, inp, inp_notify);
}
mtx_leave(&rawin6pcbtable.inpt_mtx);
@ -253,7 +253,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
return IPPROTO_DONE;
}
while ((in6p = SIMPLEQ_FIRST(&inpcblist)) != NULL) {
while ((inp = SIMPLEQ_FIRST(&inpcblist)) != NULL) {
struct mbuf *n, *opts = NULL;
SIMPLEQ_REMOVE_HEAD(&inpcblist, inp_notify);
@ -264,16 +264,16 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
if (n != NULL) {
int ret;
if (in6p->inp_flags & IN6P_CONTROLOPTS)
ip6_savecontrol(in6p, n, &opts);
if (inp->inp_flags & IN6P_CONTROLOPTS)
ip6_savecontrol(inp, n, &opts);
/* strip intermediate headers */
m_adj(n, *offp);
mtx_enter(&in6p->inp_mtx);
ret = sbappendaddr(in6p->inp_socket,
&in6p->inp_socket->so_rcv,
mtx_enter(&inp->inp_mtx);
ret = sbappendaddr(inp->inp_socket,
&inp->inp_socket->so_rcv,
sin6tosa(&rip6src), n, opts);
mtx_leave(&in6p->inp_mtx);
mtx_leave(&inp->inp_mtx);
if (ret == 0) {
/* should notify about lost packet */
@ -281,9 +281,9 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
m_freem(opts);
rip6stat_inc(rip6s_fullsock);
} else
sorwakeup(in6p->inp_socket);
sorwakeup(inp->inp_socket);
}
in_pcbunref(in6p);
in_pcbunref(inp);
}
rw_exit_write(&rawin6pcbtable.inpt_notify);
@ -332,7 +332,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d)
if (ip6 && cmd == PRC_MSGSIZE) {
int valid = 0;
struct inpcb *in6p;
struct inpcb *inp;
/*
* Check to see if we have a valid raw IPv6 socket
@ -341,11 +341,11 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d)
* XXX chase extension headers, or pass final nxt value
* from icmp6_notify_error()
*/
in6p = in6_pcblookup(&rawin6pcbtable, &sa6->sin6_addr, 0,
inp = in6_pcblookup(&rawin6pcbtable, &sa6->sin6_addr, 0,
&sa6_src->sin6_addr, 0, rdomain);
if (in6p && in6p->inp_ipv6.ip6_nxt &&
in6p->inp_ipv6.ip6_nxt == nxt)
if (inp && inp->inp_ipv6.ip6_nxt &&
inp->inp_ipv6.ip6_nxt == nxt)
valid = 1;
/*
@ -356,7 +356,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d)
* - ignore the MTU change notification.
*/
icmp6_mtudisc_update((struct ip6ctlparam *)d, valid);
in_pcbunref(in6p);
in_pcbunref(inp);
/*
* regardless of if we called icmp6_mtudisc_update(),
@ -381,7 +381,7 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
{
struct in6_addr *dst;
struct ip6_hdr *ip6;
struct inpcb *in6p;
struct inpcb *inp;
u_int plen = m->m_pkthdr.len;
int error = 0;
struct ip6_pktopts opt, *optp = NULL;
@ -389,19 +389,19 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
int priv = 0;
int flags;
in6p = sotoinpcb(so);
inp = sotoinpcb(so);
priv = 0;
if ((so->so_state & SS_PRIV) != 0)
priv = 1;
if (control) {
if ((error = ip6_setpktopts(control, &opt,
in6p->inp_outputopts6,
inp->inp_outputopts6,
priv, so->so_proto->pr_protocol)) != 0)
goto bad;
optp = &opt;
} else
optp = in6p->inp_outputopts6;
optp = inp->inp_outputopts6;
if (dstaddr->sa_family != AF_INET6) {
error = EAFNOSUPPORT;
@ -442,7 +442,7 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
/* KAME hack: embed scopeid */
if (in6_embedscope(&ip6->ip6_dst, satosin6(dstaddr),
optp, in6p->inp_moptions6) != 0) {
optp, inp->inp_moptions6) != 0) {
error = EINVAL;
goto bad;
}
@ -453,24 +453,24 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
{
const struct in6_addr *in6a;
error = in6_pcbselsrc(&in6a, satosin6(dstaddr), in6p, optp);
error = in6_pcbselsrc(&in6a, satosin6(dstaddr), inp, optp);
if (error)
goto bad;
ip6->ip6_src = *in6a;
}
ip6->ip6_flow = in6p->inp_flowinfo & IPV6_FLOWINFO_MASK;
ip6->ip6_flow = inp->inp_flowinfo & IPV6_FLOWINFO_MASK;
ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
ip6->ip6_vfc |= IPV6_VERSION;
#if 0 /* ip6_plen will be filled in ip6_output. */
ip6->ip6_plen = htons((u_short)plen);
#endif
ip6->ip6_nxt = in6p->inp_ipv6.ip6_nxt;
ip6->ip6_hlim = in6_selecthlim(in6p);
ip6->ip6_nxt = inp->inp_ipv6.ip6_nxt;
ip6->ip6_hlim = in6_selecthlim(inp);
if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 ||
in6p->inp_cksum6 != -1) {
inp->inp_cksum6 != -1) {
struct mbuf *n;
int off;
u_int16_t *sump;
@ -480,7 +480,7 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
if (so->so_proto->pr_protocol == IPPROTO_ICMPV6)
off = offsetof(struct icmp6_hdr, icmp6_cksum);
else
off = in6p->inp_cksum6;
off = inp->inp_cksum6;
if (plen < 2 || plen - 2 < off) {
error = EINVAL;
goto bad;
@ -499,20 +499,20 @@ rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
}
flags = 0;
if (in6p->inp_flags & IN6P_MINMTU)
if (inp->inp_flags & IN6P_MINMTU)
flags |= IPV6_MINMTU;
/* force routing table */
m->m_pkthdr.ph_rtableid = in6p->inp_rtableid;
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
#if NPF > 0
if (in6p->inp_socket->so_state & SS_ISCONNECTED &&
if (inp->inp_socket->so_state & SS_ISCONNECTED &&
so->so_proto->pr_protocol != IPPROTO_ICMPV6)
pf_mbuf_link_inpcb(m, in6p);
pf_mbuf_link_inpcb(m, inp);
#endif
error = ip6_output(m, optp, &in6p->inp_route6, flags,
in6p->inp_moptions6, in6p->inp_seclevel);
error = ip6_output(m, optp, &inp->inp_route6, flags,
inp->inp_moptions6, inp->inp_seclevel);
if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) {
icmp6stat_inc(icp6s_outhist + type);
} else
@ -584,7 +584,7 @@ extern u_long rip6_recvspace;
int
rip6_attach(struct socket *so, int proto, int wait)
{
struct inpcb *in6p;
struct inpcb *inp;
int error;
if (so->so_pcb)
@ -600,37 +600,37 @@ rip6_attach(struct socket *so, int proto, int wait)
if ((error = in_pcballoc(so, &rawin6pcbtable, wait)))
return error;
in6p = sotoinpcb(so);
in6p->inp_ipv6.ip6_nxt = proto;
in6p->inp_cksum6 = -1;
inp = sotoinpcb(so);
inp->inp_ipv6.ip6_nxt = proto;
inp->inp_cksum6 = -1;
in6p->inp_icmp6filt = malloc(sizeof(struct icmp6_filter), M_PCB,
inp->inp_icmp6filt = malloc(sizeof(struct icmp6_filter), M_PCB,
wait == M_WAIT ? M_WAITOK : M_NOWAIT);
if (in6p->inp_icmp6filt == NULL) {
in_pcbdetach(in6p);
if (inp->inp_icmp6filt == NULL) {
in_pcbdetach(inp);
return ENOMEM;
}
ICMP6_FILTER_SETPASSALL(in6p->inp_icmp6filt);
ICMP6_FILTER_SETPASSALL(inp->inp_icmp6filt);
return 0;
}
int
rip6_detach(struct socket *so)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
soassertlocked(so);
if (in6p == NULL)
if (inp == NULL)
panic("%s", __func__);
#ifdef MROUTING
if (so == ip6_mrouter[in6p->inp_rtableid])
if (so == ip6_mrouter[inp->inp_rtableid])
ip6_mrouter_done(so);
#endif
free(in6p->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter));
in6p->inp_icmp6filt = NULL;
free(inp->inp_icmp6filt, M_PCB, sizeof(struct icmp6_filter));
inp->inp_icmp6filt = NULL;
in_pcbdetach(in6p);
in_pcbdetach(inp);
return (0);
}
@ -638,25 +638,25 @@ rip6_detach(struct socket *so)
void
rip6_lock(struct socket *so)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
NET_ASSERT_LOCKED();
mtx_enter(&in6p->inp_mtx);
mtx_enter(&inp->inp_mtx);
}
void
rip6_unlock(struct socket *so)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
NET_ASSERT_LOCKED();
mtx_leave(&in6p->inp_mtx);
mtx_leave(&inp->inp_mtx);
}
int
rip6_bind(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in6 *addr;
int error;
@ -671,17 +671,17 @@ rip6_bind(struct socket *so, struct mbuf *nam, struct proc *p)
*/
addr->sin6_port = 0;
if ((error = in6_pcbaddrisavail(in6p, addr, 0, p)))
if ((error = in6_pcbaddrisavail(inp, addr, 0, p)))
return (error);
in6p->inp_laddr6 = addr->sin6_addr;
inp->inp_laddr6 = addr->sin6_addr;
return (0);
}
int
rip6_connect(struct socket *so, struct mbuf *nam)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in6 *addr;
const struct in6_addr *in6a;
int error;
@ -692,12 +692,12 @@ rip6_connect(struct socket *so, struct mbuf *nam)
return (error);
/* Source address selection. XXX: need pcblookup? */
error = in6_pcbselsrc(&in6a, addr, in6p, in6p->inp_outputopts6);
error = in6_pcbselsrc(&in6a, addr, inp, inp->inp_outputopts6);
if (error)
return (error);
in6p->inp_laddr6 = *in6a;
in6p->inp_faddr6 = addr->sin6_addr;
inp->inp_laddr6 = *in6a;
inp->inp_faddr6 = addr->sin6_addr;
soisconnected(so);
return (0);
}
@ -705,14 +705,14 @@ rip6_connect(struct socket *so, struct mbuf *nam)
int
rip6_disconnect(struct socket *so)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
soassertlocked(so);
if ((so->so_state & SS_ISCONNECTED) == 0)
return (ENOTCONN);
in6p->inp_faddr6 = in6addr_any;
inp->inp_faddr6 = in6addr_any;
so->so_state &= ~SS_ISCONNECTED; /* XXX */
return (0);
}
@ -732,7 +732,7 @@ int
rip6_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
struct mbuf *control)
{
struct inpcb *in6p = sotoinpcb(so);
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in6 dst;
int error;
@ -752,7 +752,7 @@ rip6_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
error = EISCONN;
goto out;
}
dst.sin6_addr = in6p->inp_faddr6;
dst.sin6_addr = inp->inp_faddr6;
} else {
struct sockaddr_in6 *addr6;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: udp6_output.c,v 1.62 2023/12/01 14:08:04 bluhm Exp $ */
/* $OpenBSD: udp6_output.c,v 1.63 2023/12/03 20:36:24 bluhm Exp $ */
/* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */
/*
@ -93,7 +93,7 @@
* Per RFC 768, August, 1980.
*/
int
udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
udp6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr6,
struct mbuf *control)
{
u_int32_t ulen = m->m_pkthdr.len;
@ -107,15 +107,15 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
struct proc *p = curproc; /* XXX */
u_short fport;
if ((in6p->inp_socket->so_state & SS_PRIV) != 0)
if ((inp->inp_socket->so_state & SS_PRIV) != 0)
priv = 1;
if (control) {
if ((error = ip6_setpktopts(control, &opt,
in6p->inp_outputopts6, priv, IPPROTO_UDP)) != 0)
inp->inp_outputopts6, priv, IPPROTO_UDP)) != 0)
goto release;
optp = &opt;
} else
optp = in6p->inp_outputopts6;
optp = inp->inp_outputopts6;
if (addr6) {
struct sockaddr_in6 *sin6;
@ -130,7 +130,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
error = EADDRNOTAVAIL;
goto release;
}
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->inp_faddr6)) {
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) {
error = EISCONN;
goto release;
}
@ -144,40 +144,40 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
/* KAME hack: embed scopeid */
if (in6_embedscope(&sin6->sin6_addr, sin6,
in6p->inp_outputopts6, in6p->inp_moptions6) != 0) {
inp->inp_outputopts6, inp->inp_moptions6) != 0) {
error = EINVAL;
goto release;
}
error = in6_pcbselsrc(&laddr, sin6, in6p, optp);
error = in6_pcbselsrc(&laddr, sin6, inp, optp);
if (error)
goto release;
if (in6p->inp_lport == 0){
error = in_pcbbind(in6p, NULL, p);
if (inp->inp_lport == 0){
error = in_pcbbind(inp, NULL, p);
if (error)
goto release;
}
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->inp_laddr6) &&
!IN6_ARE_ADDR_EQUAL(&in6p->inp_laddr6, laddr)) {
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) &&
!IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, laddr)) {
valid.sin6_addr = *laddr;
valid.sin6_port = in6p->inp_lport;
valid.sin6_port = inp->inp_lport;
valid.sin6_scope_id = 0;
valid.sin6_family = AF_INET6;
valid.sin6_len = sizeof(valid);
error = in6_pcbaddrisavail(in6p, &valid, 0, p);
error = in6_pcbaddrisavail(inp, &valid, 0, p);
if (error)
goto release;
}
} else {
if (IN6_IS_ADDR_UNSPECIFIED(&in6p->inp_faddr6)) {
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) {
error = ENOTCONN;
goto release;
}
laddr = &in6p->inp_laddr6;
faddr = &in6p->inp_faddr6;
fport = in6p->inp_fport;
laddr = &inp->inp_laddr6;
faddr = &inp->inp_faddr6;
fport = inp->inp_fport;
}
hlen = sizeof(struct ip6_hdr);
@ -196,7 +196,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
* Stuff checksum and output datagram.
*/
udp6 = (struct udphdr *)(mtod(m, caddr_t) + hlen);
udp6->uh_sport = in6p->inp_lport; /* lport is always set in the PCB */
udp6->uh_sport = inp->inp_lport; /* lport is always set in the PCB */
udp6->uh_dport = fport;
if (plen <= 0xffff)
udp6->uh_ulen = htons((u_short)plen);
@ -205,35 +205,35 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
udp6->uh_sum = 0;
ip6 = mtod(m, struct ip6_hdr *);
ip6->ip6_flow = in6p->inp_flowinfo & IPV6_FLOWINFO_MASK;
ip6->ip6_flow = inp->inp_flowinfo & IPV6_FLOWINFO_MASK;
ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
ip6->ip6_vfc |= IPV6_VERSION;
#if 0 /* ip6_plen will be filled in ip6_output. */
ip6->ip6_plen = htons((u_short)plen);
#endif
ip6->ip6_nxt = IPPROTO_UDP;
ip6->ip6_hlim = in6_selecthlim(in6p);
ip6->ip6_hlim = in6_selecthlim(inp);
ip6->ip6_src = *laddr;
ip6->ip6_dst = *faddr;
m->m_pkthdr.csum_flags |= M_UDP_CSUM_OUT;
flags = 0;
if (in6p->inp_flags & IN6P_MINMTU)
if (inp->inp_flags & IN6P_MINMTU)
flags |= IPV6_MINMTU;
udpstat_inc(udps_opackets);
/* force routing table */
m->m_pkthdr.ph_rtableid = in6p->inp_rtableid;
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
#if NPF > 0
if (in6p->inp_socket->so_state & SS_ISCONNECTED)
pf_mbuf_link_inpcb(m, in6p);
if (inp->inp_socket->so_state & SS_ISCONNECTED)
pf_mbuf_link_inpcb(m, inp);
#endif
error = ip6_output(m, optp, &in6p->inp_route6,
flags, in6p->inp_moptions6, in6p->inp_seclevel);
error = ip6_output(m, optp, &inp->inp_route6,
flags, inp->inp_moptions6, inp->inp_seclevel);
goto releaseopt;
release:

View File

@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: PkgAdd.pm,v 1.148 2023/11/25 17:43:39 espie Exp $
# $OpenBSD: PkgAdd.pm,v 1.149 2023/12/03 16:38:28 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@ -359,7 +359,7 @@ sub find_kept_handle($set, $n, $state)
}
}
$set->check_security($state, $plist, $o);
if ($set->{quirks} || $plist->has('updatedb')) {
if ($plist->has('updatedb')) {
# The installed package has inst: for a location, we want
# the newer one (which is identical)
$n->location->{repository}->setup_cache($state->{setlist});
@ -843,7 +843,7 @@ sub really_add($set, $state)
add_installed($pkgname);
delete $handle->{partial};
OpenBSD::PkgCfl::register($handle, $state);
if ($set->{quirks} || $plist->has('updatedb')) {
if ($plist->has('updatedb')) {
$handle->location->{repository}->setup_cache($state->{setlist});
}
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.293 2023/12/01 09:25:49 op Exp $ */
/* $OpenBSD: parse.y,v 1.296 2023/12/03 11:52:16 op Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@ -2149,6 +2149,14 @@ opt_sock_listen : FILTER STRING {
YYERROR;
}
}
| NO_DSN {
if (listen_opts.options & LO_NODSN) {
yyerror("no-dsn already specified");
YYERROR;
}
listen_opts.options |= LO_NODSN;
listen_opts.flags &= ~F_EXT_DSN;
}
| TAG STRING {
if (listen_opts.options & LO_TAG) {
yyerror("tag already specified");
@ -3123,6 +3131,8 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts)
/* If the socket listener was not configured, create a default one. */
if (!conf->sc_sock_listener) {
memset(&listen_opts, 0, sizeof listen_opts);
listen_opts.family = AF_UNSPEC;
listen_opts.flags |= F_EXT_DSN;
create_sock_listener(&listen_opts);
}

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: smtpd.conf.5,v 1.265 2023/05/19 15:18:06 op Exp $
.\" $OpenBSD: smtpd.conf.5,v 1.266 2023/12/03 11:52:16 op Exp $
.\"
.\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org>
.\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@ -17,7 +17,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
.Dd $Mdocdate: May 19 2023 $
.Dd $Mdocdate: December 3 2023 $
.Dt SMTPD.CONF 5
.Os
.Sh NAME
@ -565,6 +565,8 @@ Omit the
part when prepending
.Dq Received
headers.
.It Cm no-dsn
Disable the DSN (Delivery Status Notification) extension.
.It Cm tag Ar tag
Clients connecting to the listener are tagged with the given
.Ar tag .