sync with OpenBSD -current
This commit is contained in:
parent
8365991714
commit
20629a8b0d
27 changed files with 3030 additions and 694 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_input.c,v 1.398 2024/01/11 13:49:49 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_input.c,v 1.399 2024/01/27 21:13:46 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -201,8 +201,8 @@ int syn_cache_add(struct sockaddr *, struct sockaddr *, struct tcphdr *,
|
|||
struct socket *syn_cache_get(struct sockaddr *, struct sockaddr *,
|
||||
struct tcphdr *, unsigned int, unsigned int, struct socket *,
|
||||
struct mbuf *, uint64_t);
|
||||
struct syn_cache *syn_cache_lookup(struct sockaddr *, struct sockaddr *,
|
||||
struct syn_cache_head **, u_int);
|
||||
struct syn_cache *syn_cache_lookup(const struct sockaddr *,
|
||||
const struct sockaddr *, struct syn_cache_head **, u_int);
|
||||
|
||||
/*
|
||||
* Insert segment ti into reassembly queue of tcp with
|
||||
|
@ -3109,9 +3109,9 @@ struct mutex syn_cache_mtx = MUTEX_INITIALIZER(IPL_SOFTNET);
|
|||
#ifndef INET6
|
||||
#define SYN_HASHALL(hash, src, dst, rand) \
|
||||
do { \
|
||||
hash = SYN_HASH(&satosin(src)->sin_addr, \
|
||||
satosin(src)->sin_port, \
|
||||
satosin(dst)->sin_port, (rand)); \
|
||||
hash = SYN_HASH(&satosin_const(src)->sin_addr, \
|
||||
satosin_const(src)->sin_port, \
|
||||
satosin_const(dst)->sin_port, (rand)); \
|
||||
} while (/*CONSTCOND*/ 0)
|
||||
#else
|
||||
#define SYN_HASH6(sa, sp, dp, rand) \
|
||||
|
@ -3125,14 +3125,14 @@ do { \
|
|||
do { \
|
||||
switch ((src)->sa_family) { \
|
||||
case AF_INET: \
|
||||
hash = SYN_HASH(&satosin(src)->sin_addr, \
|
||||
satosin(src)->sin_port, \
|
||||
satosin(dst)->sin_port, (rand)); \
|
||||
hash = SYN_HASH(&satosin_const(src)->sin_addr, \
|
||||
satosin_const(src)->sin_port, \
|
||||
satosin_const(dst)->sin_port, (rand)); \
|
||||
break; \
|
||||
case AF_INET6: \
|
||||
hash = SYN_HASH6(&satosin6(src)->sin6_addr, \
|
||||
satosin6(src)->sin6_port, \
|
||||
satosin6(dst)->sin6_port, (rand)); \
|
||||
hash = SYN_HASH6(&satosin6_const(src)->sin6_addr, \
|
||||
satosin6_const(src)->sin6_port, \
|
||||
satosin6_const(dst)->sin6_port, (rand)); \
|
||||
break; \
|
||||
default: \
|
||||
hash = 0; \
|
||||
|
@ -3423,7 +3423,7 @@ syn_cache_cleanup(struct tcpcb *tp)
|
|||
* Find an entry in the syn cache.
|
||||
*/
|
||||
struct syn_cache *
|
||||
syn_cache_lookup(struct sockaddr *src, struct sockaddr *dst,
|
||||
syn_cache_lookup(const struct sockaddr *src, const struct sockaddr *dst,
|
||||
struct syn_cache_head **headp, u_int rtableid)
|
||||
{
|
||||
struct syn_cache_set *sets[2];
|
||||
|
@ -3709,8 +3709,8 @@ syn_cache_reset(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
|
|||
}
|
||||
|
||||
void
|
||||
syn_cache_unreach(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
|
||||
u_int rtableid)
|
||||
syn_cache_unreach(const struct sockaddr *src, const struct sockaddr *dst,
|
||||
struct tcphdr *th, u_int rtableid)
|
||||
{
|
||||
struct syn_cache *sc;
|
||||
struct syn_cache_head *scp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_subr.c,v 1.195 2024/01/11 13:49:49 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_subr.c,v 1.196 2024/01/27 21:13:46 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -698,8 +698,8 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d)
|
|||
} else if (inet6ctlerrmap[cmd] == EHOSTUNREACH ||
|
||||
inet6ctlerrmap[cmd] == ENETUNREACH ||
|
||||
inet6ctlerrmap[cmd] == EHOSTDOWN)
|
||||
syn_cache_unreach((struct sockaddr *)sa6_src,
|
||||
sa, &th, rdomain);
|
||||
syn_cache_unreach(sin6tosa_const(sa6_src), sa, &th,
|
||||
rdomain);
|
||||
in_pcbunref(inp);
|
||||
} else {
|
||||
in6_pcbnotify(&tcbtable, sa6, 0,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_timer.c,v 1.74 2024/01/11 13:49:49 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_timer.c,v 1.75 2024/01/27 21:35:13 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -198,30 +198,35 @@ void
|
|||
tcp_timer_rexmt(void *arg)
|
||||
{
|
||||
struct tcpcb *otp = NULL, *tp = arg;
|
||||
struct inpcb *inp;
|
||||
uint32_t rto;
|
||||
short ostate;
|
||||
|
||||
NET_LOCK();
|
||||
inp = tp->t_inpcb;
|
||||
|
||||
/* Ignore canceled timeouts or timeouts that have been rescheduled. */
|
||||
if (!ISSET((tp)->t_flags, TF_TMR_REXMT) ||
|
||||
timeout_pending(&tp->t_timer[TCPT_REXMT]))
|
||||
goto out;
|
||||
CLR((tp)->t_flags, TF_TMR_REXMT);
|
||||
|
||||
if ((tp->t_flags & TF_PMTUD_PEND) && tp->t_inpcb &&
|
||||
if ((tp->t_flags & TF_PMTUD_PEND) && inp &&
|
||||
SEQ_GEQ(tp->t_pmtud_th_seq, tp->snd_una) &&
|
||||
SEQ_LT(tp->t_pmtud_th_seq, (int)(tp->snd_una + tp->t_maxseg))) {
|
||||
struct sockaddr_in sin;
|
||||
struct icmp icmp;
|
||||
|
||||
/* TF_PMTUD_PEND is set in tcp_ctlinput() which is IPv4 only */
|
||||
KASSERT(!ISSET(inp->inp_flags, INP_IPV6));
|
||||
tp->t_flags &= ~TF_PMTUD_PEND;
|
||||
|
||||
/* XXX create fake icmp message with relevant entries */
|
||||
icmp.icmp_nextmtu = tp->t_pmtud_nextmtu;
|
||||
icmp.icmp_ip.ip_len = tp->t_pmtud_ip_len;
|
||||
icmp.icmp_ip.ip_hl = tp->t_pmtud_ip_hl;
|
||||
icmp.icmp_ip.ip_dst = tp->t_inpcb->inp_faddr;
|
||||
icmp_mtudisc(&icmp, tp->t_inpcb->inp_rtableid);
|
||||
icmp.icmp_ip.ip_dst = inp->inp_faddr;
|
||||
icmp_mtudisc(&icmp, inp->inp_rtableid);
|
||||
|
||||
/*
|
||||
* Notify all connections to the same peer about
|
||||
|
@ -230,9 +235,9 @@ tcp_timer_rexmt(void *arg)
|
|||
bzero(&sin, sizeof(sin));
|
||||
sin.sin_len = sizeof(sin);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr = tp->t_inpcb->inp_faddr;
|
||||
in_pcbnotifyall(&tcbtable, sintosa(&sin),
|
||||
tp->t_inpcb->inp_rtableid, EMSGSIZE, tcp_mtudisc);
|
||||
sin.sin_addr = inp->inp_faddr;
|
||||
in_pcbnotifyall(&tcbtable, sintosa(&sin), inp->inp_rtableid,
|
||||
EMSGSIZE, tcp_mtudisc);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -244,7 +249,7 @@ tcp_timer_rexmt(void *arg)
|
|||
tp->t_softerror : ETIMEDOUT);
|
||||
goto out;
|
||||
}
|
||||
if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) {
|
||||
if (inp->inp_socket->so_options & SO_DEBUG) {
|
||||
otp = tp;
|
||||
ostate = tp->t_state;
|
||||
}
|
||||
|
@ -265,10 +270,9 @@ tcp_timer_rexmt(void *arg)
|
|||
* lots more sophisticated searching to find the right
|
||||
* value here...
|
||||
*/
|
||||
if (ip_mtudisc && tp->t_inpcb &&
|
||||
if (ip_mtudisc && inp &&
|
||||
TCPS_HAVEESTABLISHED(tp->t_state) &&
|
||||
tp->t_rxtshift > TCP_MAXRXTSHIFT / 6) {
|
||||
struct inpcb *inp = tp->t_inpcb;
|
||||
struct rtentry *rt = NULL;
|
||||
|
||||
/* No data to send means path mtu is not a problem */
|
||||
|
@ -319,7 +323,7 @@ tcp_timer_rexmt(void *arg)
|
|||
* retransmit times until then.
|
||||
*/
|
||||
if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) {
|
||||
in_losing(tp->t_inpcb);
|
||||
in_losing(inp);
|
||||
tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT);
|
||||
tp->t_srtt = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tcp_var.h,v 1.174 2024/01/11 13:49:49 bluhm Exp $ */
|
||||
/* $OpenBSD: tcp_var.h,v 1.175 2024/01/27 21:13:46 bluhm Exp $ */
|
||||
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -799,7 +799,7 @@ int tcp_signature(struct tdb *, int, struct mbuf *, struct tcphdr *,
|
|||
#endif /* TCP_SIGNATURE */
|
||||
void tcp_set_iss_tsm(struct tcpcb *);
|
||||
|
||||
void syn_cache_unreach(struct sockaddr *, struct sockaddr *,
|
||||
void syn_cache_unreach(const struct sockaddr *, const struct sockaddr *,
|
||||
struct tcphdr *, u_int);
|
||||
void syn_cache_init(void);
|
||||
void syn_cache_cleanup(struct tcpcb *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue