diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-03-18 21:05:22 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-03-18 21:05:22 +0000 |
commit | 380ed72672bf7cfcdab67e8a9f8fe4a42b57d075 (patch) | |
tree | edd49f78e0045737ceb40565c90143282a2366fb /sys/netinet | |
parent | 59aea71bb5a2364ec4c0a83c8e7d0649423c96ad (diff) |
Refactor tcp_mtudisc() like NetBSD did. Do the route lookup only
if the tcpcb exits.
OK mpi@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_subr.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 9d3fbc950ce..4562f8f4630 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.168 2018/01/23 21:41:17 bluhm Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.169 2018/03/18 21:05:21 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -849,33 +849,36 @@ void tcp_mtudisc(struct inpcb *inp, int errno) { struct tcpcb *tp = intotcpcb(inp); - struct rtentry *rt = in_pcbrtentry(inp); + struct rtentry *rt; int change = 0; - if (tp != 0) { + if (tp == NULL) + return; + + rt = in_pcbrtentry(inp); + if (rt != NULL) { int orig_maxseg = tp->t_maxseg; - if (rt != 0) { - /* - * If this was not a host route, remove and realloc. - */ - if ((rt->rt_flags & RTF_HOST) == 0) { - in_rtchange(inp, errno); - if ((rt = in_pcbrtentry(inp)) == 0) - return; - } - if (orig_maxseg != tp->t_maxseg || - (rt->rt_locks & RTV_MTU)) - change = 1; - } - tcp_mss(tp, -1); /* - * Resend unacknowledged packets + * If this was not a host route, remove and realloc. */ - tp->snd_nxt = tp->snd_una; - if (change || errno > 0) - tcp_output(tp); + if ((rt->rt_flags & RTF_HOST) == 0) { + in_rtchange(inp, errno); + if ((rt = in_pcbrtentry(inp)) == NULL) + return; + } + if (orig_maxseg != tp->t_maxseg || + (rt->rt_locks & RTV_MTU)) + change = 1; } + tcp_mss(tp, -1); + + /* + * Resend unacknowledged packets + */ + tp->snd_nxt = tp->snd_una; + if (change || errno > 0) + tcp_output(tp); } void |