sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-09-11 21:36:40 +00:00
parent 010ec4e74c
commit 2a511f7966
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
51 changed files with 340 additions and 268 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cms_sd.c,v 1.26 2023/07/08 08:26:26 beck Exp $ */
/* $OpenBSD: cms_sd.c,v 1.28 2023/09/11 09:29:30 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@ -256,16 +256,16 @@ static int
cms_sd_asn1_ctrl(CMS_SignerInfo *si, int cmd)
{
EVP_PKEY *pkey = si->pkey;
int i;
int ret;
if (!pkey->ameth || !pkey->ameth->pkey_ctrl)
if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL)
return 1;
i = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_CMS_SIGN, cmd, si);
if (i == -2) {
ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_CMS_SIGN, cmd, si);
if (ret == -2) {
CMSerror(CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
return 0;
}
if (i <= 0) {
if (ret <= 0) {
CMSerror(CMS_R_CTRL_FAILURE);
return 0;
}
@ -721,119 +721,113 @@ cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain)
int
CMS_SignerInfo_sign(CMS_SignerInfo *si)
{
EVP_MD_CTX *mctx = si->mctx;
EVP_PKEY_CTX *pctx = NULL;
unsigned char *abuf = NULL;
int alen;
size_t siglen;
const EVP_MD *md = NULL;
const EVP_MD *md;
unsigned char *buf = NULL, *sig = NULL;
int buf_len = 0;
size_t sig_len = 0;
int ret = 0;
md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm);
if (md == NULL)
return 0;
if ((md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm)) == NULL)
goto err;
if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) {
if (!cms_add1_signingTime(si, NULL))
goto err;
}
if (si->pctx)
pctx = si->pctx;
else {
EVP_MD_CTX_reset(mctx);
if (EVP_DigestSignInit(mctx, &pctx, md, NULL, si->pkey) <= 0)
if (si->pctx == NULL) {
EVP_MD_CTX_reset(si->mctx);
if (!EVP_DigestSignInit(si->mctx, &si->pctx, md, NULL, si->pkey))
goto err;
si->pctx = pctx;
}
if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
if (EVP_PKEY_CTX_ctrl(si->pctx, -1, EVP_PKEY_OP_SIGN,
EVP_PKEY_CTRL_CMS_SIGN, 0, si) <= 0) {
CMSerror(CMS_R_CTRL_ERROR);
goto err;
}
alen = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &abuf,
&CMS_Attributes_Sign_it);
if (!abuf)
if ((buf_len = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &buf,
&CMS_Attributes_Sign_it)) <= 0) {
buf_len = 0;
goto err;
if (EVP_DigestSignUpdate(mctx, abuf, alen) <= 0)
}
if (!EVP_DigestSign(si->mctx, NULL, &sig_len, buf, buf_len))
goto err;
if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0)
if ((sig = calloc(1, sig_len)) == NULL)
goto err;
free(abuf);
abuf = malloc(siglen);
if (abuf == NULL)
goto err;
if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0)
if (!EVP_DigestSign(si->mctx, sig, &sig_len, buf, buf_len))
goto err;
if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,
if (EVP_PKEY_CTX_ctrl(si->pctx, -1, EVP_PKEY_OP_SIGN,
EVP_PKEY_CTRL_CMS_SIGN, 1, si) <= 0) {
CMSerror(CMS_R_CTRL_ERROR);
goto err;
}
EVP_MD_CTX_reset(mctx);
ASN1_STRING_set0(si->signature, sig, sig_len);
sig = NULL;
ASN1_STRING_set0(si->signature, abuf, siglen);
return 1;
ret = 1;
err:
free(abuf);
EVP_MD_CTX_reset(mctx);
if (si->mctx != NULL)
EVP_MD_CTX_reset(si->mctx);
freezero(buf, buf_len);
freezero(sig, sig_len);
return 0;
return ret;
}
LCRYPTO_ALIAS(CMS_SignerInfo_sign);
int
CMS_SignerInfo_verify(CMS_SignerInfo *si)
{
EVP_MD_CTX *mctx = NULL;
unsigned char *abuf = NULL;
int alen, r = -1;
const EVP_MD *md = NULL;
const EVP_MD *md;
unsigned char *buf = NULL;
int buf_len = 0;
int ret = -1;
if (!si->pkey) {
if ((md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm)) == NULL)
goto err;
if (si->pkey == NULL) {
CMSerror(CMS_R_NO_PUBLIC_KEY);
return -1;
goto err;
}
md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm);
if (md == NULL)
return -1;
if (si->mctx == NULL && (si->mctx = EVP_MD_CTX_new()) == NULL) {
if (si->mctx == NULL)
si->mctx = EVP_MD_CTX_new();
if (si->mctx == NULL) {
CMSerror(ERR_R_MALLOC_FAILURE);
return -1;
goto err;
}
mctx = si->mctx;
if (EVP_DigestVerifyInit(mctx, &si->pctx, md, NULL, si->pkey) <= 0)
if (EVP_DigestVerifyInit(si->mctx, &si->pctx, md, NULL, si->pkey) <= 0)
goto err;
if (!cms_sd_asn1_ctrl(si, 1))
goto err;
alen = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &abuf,
&CMS_Attributes_Verify_it);
if (!abuf)
goto err;
r = EVP_DigestVerifyUpdate(mctx, abuf, alen);
free(abuf);
if (r <= 0) {
r = -1;
if ((buf_len = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &buf,
&CMS_Attributes_Verify_it)) <= 0) {
buf_len = 0;
goto err;
}
r = EVP_DigestVerifyFinal(mctx, si->signature->data,
si->signature->length);
if (r <= 0)
ret = EVP_DigestVerify(si->mctx, si->signature->data, si->signature->length,
buf, buf_len);
if (ret <= 0) {
CMSerror(CMS_R_VERIFICATION_FAILURE);
goto err;
}
err:
EVP_MD_CTX_reset(mctx);
if (si->mctx != NULL)
EVP_MD_CTX_reset(si->mctx);
freezero(buf, buf_len);
return r;
return ret;
}
LCRYPTO_ALIAS(CMS_SignerInfo_verify);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: evp_enc.c,v 1.52 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: evp_enc.c,v 1.53 2023/09/10 16:53:56 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -78,8 +78,8 @@ int
EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc)
{
if (cipher)
EVP_CIPHER_CTX_init(ctx);
if (cipher != NULL)
EVP_CIPHER_CTX_cleanup(ctx);
return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: p_lib.c,v 1.36 2023/09/02 04:15:39 tb Exp $ */
/* $OpenBSD: p_lib.c,v 1.37 2023/09/10 17:32:17 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -449,13 +449,14 @@ EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
RSA *
EVP_PKEY_get1_RSA(EVP_PKEY *pkey)
{
if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS) {
RSA_up_ref(pkey->pkey.rsa);
return pkey->pkey.rsa;
}
RSA *rsa;
EVPerror(EVP_R_EXPECTING_AN_RSA_KEY);
if ((rsa = EVP_PKEY_get0_RSA(pkey)) == NULL)
return NULL;
RSA_up_ref(rsa);
return rsa;
}
int
@ -482,12 +483,14 @@ EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
DSA *
EVP_PKEY_get1_DSA(EVP_PKEY *pkey)
{
if (pkey->type != EVP_PKEY_DSA) {
EVPerror(EVP_R_EXPECTING_A_DSA_KEY);
DSA *dsa;
if ((dsa = EVP_PKEY_get0_DSA(pkey)) == NULL)
return NULL;
}
DSA_up_ref(pkey->pkey.dsa);
return pkey->pkey.dsa;
DSA_up_ref(dsa);
return dsa;
}
int
@ -514,12 +517,14 @@ EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)
EC_KEY *
EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)
{
if (pkey->type != EVP_PKEY_EC) {
EVPerror(EVP_R_EXPECTING_A_EC_KEY);
EC_KEY *key;
if ((key = EVP_PKEY_get0_EC_KEY(pkey)) == NULL)
return NULL;
}
EC_KEY_up_ref(pkey->pkey.ec);
return pkey->pkey.ec;
EC_KEY_up_ref(key);
return key;
}
int
@ -547,12 +552,14 @@ EVP_PKEY_get0_DH(EVP_PKEY *pkey)
DH *
EVP_PKEY_get1_DH(EVP_PKEY *pkey)
{
if (pkey->type != EVP_PKEY_DH) {
EVPerror(EVP_R_EXPECTING_A_DH_KEY);
DH *dh;
if ((dh = EVP_PKEY_get0_DH(pkey)) == NULL)
return NULL;
}
DH_up_ref(pkey->pkey.dh);
return pkey->pkey.dh;
DH_up_ref(dh);
return dh;
}
int

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: BIO_f_base64.3,v 1.14 2023/09/10 11:20:52 schwarze Exp $
.\" $OpenBSD: BIO_f_base64.3,v 1.15 2023/09/11 04:00:40 jsg Exp $
.\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400
.\"
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@ -49,14 +49,14 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 10 2023 $
.Dd $Mdocdate: September 11 2023 $
.Dt BIO_F_BASE64 3
.Os
.Sh NAME
.Nm BIO_f_base64
.\" .Nm EVP_ENCODE_LENGTH and
.\" .Nm EVP_DECODE_LENGTH are intentionally undocumented
.\" because they are internal implemention details of BIO_f_base64(3)
.\" because they are internal implementation details of BIO_f_base64(3)
.\" and practically unused outside evp/bio_b64.c.
.Nd base64 BIO filter
.Sh SYNOPSIS

View File

@ -1,4 +1,4 @@
/* $OpenBSD: x509_addr.c,v 1.88 2023/09/06 15:53:07 job Exp $ */
/* $OpenBSD: x509_addr.c,v 1.89 2023/09/11 00:50:47 job Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
@ -676,10 +676,9 @@ i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method, void *ext, BIO *out,
{
const IPAddrBlocks *addr = ext;
IPAddressFamily *af;
uint16_t afi = 0;
uint8_t safi = 0;
int safi_is_set = 0;
int i;
uint16_t afi;
uint8_t safi;
int i, safi_is_set;
for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
af = sk_IPAddressFamily_value(addr, i);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: resolver.c,v 1.160 2023/04/18 09:57:51 florian Exp $ */
/* $OpenBSD: resolver.c,v 1.161 2023/09/11 06:00:23 florian Exp $ */
/*
@ -920,6 +920,8 @@ resolve_done(struct uw_resolver *res, void *arg, int rcode,
uint8_t *p, *data;
uint8_t answer_imsg[MAX_IMSGSIZE - IMSG_HEADER_SIZE];
log_debug("%s: %d", __func__, rcode);
clock_gettime(CLOCK_MONOTONIC, &tp);
query_imsg = (struct query_imsg *)arg;
@ -1074,14 +1076,17 @@ resolve_done(struct uw_resolver *res, void *arg, int rcode,
goto out;
servfail:
log_debug("%s: foo: 1", __func__);
/* try_next_resolver() might free rq */
if (try_next_resolver(rq) != 0 && running_res == 0) {
/* we are the last one, send SERVFAIL */
answer_header->srvfail = 1;
log_debug("%s: foo: 2", __func__);
resolver_imsg_compose_frontend(IMSG_ANSWER, 0,
answer_imsg, sizeof(*answer_header));
}
out:
log_debug("%s: foo: 3", __func__);
free(query_imsg);
sldns_buffer_free(buf);
regional_destroy(region);

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: aplns.4,v 1.1 2021/05/28 04:49:44 dlg Exp $
.\" $OpenBSD: aplns.4,v 1.2 2023/09/11 04:21:30 jsg Exp $
.\"
.\" Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
.\"
@ -14,19 +14,19 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 28 2021 $
.Dd $Mdocdate: September 11 2023 $
.Dt APLNS 4 arm64
.Os
.Sh NAME
.Nm aplns
.Nd Apple NVME Storage controller
.Nd Apple NVMe Storage controller
.Sh SYNOPSIS
.Cd "aplns* at fdt?"
.Cd "nvme* at aplns?"
.Sh DESCRIPTION
The
.Nm
driver provides support for the NVME Storage controller found on
driver provides support for the NVMe Storage controller found on
various Apple SoCs.
.Sh SEE ALSO
.Xr intro 4 ,

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ie.4,v 1.16 2008/09/07 06:55:35 jmc Exp $
.\" $OpenBSD: ie.4,v 1.17 2023/09/11 04:56:31 jsg Exp $
.\"
.\" Copyright (c) 1994 James A. Jegers
.\" All rights reserved.
@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 7 2008 $
.Dd $Mdocdate: September 11 2023 $
.Dt IE 4 i386
.Os
.Sh NAME
@ -41,7 +41,7 @@ This includes the following network adapters:
.It 3Com 3C507
.It AT&T StarLAN 10
.It AT&T EN100
.It AT&T StarLan Fiber
.It AT&T StarLAN Fiber
.It Intel EtherExpress 16
.El
.Pp

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: neo.4,v 1.13 2007/05/31 19:19:51 jmc Exp $
.\" $OpenBSD: neo.4,v 1.14 2023/09/11 05:07:34 jsg Exp $
.\"
.\" Copyright (c) 1998 Constantine Paul Sapuntzakis
.\" All rights reserved
@ -29,7 +29,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 31 2007 $
.Dd $Mdocdate: September 11 2023 $
.Dt NEO 4
.Os
.Sh NAME
@ -61,7 +61,7 @@ The
device driver appeared in
.Ox 2.7 .
.Sh BUGS
This driver has some bugs because Neomagic refuses to provide documentation,
This driver has some bugs because NeoMagic refuses to provide documentation,
even though they are discontinuing their products.
At the time of contact, all persons working at the company were hiding
behind their receptionist as if in a stage of siege.

