summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_divert.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-10-03 16:43:53 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-10-03 16:43:53 +0000
commit664e716c25187e8df24c685ad24616ba16bf6205 (patch)
tree56665a3f1021af1784fe972cd6365ad9b07d458e /sys/netinet/ip_divert.c
parent9ada79011110198e0b48f901fda0f53caae40a5b (diff)
System calls should not fail due to temporary memory shortage in
malloc(9) or pool_get(9). Pass down a wait flag to pru_attach(). During syscall socket(2) it is ok to wait, this logic was missing for internet pcb. Pfkey and route sockets were already waiting. sonewconn() must not wait when called during TCP 3-way handshake. This logic has been preserved. Unix domain stream socket connect(2) can wait until the other side has created the socket to accept. OK mvs@
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r--sys/netinet/ip_divert.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 1cdad66c298..9d4867776cf 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.87 2022/09/05 14:56:09 bluhm Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.88 2022/10/03 16:43:52 bluhm Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -255,7 +255,7 @@ divert_packet(struct mbuf *m, int dir, u_int16_t divert_port)
}
int
-divert_attach(struct socket *so, int proto)
+divert_attach(struct socket *so, int proto, int wait)
{
int error;
@@ -264,7 +264,7 @@ divert_attach(struct socket *so, int proto)
if ((so->so_state & SS_PRIV) == 0)
return EACCES;
- error = in_pcballoc(so, &divbtable);
+ error = in_pcballoc(so, &divbtable, wait);
if (error)
return error;