sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-11 23:14:53 +00:00
parent 1216bb5537
commit 3a25e8ae30
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
93 changed files with 17023 additions and 13073 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in6_pcb.c,v 1.136 2024/02/09 14:02:12 bluhm Exp $ */
/* $OpenBSD: in6_pcb.c,v 1.137 2024/02/11 01:27:45 bluhm Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -116,6 +116,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet6/ip6_var.h>
#include <netinet/in_pcb.h>
#include <netinet6/in6_var.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_divert.c,v 1.92 2024/02/03 22:50:09 mvs Exp $ */
/* $OpenBSD: ip6_divert.c,v 1.94 2024/02/11 18:14:27 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@ -35,6 +35,7 @@
#include <netinet/in_pcb.h>
#include <netinet/ip_divert.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_divert.h>
#include <netinet/tcp.h>
@ -248,14 +249,14 @@ divert6_packet(struct mbuf *m, int dir, u_int16_t divert_port)
in6_proto_cksum_out(m, NULL);
}
mtx_enter(&inp->inp_mtx);
so = inp->inp_socket;
mtx_enter(&so->so_rcv.sb_mtx);
if (sbappendaddr(so, &so->so_rcv, sin6tosa(&sin6), m, NULL) == 0) {
mtx_leave(&inp->inp_mtx);
mtx_leave(&so->so_rcv.sb_mtx);
div6stat_inc(div6s_fullsock);
goto bad;
}
mtx_leave(&inp->inp_mtx);
mtx_leave(&so->so_rcv.sb_mtx);
sorwakeup(so);
in_pcbunref(inp);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_mroute.c,v 1.139 2024/02/03 22:50:09 mvs Exp $ */
/* $OpenBSD: ip6_mroute.c,v 1.140 2024/02/11 18:14:27 mvs Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
@ -856,17 +856,16 @@ int
socket6_send(struct socket *so, struct mbuf *mm, struct sockaddr_in6 *src)
{
if (so != NULL) {
struct inpcb *inp = sotoinpcb(so);
int ret;
mtx_enter(&inp->inp_mtx);
mtx_enter(&so->so_rcv.sb_mtx);
ret = sbappendaddr(so, &so->so_rcv, sin6tosa(src), mm, NULL);
if (ret != 0)
sorwakeup(so);
mtx_leave(&inp->inp_mtx);
mtx_leave(&so->so_rcv.sb_mtx);
if (ret != 0)
if (ret != 0) {
sorwakeup(so);
return 0;
}
}
m_freem(mm);
return -1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: raw_ip6.c,v 1.180 2024/02/03 22:50:09 mvs Exp $ */
/* $OpenBSD: raw_ip6.c,v 1.181 2024/02/11 18:14:27 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@ -263,6 +263,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
else
n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (n != NULL) {
struct socket *so = inp->inp_socket;
int ret;
if (inp->inp_flags & IN6P_CONTROLOPTS)
@ -270,11 +271,10 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
/* strip intermediate headers */
m_adj(n, *offp);
mtx_enter(&inp->inp_mtx);
ret = sbappendaddr(inp->inp_socket,
&inp->inp_socket->so_rcv,
mtx_enter(&so->so_rcv.sb_mtx);
ret = sbappendaddr(so, &so->so_rcv,
sin6tosa(&rip6src), n, opts);
mtx_leave(&inp->inp_mtx);
mtx_leave(&so->so_rcv.sb_mtx);
if (ret == 0) {
/* should notify about lost packet */
@ -282,7 +282,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af)
m_freem(opts);
rip6stat_inc(rip6s_fullsock);
} else
sorwakeup(inp->inp_socket);
sorwakeup(so);
}
in_pcbunref(inp);
}