View File

@ -36,7 +36,7 @@ umask 007
if [ ! -r version -o ! -s version ]
then
echo 1337 > version
echo 0 > version
fi
touch version

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_eisa.c,v 1.28 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ep_eisa.c,v 1.29 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ep_eisa.c,v 1.13 1997/04/18 00:50:33 cgd Exp $ */
/*
@ -41,7 +41,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rkdrm.c,v 1.16 2023/09/10 06:25:09 jsg Exp $ */
/* $OpenBSD: rkdrm.c,v 1.17 2023/09/11 04:51:24 jsg Exp $ */
/* $NetBSD: rk_drm.c,v 1.3 2019/12/15 01:00:58 mrg Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -47,9 +47,6 @@
#define RK_DRM_MAX_WIDTH 3840
#define RK_DRM_MAX_HEIGHT 2160
TAILQ_HEAD(, rkdrm_ports) rkdrm_ports =
TAILQ_HEAD_INITIALIZER(rkdrm_ports);
int rkdrm_match(struct device *, void *, void *);
void rkdrm_attach(struct device *, struct device *, void *);
void rkdrm_attachhook(struct device *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rkdrm.h,v 1.3 2023/01/01 01:34:33 jsg Exp $ */
/* $OpenBSD: rkdrm.h,v 1.4 2023/09/11 04:51:24 jsg Exp $ */
/* $NetBSD: rk_drm.h,v 1.1 2019/11/09 23:30:14 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -86,12 +86,6 @@ struct rkdrm_framebuffer {
struct drm_gem_dma_object *obj;
};
struct rkdrm_ports {
int phandle;
struct drm_device *ddev;
TAILQ_ENTRY(rkdrm_ports) entries;
};
struct rkdrm_fbdev {
struct drm_fb_helper helper;
};

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aac.c,v 1.95 2023/07/13 07:31:12 jsg Exp $ */
/* $OpenBSD: aac.c,v 1.96 2023/09/11 12:10:47 mvs Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@ -53,7 +53,6 @@
#include <sys/kthread.h>
#include <sys/malloc.h>
#include <sys/rwlock.h>
#include <sys/selinfo.h>
#include <sys/time.h>
#include <machine/bus.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aacvar.h,v 1.17 2023/07/13 07:31:12 jsg Exp $ */
/* $OpenBSD: aacvar.h,v 1.18 2023/09/11 08:40:25 mvs Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@ -395,7 +395,6 @@ struct aac_softc
struct aac_aif_command aac_aifq[AAC_AIFQ_LENGTH];
int aac_aifq_head;
int aac_aifq_tail;
struct selinfo aac_select;
struct proc *aifthread;
int aifflags;
#define AAC_AIFFLAGS_RUNNING (1 << 0)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: com.c,v 1.177 2023/05/23 16:39:29 denis Exp $ */
/* $OpenBSD: com.c,v 1.178 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@ -65,7 +65,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/selinfo.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/fcntl.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cy.c,v 1.41 2021/09/01 16:10:39 jan Exp $ */
/* $OpenBSD: cy.c,v 1.42 2023/09/11 08:41:26 mvs Exp $ */
/*
* Copyright (c) 1996 Timo Rossi.
* All rights reserved.
@ -56,7 +56,6 @@
#include <sys/fcntl.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/systm.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: elink3.c,v 1.99 2023/04/11 00:45:08 jsg Exp $ */
/* $OpenBSD: elink3.c,v 1.100 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */
/*
@ -41,7 +41,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ef_isapnp.c,v 1.41 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ef_isapnp.c,v 1.42 2023/09/11 08:41:26 mvs Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@ -35,7 +35,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <sys/queue.h>
#include <sys/kernel.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_eg.c,v 1.51 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_eg.c,v 1.52 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */
/*
@ -47,7 +47,6 @@
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <net/if.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_isa.c,v 1.32 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ep_isa.c,v 1.33 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ep_isa.c,v 1.5 1996/05/12 23:52:36 mycroft Exp $ */
/*
@ -45,7 +45,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>
#include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_isapnp.c,v 1.17 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ep_isapnp.c,v 1.18 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ep_isapnp.c,v 1.5 1996/05/12 23:52:36 mycroft Exp $ */
/*
@ -45,7 +45,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <sys/timeout.h>
#include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_lc_isa.c,v 1.14 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_lc_isa.c,v 1.15 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_lc_isa.c,v 1.10 2001/06/13 10:46:03 wiz Exp $ */
/*-
@ -42,7 +42,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ne_isa.c,v 1.18 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ne_isa.c,v 1.19 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ne_isa.c,v 1.6 1998/07/05 06:49:13 jonathan Exp $ */
/*-
@ -40,7 +40,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <net/if.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ne_isapnp.c,v 1.17 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_ne_isapnp.c,v 1.18 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ne_isapnp.c,v 1.7 1998/07/23 19:30:45 christos Exp $ */
/*-
@ -40,7 +40,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <net/if.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_sm_isa.c,v 1.16 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_sm_isa.c,v 1.17 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_sm_isa.c,v 1.4 1998/07/05 06:49:14 jonathan Exp $ */
/*-
@ -40,7 +40,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aac_pci.c,v 1.27 2023/07/13 07:31:12 jsg Exp $ */
/* $OpenBSD: aac_pci.c,v 1.28 2023/09/11 08:40:25 mvs Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@ -44,7 +44,6 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/queue.h>
#include <sys/selinfo.h>
#include <sys/rwlock.h>
#include <sys/endian.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auixp.c,v 1.51 2022/10/26 20:19:08 kn Exp $ */
/* $OpenBSD: auixp.c,v 1.52 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
/*
@ -50,7 +50,6 @@
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/selinfo.h>
#include <sys/audioio.h>
#include <sys/queue.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: com_pci.c,v 1.2 2022/04/06 18:59:29 naddy Exp $ */
/* $OpenBSD: com_pci.c,v 1.3 2023/09/11 08:41:26 mvs Exp $ */
/*
* Copyright (c) 2020 Patrick Wildt <patrick@blueri.se>
*
@ -18,7 +18,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/selinfo.h>
#include <sys/tty.h>
#include <dev/pci/pcidevs.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: esa.c,v 1.41 2022/10/26 20:19:08 kn Exp $ */
/* $OpenBSD: esa.c,v 1.42 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */
/*
@ -50,7 +50,6 @@
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/selinfo.h>
#include <sys/audioio.h>
#include <machine/bus.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_pci.c,v 1.36 2022/03/11 18:00:45 mpi Exp $ */
/* $OpenBSD: if_ep_pci.c,v 1.37 2023/09/11 08:41:26 mvs Exp $ */
/* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */
/*
@ -41,7 +41,6 @@
#include <sys/errno.h>
#include <sys/timeout.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <net/if.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aic_pcmcia.c,v 1.19 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: aic_pcmcia.c,v 1.20 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: aic_pcmcia.c,v 1.6 1998/07/19 17:28:15 christos Exp $ */
/*
@ -32,7 +32,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <machine/cpu.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: com_pcmcia.c,v 1.59 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: com_pcmcia.c,v 1.60 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: com_pcmcia.c,v 1.15 1998/08/22 17:47:58 msaitoh Exp $ */
/*
@ -91,7 +91,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/selinfo.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/uio.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_pcmcia.c,v 1.50 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: if_ep_pcmcia.c,v 1.51 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: if_ep_pcmcia.c,v 1.16 1998/08/17 23:20:40 thorpej Exp $ */
/*-
@ -69,7 +69,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_ne_pcmcia.c,v 1.101 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: if_ne_pcmcia.c,v 1.102 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */
/*
@ -32,7 +32,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/selinfo.h>
#include <sys/device.h>
#include <sys/socket.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_sm_pcmcia.c,v 1.39 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: if_sm_pcmcia.c,v 1.40 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: if_sm_pcmcia.c,v 1.11 1998/08/15 20:47:32 thorpej Exp $ */
/*-
@ -40,7 +40,6 @@
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/timeout.h>
#include <sys/device.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: com_puc.c,v 1.27 2022/04/06 18:59:30 naddy Exp $ */
/* $OpenBSD: com_puc.c,v 1.28 2023/09/11 08:41:27 mvs Exp $ */
/*
* Copyright (c) 1997 - 1999, Jason Downs. All rights reserved.
@ -31,7 +31,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/selinfo.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/uio.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: usb_subr.c,v 1.158 2022/02/16 06:23:42 anton Exp $ */
/* $OpenBSD: usb_subr.c,v 1.159 2023/09/11 08:41:27 mvs Exp $ */
/* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
@ -37,7 +37,6 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/selinfo.h>
#include <sys/rwlock.h>
#include <machine/bus.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.258 2023/09/08 05:56:13 djm Exp $ */
/* $OpenBSD: scp.c,v 1.259 2023/09/10 23:12:32 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@ -158,7 +158,7 @@ size_t sftp_nrequests;
/* Needed for sftp */
volatile sig_atomic_t interrupted = 0;
int remote_glob(struct sftp_conn *, const char *, int,
int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */
static void
@ -1507,7 +1507,7 @@ sink_sftp(int argc, char *dst, const char *src, struct sftp_conn *conn)
}
debug3_f("copying remote %s to local %s", abs_src, dst);
if ((r = remote_glob(conn, abs_src, GLOB_NOCHECK|GLOB_MARK,
if ((r = sftp_glob(conn, abs_src, GLOB_NOCHECK|GLOB_MARK,
NULL, &g)) != 0) {
if (r == GLOB_NOSPACE)
error("%s: too many glob matches", src);
@ -1932,7 +1932,7 @@ throughlocal_sftp(struct sftp_conn *from, struct sftp_conn *to,
}
debug3_f("copying remote %s to remote %s", abs_src, target);
if ((r = remote_glob(from, abs_src, GLOB_NOCHECK|GLOB_MARK,
if ((r = sftp_glob(from, abs_src, GLOB_NOCHECK|GLOB_MARK,
NULL, &g)) != 0) {
if (r == GLOB_NOSPACE)
error("%s: too many glob matches", src);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-glob.c,v 1.32 2023/09/08 05:56:13 djm Exp $ */
/* $OpenBSD: sftp-glob.c,v 1.33 2023/09/10 23:12:32 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@ -29,7 +29,7 @@
#include "sftp-common.h"
#include "sftp-client.h"
int remote_glob(struct sftp_conn *, const char *, int,
int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *);
struct SFTP_OPENDIR {
@ -107,7 +107,7 @@ fudge_stat(const char *path, struct stat *st)
}
int
remote_glob(struct sftp_conn *conn, const char *pattern, int flags,
sftp_glob(struct sftp_conn *conn, const char *pattern, int flags,
int (*errfunc)(const char *, int), glob_t *pglob)
{
int r;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp.c,v 1.235 2023/09/08 05:56:13 djm Exp $ */
/* $OpenBSD: sftp.c,v 1.236 2023/09/10 23:12:32 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@ -91,7 +91,7 @@ struct complete_ctx {
char **remote_pathp;
};
int remote_glob(struct sftp_conn *, const char *, int,
int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */
/* Separators for interactive commands */
@ -634,7 +634,7 @@ process_get(struct sftp_conn *conn, const char *src, const char *dst,
memset(&g, 0, sizeof(g));
debug3("Looking up %s", abs_src);
if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) {
if ((r = sftp_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) {
if (r == GLOB_NOSPACE) {
error("Too many matches for \"%s\".", abs_src);
} else {
@ -950,7 +950,7 @@ do_globbed_ls(struct sftp_conn *conn, const char *path,
memset(&g, 0, sizeof(g));
if ((r = remote_glob(conn, path,
if ((r = sftp_glob(conn, path,
GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT,
NULL, &g)) != 0 ||
(g.gl_pathc && !g.gl_matchc)) {
@ -1591,7 +1591,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
break;
case I_RM:
path1 = make_absolute_pwd_glob(path1, *pwd);
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if (!quiet)
mprintf("Removing %s\n", g.gl_pathv[i]);
@ -1695,7 +1695,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
attrib_clear(&a);
a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
a.perm = n_arg;
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if (!quiet)
mprintf("Changing mode on %s\n",
@ -1709,7 +1709,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
case I_CHOWN:
case I_CHGRP:
path1 = make_absolute_pwd_glob(path1, *pwd);
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if ((hflag ? sftp_lstat : sftp_stat)(conn,
g.gl_pathv[i], 0, &aa) != 0) {
@ -1989,7 +1989,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
memset(&g, 0, sizeof(g));
if (remote != LOCAL) {
tmp = make_absolute_pwd_glob(tmp, remote_path);
remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
sftp_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
} else
(void)glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: l2tp_subr.c,v 1.4 2012/05/08 13:15:11 yasuoka Exp $ */
/* $OpenBSD: l2tp_subr.c,v 1.5 2023/09/11 07:33:07 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: l2tp_subr.c,v 1.4 2012/05/08 13:15:11 yasuoka Exp $ */
/* $Id: l2tp_subr.c,v 1.5 2023/09/11 07:33:07 yasuoka Exp $ */
/**@file L2TP related sub-routines */
#include <sys/types.h>
#include <sys/time.h>
@ -80,10 +80,10 @@ avp_enum(struct l2tp_avp *avp, const u_char *pkt, int pktlen, int filldata)
avp->attr_type |= *(pkt + 1);
pkt += 2;
if (avp->length > pktlen)
if (avp->length < 6 || avp->length > pktlen)
return -1;
if (filldata != 0)
if (avp->length > 6 && filldata != 0)
memcpy(avp->attr_value, pkt, avp->length - 6);
return avp->length;
@ -285,9 +285,8 @@ avp_find(struct l2tp_avp *avp, const u_char *pkt, int pktlen,
while (pktlen >= 6 &&
(avpsz = avp_enum(avp, pkt, pktlen, fill_data)) > 0) {
L2TP_SUBR_ASSERT(avpsz >= 6);
if (avp->vendor_id != vendor_id || avp->attr_type != attr_type) {
if (avpsz < 6)
return NULL;
pkt += avpsz;
pktlen -= avpsz;
continue;

View File

@ -1,3 +1,8 @@
8 September 2023: Wouter
- Fix send of udp retries when ENOBUFS is returned. It stops looping
and also waits for the condition to go away. Reported by Florian
Obser.
25 August 2023: Wouter
- Fix compile error on NetBSD in util/netevent.h.

View File

@ -116,6 +116,8 @@
/** timeout in millisec to wait for write to unblock, packets dropped after.*/
#define SEND_BLOCKED_WAIT_TIMEOUT 200
/** max number of times to wait for write to unblock, packets dropped after.*/
#define SEND_BLOCKED_MAX_RETRY 5
/** Let's make timestamping code cleaner and redefine SO_TIMESTAMP* */
#ifndef SO_TIMESTAMP
@ -402,9 +404,10 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
WSAGetLastError() == WSAENOBUFS ||
WSAGetLastError() == WSAEWOULDBLOCK) {
#endif
int retries = 0;
/* if we set the fd blocking, other threads suddenly
* have a blocking fd that they operate on */
while(sent == -1 && (
while(sent == -1 && retries < SEND_BLOCKED_MAX_RETRY && (
#ifndef USE_WINSOCK
errno == EAGAIN || errno == EINTR ||
# ifdef EWOULDBLOCK
@ -419,6 +422,13 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
#endif
)) {
#if defined(HAVE_POLL) || defined(USE_WINSOCK)
int send_nobufs = (
#ifndef USE_WINSOCK
errno == ENOBUFS
#else
WSAGetLastError() == WSAENOBUFS
#endif
);
struct pollfd p;
int pret;
memset(&p, 0, sizeof(p));
@ -457,8 +467,48 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
log_err("poll udp out failed: %s",
sock_strerror(errno));
return 0;
} else if((pret < 0 &&
#ifndef USE_WINSOCK
errno == ENOBUFS
#else
WSAGetLastError() == WSAENOBUFS
#endif
) || (send_nobufs && retries > 0)) {
/* ENOBUFS, and poll returned without
* a timeout. Or the retried send call
* returned ENOBUFS. It is good to
* wait a bit for the error to clear. */
/* The timeout is 20*(2^(retries+1)),
* it increases exponentially, starting
* at 40 msec. After 5 tries, 1240 msec
* have passed in total, when poll
* returned the error, and 1200 msec
* when send returned the errors. */
#ifndef USE_WINSOCK
pret = poll(NULL, 0, (SEND_BLOCKED_WAIT_TIMEOUT/10)<<(retries+1));
#else
pret = WSAPoll(NULL, 0, (SEND_BLOCKED_WAIT_TIMEOUT/10)<<(retries+1));
#endif
if(pret < 0 &&
#ifndef USE_WINSOCK
errno != EAGAIN && errno != EINTR &&
# ifdef EWOULDBLOCK
errno != EWOULDBLOCK &&
# endif
errno != ENOBUFS
#else
WSAGetLastError() != WSAEINPROGRESS &&
WSAGetLastError() != WSAEINTR &&
WSAGetLastError() != WSAENOBUFS &&
WSAGetLastError() != WSAEWOULDBLOCK
#endif
) {
log_err("poll udp out timer failed: %s",
sock_strerror(errno));
}
}
#endif /* defined(HAVE_POLL) || defined(USE_WINSOCK) */
retries++;
if (!is_connected) {
sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
sldns_buffer_remaining(packet), 0,
@ -665,7 +715,8 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
WSAGetLastError() == WSAENOBUFS ||
WSAGetLastError() == WSAEWOULDBLOCK) {
#endif
while(sent == -1 && (
int retries = 0;
while(sent == -1 && retries < SEND_BLOCKED_MAX_RETRY && (
#ifndef USE_WINSOCK
errno == EAGAIN || errno == EINTR ||
# ifdef EWOULDBLOCK
@ -680,6 +731,13 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
#endif
)) {
#if defined(HAVE_POLL) || defined(USE_WINSOCK)
int send_nobufs = (
#ifndef USE_WINSOCK
errno == ENOBUFS
#else
WSAGetLastError() == WSAENOBUFS
#endif
);
struct pollfd p;
int pret;
memset(&p, 0, sizeof(p));
@ -718,8 +776,48 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
log_err("poll udp out failed: %s",
sock_strerror(errno));
return 0;
} else if((pret < 0 &&
#ifndef USE_WINSOCK
errno == ENOBUFS
#else
WSAGetLastError() == WSAENOBUFS
#endif
) || (send_nobufs && retries > 0)) {
/* ENOBUFS, and poll returned without
* a timeout. Or the retried send call
* returned ENOBUFS. It is good to
* wait a bit for the error to clear. */
/* The timeout is 20*(2^(retries+1)),
* it increases exponentially, starting
* at 40 msec. After 5 tries, 1240 msec
* have passed in total, when poll
* returned the error, and 1200 msec
* when send returned the errors. */
#ifndef USE_WINSOCK
pret = poll(NULL, 0, (SEND_BLOCKED_WAIT_TIMEOUT/10)<<(retries+1));
#else
pret = WSAPoll(NULL, 0, (SEND_BLOCKED_WAIT_TIMEOUT/10)<<(retries+1));
#endif
if(pret < 0 &&
#ifndef USE_WINSOCK
errno != EAGAIN && errno != EINTR &&
# ifdef EWOULDBLOCK
errno != EWOULDBLOCK &&
# endif
errno != ENOBUFS
#else
WSAGetLastError() != WSAEINPROGRESS &&
WSAGetLastError() != WSAEINTR &&
WSAGetLastError() != WSAENOBUFS &&
WSAGetLastError() != WSAEWOULDBLOCK
#endif
) {
log_err("poll udp out timer failed: %s",
sock_strerror(errno));
}
}
#endif /* defined(HAVE_POLL) || defined(USE_WINSOCK) */
retries++;
sent = sendmsg(c->fd, &msg, 0);
}
}