Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!amdcad!lll-crg!gymble!umcp-cs!steve From: steve@umcp-cs.UUCP (Steve D. Miller) Newsgroups: net.sources Subject: Re: Unhang TCP connections stuck in FIN_WAIT_2 state Message-ID: <3076@umcp-cs.UUCP> Date: Thu, 6-Feb-86 09:28:24 EST Article-I.D.: umcp-cs.3076 Posted: Thu Feb 6 09:28:24 1986 Date-Received: Sun, 9-Feb-86 04:37:45 EST References: <914@rlgvax.UUCP> Reply-To: steve@maryland.UUCP (Steve D. Miller) Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 56 Here's a better fix for the 4.2 FIN_WAIT_2 problem. I don't remember where I got it, but it works; the basic problem is that the code to drop the connection when nothing cares about it is there in vanilla 4.2BSD, but is in the wrong place. This fix moves it to the right spot and mungs a conditional a little bit... The fix is to netinet/tcp_input.c; I think this is for vanilla 4.2, but your line numbers may vary. *** Vanilla (??) 4.2 tcp_input.c Fri Jan 24 12:24:00 1986 --- Fixed 4.2 tcp_input.c Fri Jan 24 12:24:03 1986 *************** *** 358,363 **** --- 358,372 ---- goto dropafterack; if (ti->ti_len > 0) { m_adj(m, ti->ti_len); + /* + * If data is received on a connection after the + * user processes are gone, then RST the other end. + */ + if ((so->so_state & SS_NOFDREF) + && tp->t_state > TCPS_CLOSE_WAIT) { + tp = tcp_close(tp); + goto dropwithreset; + } ti->ti_len = 0; ti->ti_flags &= ~(TH_PUSH|TH_FIN); } *************** *** 404,419 **** ti->ti_len -= todrop; ti->ti_flags &= ~(TH_PUSH|TH_FIN); } - } - - /* - * If data is received on a connection after the - * user processes are gone, then RST the other end. - */ - if ((so->so_state & SS_NOFDREF) && tp->t_state > TCPS_CLOSE_WAIT && - ti->ti_len) { - tp = tcp_close(tp); - goto dropwithreset; } /* --- 413,418 ---- -- Spoken: Steve Miller ARPA: steve@mimsy.umd.edu Phone: +1-301-454-4251 CSNet: steve@umcp-cs UUCP: {seismo,allegra}!umcp-cs!steve USPS: Computer Science Dept., University of Maryland, College Park, MD 20742