*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
extern struct inpcbhead time_wait_slots[];
extern int cur_tw_slot;
extern u_long *delack_bitmask;
+extern u_long route_generation;
int get_inpcb_str_size()
callout_stop(tp->tt_keep);
callout_stop(tp->tt_2msl);
callout_stop(tp->tt_delack);
+#else
+ /* Clear the timers before we delete the PCB. */
+ {
+ int i;
+ for (i = 0; i < TCPT_NTIMERS; i++) {
+ tp->t_timer[i] = 0;
+ }
+ }
#endif
KERNEL_DEBUG(DBG_FNC_TCP_CLOSE | DBG_FUNC_START, tp,0,0,0,0);
goto no_valid_rt;
}
else
-#endif /* INET6 */
- if ((rt = inp->inp_route.ro_rt) == NULL ||
+#endif /* INET6 */
+ rt = inp->inp_route.ro_rt;
+ if (rt == NULL ||
((struct sockaddr_in *)rt_key(rt))->sin_addr.s_addr
- == INADDR_ANY)
+ == INADDR_ANY || rt->generation_id != route_generation) {
+ if (tp->t_state >= TCPS_CLOSE_WAIT)
+ tp->t_state = TCPS_CLOSING;
+
goto no_valid_rt;
+ }
if ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0) {
i = tp->t_srtt *
struct inpcb *inp;
int error;
{
- struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb;
+ struct tcpcb *tp;
+
+ if (inp == NULL)
+ return; /* pcb is gone already */
+
+ tp = (struct tcpcb *)inp->inp_ppcb;
/*
* Ignore some errors if we are hooked up.
if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC &&
(tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC)
mss -= TCPOLEN_CC_APPA;
-#if (MCLBYTES & (MCLBYTES - 1)) == 0
- if (mss > MCLBYTES)
- mss &= ~(MCLBYTES-1);
-#else
- if (mss > MCLBYTES)
- mss = mss / MCLBYTES * MCLBYTES;
-#endif
+
if (so->so_snd.sb_hiwat < mss)
mss = so->so_snd.sb_hiwat;
if (ro == NULL)
return (NULL);
rt = ro->ro_rt;
- if (rt == NULL || !(rt->rt_flags & RTF_UP)) {
+ if (rt == NULL || !(rt->rt_flags & RTF_UP) || rt->generation_id != route_generation) {
/* No route yet, so try to acquire one */
if (inp->inp_faddr.s_addr != INADDR_ANY) {
ro->ro_dst.sa_family = AF_INET;