sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-20 03:21:37 +00:00
parent fdad81bcfc
commit ed28f347da
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
53 changed files with 1138 additions and 405 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in_pcb.c,v 1.285 2024/01/18 11:03:16 claudio Exp $ */
/* $OpenBSD: in_pcb.c,v 1.286 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@ -517,7 +517,7 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6))
return (in6_pcbconnect(inp, nam));
#endif /* INET6 */
#endif
if ((error = in_nam2sin(nam, &sin)))
return (error);
@ -652,6 +652,13 @@ in_setsockaddr(struct inpcb *inp, struct mbuf *nam)
{
struct sockaddr_in *sin;
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6)) {
in6_setsockaddr(inp, nam);
return;
}
#endif
nam->m_len = sizeof(*sin);
sin = mtod(nam, struct sockaddr_in *);
memset(sin, 0, sizeof(*sin));
@ -671,7 +678,7 @@ in_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
in6_setpeeraddr(inp, nam);
return;
}
#endif /* INET6 */
#endif
nam->m_len = sizeof(*sin);
sin = mtod(nam, struct sockaddr_in *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_usrreq.c,v 1.228 2024/01/11 13:49:49 bluhm Exp $ */
/* $OpenBSD: tcp_usrreq.c,v 1.229 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@ -502,7 +502,7 @@ tcp_detach(struct socket *so)
{
struct inpcb *inp;
struct tcpcb *otp = NULL, *tp;
int error = 0;
int error;
short ostate;
soassertlocked(so);
@ -526,7 +526,7 @@ tcp_detach(struct socket *so)
if (otp)
tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_DETACH, 0);
return (error);
return (0);
}
/*
@ -685,26 +685,17 @@ tcp_accept(struct socket *so, struct mbuf *nam)
struct inpcb *inp;
struct tcpcb *tp;
int error;
short ostate;
soassertlocked(so);
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
if (so->so_options & SO_DEBUG)
ostate = tp->t_state;
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setpeeraddr(inp, nam);
else
#endif
in_setpeeraddr(inp, nam);
in_setpeeraddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_ACCEPT, 0);
return (error);
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_ACCEPT, 0);
return (0);
}
/*
@ -994,12 +985,7 @@ tcp_sockaddr(struct socket *so, struct mbuf *nam)
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setsockaddr(inp, nam);
else
#endif
in_setsockaddr(inp, nam);
in_setsockaddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL,
@ -1019,16 +1005,10 @@ tcp_peeraddr(struct socket *so, struct mbuf *nam)
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setpeeraddr(inp, nam);
else
#endif
in_setpeeraddr(inp, nam);
in_setpeeraddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL,
PRU_PEERADDR, 0);
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_PEERADDR, 0);
return (0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: udp_usrreq.c,v 1.313 2024/01/10 16:44:30 bluhm Exp $ */
/* $OpenBSD: udp_usrreq.c,v 1.314 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@ -936,9 +936,9 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
struct in_addr laddr;
int error = 0;
#ifdef DIAGNOSTIC
if ((inp->inp_flags & INP_IPV6) != 0)
panic("IPv6 inpcb to %s", __func__);
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6))
return (udp6_output(inp, m, addr, control));
#endif
/*
@ -1230,7 +1230,6 @@ udp_send(struct socket *so, struct mbuf *m, struct mbuf *addr,
struct mbuf *control)
{
struct inpcb *inp = sotoinpcb(so);
int error;
soassertlocked(so);
@ -1265,14 +1264,7 @@ udp_send(struct socket *so, struct mbuf *m, struct mbuf *addr,
}
#endif
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
error = udp6_output(inp, m, addr, control);
else
#endif
error = udp_output(inp, m, addr, control);
return (error);
return (udp_output(inp, m, addr, control));
}
/*