aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_jail.c1
-rw-r--r--sys/kern/uipc_socket.c11
-rw-r--r--sys/kern/uipc_syscalls.c4
3 files changed, 13 insertions, 3 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index b5c8f6ebf9be..30499dce729c 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -3433,6 +3433,7 @@ prison_priv_check(struct ucred *cred, int priv)
case PRIV_NET_GIF:
case PRIV_NET_SETIFVNET:
case PRIV_NET_SETIFFIB:
+ case PRIV_NET_WG:
/*
* 802.11-related privileges.
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 7f06b51cf096..eb748928cd91 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -851,6 +851,17 @@ sopeeloff(struct socket *head)
#endif /* SCTP */
int
+sogetsockaddr(struct socket *so, struct sockaddr **nam)
+{
+ int error;
+
+ CURVNET_SET(so->so_vnet);
+ error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, nam);
+ CURVNET_RESTORE();
+ return (error);
+}
+
+int
sobind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
int error;
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 23fae343924a..b9c2630561cb 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1386,9 +1386,7 @@ kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
return (error);
so = fp->f_data;
*sa = NULL;
- CURVNET_SET(so->so_vnet);
- error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, sa);
- CURVNET_RESTORE();
+ error = sogetsockaddr(so, sa);
if (error != 0)
goto bad;
if (*sa == NULL)