+ KERNEL_DEBUG(DBG_FNC_TCP_OUTPUT | DBG_FUNC_START, 0,0,0,0,0);
+
+#if INET6
+ if (isipv6) {
+
+ KERNEL_DEBUG(DBG_LAYER_BEG,
+ ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
+ (((tp->t_inpcb->in6p_laddr.s6_addr16[0] & 0xffff) << 16) |
+ (tp->t_inpcb->in6p_faddr.s6_addr16[0] & 0xffff)),
+ sendalot,0,0);
+ }
+ else
+#endif
+
+ {
+ KERNEL_DEBUG(DBG_LAYER_BEG,
+ ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
+ (((tp->t_inpcb->inp_laddr.s_addr & 0xffff) << 16) |
+ (tp->t_inpcb->inp_faddr.s_addr & 0xffff)),
+ sendalot,0,0);
+ /*
+ * If the route generation id changed, we need to check that our
+ * local (source) IP address is still valid. If it isn't either
+ * return error or silently do nothing (assuming the address will
+ * come back before the TCP connection times out).
+ */
+
+ if ((tp->t_inpcb->inp_route.ro_rt != NULL &&
+ (tp->t_inpcb->inp_route.ro_rt->generation_id != route_generation)) || (tp->t_inpcb->inp_route.ro_rt == NULL)) {
+ /* check that the source address is still valid */
+ if (ifa_foraddr(tp->t_inpcb->inp_laddr.s_addr) == 0) {
+ if (tp->t_state >= TCPS_CLOSE_WAIT) {
+ tcp_close(tp);
+ return(EADDRNOTAVAIL);
+ }
+
+ /* set Retransmit timer if it wasn't set
+ * reset Persist timer and shift register as the
+ * adversed peer window may not be valid anymore
+ */
+
+ if (!tp->t_timer[TCPT_REXMT]) {
+ tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
+ if (tp->t_timer[TCPT_PERSIST]) {
+ tp->t_timer[TCPT_PERSIST] = 0;
+ tp->t_rxtshift = 0;
+ }
+ }
+
+ if (packetlist) {
+ error = ip_output_list(packetlist, packchain_listadd, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
+ (so->so_options & SO_DONTROUTE), 0);
+ tp->t_lastchain = 0;
+ }
+ if (so->so_flags & SOF_NOADDRAVAIL)
+ return(EADDRNOTAVAIL);
+ else
+ return(0); /* silently ignore and keep data in socket */
+ }
+ }
+ }
+
+ /*
+ * If we've recently taken a timeout, snd_max will be greater than
+ * snd_nxt. There may be SACK information that allows us to avoid
+ * resending already delivered data. Adjust snd_nxt accordingly.
+ */
+ if (tp->sack_enable && SEQ_LT(tp->snd_nxt, tp->snd_max))
+ tcp_sack_adjust(tp);