Deleted Added
full compact
tcp_syncache.c (122501) tcp_syncache.c (122922)
1/*-
2 * Copyright (c) 2001 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by Jonathan Lemon
6 * and NAI Labs, the Security Research Division of Network Associates, Inc.
7 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
8 * DARPA CHATS research program.

--- 17 unchanged lines hidden (view full) ---

26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
1/*-
2 * Copyright (c) 2001 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by Jonathan Lemon
6 * and NAI Labs, the Security Research Division of Network Associates, Inc.
7 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
8 * DARPA CHATS research program.

--- 17 unchanged lines hidden (view full) ---

26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $FreeBSD: head/sys/netinet/tcp_syncache.c 122501 2003-11-11 18:16:54Z sam $
34 * $FreeBSD: head/sys/netinet/tcp_syncache.c 122922 2003-11-20 20:07:39Z andre $
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_mac.h"
40#include "opt_tcpdebug.h"
41
42#include <sys/param.h>

--- 154 unchanged lines hidden (view full) ---

197 callout_reset(&tcp_syncache.tt_timerq[(slot)], \
198 TCPTV_RTOBASE * tcp_backoff[(slot)], \
199 syncache_timer, (void *)((intptr_t)(slot))); \
200} while (0)
201
202static void
203syncache_free(struct syncache *sc)
204{
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_mac.h"
40#include "opt_tcpdebug.h"
41
42#include <sys/param.h>

--- 154 unchanged lines hidden (view full) ---

197 callout_reset(&tcp_syncache.tt_timerq[(slot)], \
198 TCPTV_RTOBASE * tcp_backoff[(slot)], \
199 syncache_timer, (void *)((intptr_t)(slot))); \
200} while (0)
201
202static void
203syncache_free(struct syncache *sc)
204{
205 struct rtentry *rt;
206
207 if (sc->sc_ipopts)
208 (void) m_free(sc->sc_ipopts);
205 if (sc->sc_ipopts)
206 (void) m_free(sc->sc_ipopts);
209#ifdef INET6
210 if (sc->sc_inc.inc_isipv6)
211 rt = sc->sc_route6.ro_rt;
212 else
213#endif
214 rt = sc->sc_route.ro_rt;
215 if (rt != NULL) {
216 /*
217 * If this is the only reference to a protocol cloned
218 * route, remove it immediately.
219 */
220 if (rt->rt_flags & RTF_WASCLONED &&
221 (sc->sc_flags & SCF_KEEPROUTE) == 0 &&
222 rt->rt_refcnt == 1)
223 rtrequest(RTM_DELETE, rt_key(rt),
224 rt->rt_gateway, rt_mask(rt),
225 rt->rt_flags, NULL);
226 RTFREE(rt);
227 }
207
228 uma_zfree(tcp_syncache.zone, sc);
229}
230
231void
232syncache_init(void)
233{
234 int i;
235

--- 403 unchanged lines hidden (view full) ---

639 * previous one and hence should be passed to a user.
640 * If we copied in6p_inputopts, a user would not be able to
641 * receive options just after calling the accept system call.
642 */
643 inp->inp_flags |= oinp->inp_flags & INP_CONTROLOPTS;
644 if (oinp->in6p_outputopts)
645 inp->in6p_outputopts =
646 ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT);
208 uma_zfree(tcp_syncache.zone, sc);
209}
210
211void
212syncache_init(void)
213{
214 int i;
215

--- 403 unchanged lines hidden (view full) ---

619 * previous one and hence should be passed to a user.
620 * If we copied in6p_inputopts, a user would not be able to
621 * receive options just after calling the accept system call.
622 */
623 inp->inp_flags |= oinp->inp_flags & INP_CONTROLOPTS;
624 if (oinp->in6p_outputopts)
625 inp->in6p_outputopts =
626 ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT);
647 inp->in6p_route = sc->sc_route6;
648 sc->sc_route6.ro_rt = NULL;
649
650 MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6,
651 M_SONAME, M_NOWAIT | M_ZERO);
652 if (sin6 == NULL)
653 goto abort;
654 sin6->sin6_family = AF_INET6;
655 sin6->sin6_len = sizeof(*sin6);
656 sin6->sin6_addr = sc->sc_inc.inc6_faddr;

--- 13 unchanged lines hidden (view full) ---

670 struct in_addr laddr;
671 struct sockaddr_in *sin;
672
673 inp->inp_options = ip_srcroute();
674 if (inp->inp_options == NULL) {
675 inp->inp_options = sc->sc_ipopts;
676 sc->sc_ipopts = NULL;
677 }
627
628 MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6,
629 M_SONAME, M_NOWAIT | M_ZERO);
630 if (sin6 == NULL)
631 goto abort;
632 sin6->sin6_family = AF_INET6;
633 sin6->sin6_len = sizeof(*sin6);
634 sin6->sin6_addr = sc->sc_inc.inc6_faddr;

--- 13 unchanged lines hidden (view full) ---

648 struct in_addr laddr;
649 struct sockaddr_in *sin;
650
651 inp->inp_options = ip_srcroute();
652 if (inp->inp_options == NULL) {
653 inp->inp_options = sc->sc_ipopts;
654 sc->sc_ipopts = NULL;
655 }
678 inp->inp_route = sc->sc_route;
679 sc->sc_route.ro_rt = NULL;
680
681 MALLOC(sin, struct sockaddr_in *, sizeof *sin,
682 M_SONAME, M_NOWAIT | M_ZERO);
683 if (sin == NULL)
684 goto abort;
685 sin->sin_family = AF_INET;
686 sin->sin_len = sizeof(*sin);
687 sin->sin_addr = sc->sc_inc.inc_faddr;

--- 40 unchanged lines hidden (view full) ---

728 * set SND.WND = SEG.WND,
729 * initialize CCsend and CCrecv.
730 */
731 tp->t_flags |= TF_REQ_CC|TF_RCVD_CC;
732 tp->cc_send = sc->sc_cc_send;
733 tp->cc_recv = sc->sc_cc_recv;
734 }
735
656
657 MALLOC(sin, struct sockaddr_in *, sizeof *sin,
658 M_SONAME, M_NOWAIT | M_ZERO);
659 if (sin == NULL)
660 goto abort;
661 sin->sin_family = AF_INET;
662 sin->sin_len = sizeof(*sin);
663 sin->sin_addr = sc->sc_inc.inc_faddr;

--- 40 unchanged lines hidden (view full) ---

704 * set SND.WND = SEG.WND,
705 * initialize CCsend and CCrecv.
706 */
707 tp->t_flags |= TF_REQ_CC|TF_RCVD_CC;
708 tp->cc_send = sc->sc_cc_send;
709 tp->cc_recv = sc->sc_cc_recv;
710 }
711
712 /*
713 * Set up MSS and get cached values from tcp_hostcache.
714 * This might overwrite some of the defaults we just set.
715 */
736 tcp_mss(tp, sc->sc_peer_mss);
737
738 /*
739 * If the SYN,ACK was retransmitted, reset cwnd to 1 segment.
740 */
741 if (sc->sc_rxtslot != 0)
742 tp->snd_cwnd = tp->t_maxseg;
743 callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp);

--- 62 unchanged lines hidden (view full) ---

806#if 0
807resetandabort:
808 /* XXXjlemon check this - is this correct? */
809 (void) tcp_respond(NULL, m, m, th,
810 th->th_seq + tlen, (tcp_seq)0, TH_RST|TH_ACK);
811#endif
812 m_freem(m); /* XXX only needed for above */
813 tcpstat.tcps_sc_aborted++;
716 tcp_mss(tp, sc->sc_peer_mss);
717
718 /*
719 * If the SYN,ACK was retransmitted, reset cwnd to 1 segment.
720 */
721 if (sc->sc_rxtslot != 0)
722 tp->snd_cwnd = tp->t_maxseg;
723 callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp);

--- 62 unchanged lines hidden (view full) ---

786#if 0
787resetandabort:
788 /* XXXjlemon check this - is this correct? */
789 (void) tcp_respond(NULL, m, m, th,
790 th->th_seq + tlen, (tcp_seq)0, TH_RST|TH_ACK);
791#endif
792 m_freem(m); /* XXX only needed for above */
793 tcpstat.tcps_sc_aborted++;
814 } else {
815 sc->sc_flags |= SCF_KEEPROUTE;
794 } else
816 tcpstat.tcps_sc_completed++;
795 tcpstat.tcps_sc_completed++;
817 }
796
818 if (sch == NULL)
819 syncache_free(sc);
820 else
821 syncache_drop(sc, sch);
822 *sop = so;
823 return (1);
824}
825

--- 18 unchanged lines hidden (view full) ---

844 struct socket **sop;
845 struct mbuf *m;
846{
847 struct tcpcb *tp;
848 struct socket *so;
849 struct syncache *sc = NULL;
850 struct syncache_head *sch;
851 struct mbuf *ipopts = NULL;
797 if (sch == NULL)
798 syncache_free(sc);
799 else
800 syncache_drop(sc, sch);
801 *sop = so;
802 return (1);
803}
804

--- 18 unchanged lines hidden (view full) ---

823 struct socket **sop;
824 struct mbuf *m;
825{
826 struct tcpcb *tp;
827 struct socket *so;
828 struct syncache *sc = NULL;
829 struct syncache_head *sch;
830 struct mbuf *ipopts = NULL;
852 struct rmxp_tao *taop;
831 struct rmxp_tao tao;
853 int i, win;
854
855 INP_INFO_WLOCK_ASSERT(&tcbinfo);
856
857 so = *sop;
858 tp = sototcpcb(so);
832 int i, win;
833
834 INP_INFO_WLOCK_ASSERT(&tcbinfo);
835
836 so = *sop;
837 tp = sototcpcb(so);
838 bzero(&tao, sizeof(tao));
859
860 /*
861 * Remember the IP options, if any.
862 */
863#ifdef INET6
864 if (!inc->inc_isipv6)
865#endif
866 ipopts = ip_srcroute();

--- 77 unchanged lines hidden (view full) ---

944 sc->sc_ipopts = ipopts;
945 sc->sc_inc.inc_fport = inc->inc_fport;
946 sc->sc_inc.inc_lport = inc->inc_lport;
947#ifdef INET6
948 sc->sc_inc.inc_isipv6 = inc->inc_isipv6;
949 if (inc->inc_isipv6) {
950 sc->sc_inc.inc6_faddr = inc->inc6_faddr;
951 sc->sc_inc.inc6_laddr = inc->inc6_laddr;
839
840 /*
841 * Remember the IP options, if any.
842 */
843#ifdef INET6
844 if (!inc->inc_isipv6)
845#endif
846 ipopts = ip_srcroute();

--- 77 unchanged lines hidden (view full) ---

924 sc->sc_ipopts = ipopts;
925 sc->sc_inc.inc_fport = inc->inc_fport;
926 sc->sc_inc.inc_lport = inc->inc_lport;
927#ifdef INET6
928 sc->sc_inc.inc_isipv6 = inc->inc_isipv6;
929 if (inc->inc_isipv6) {
930 sc->sc_inc.inc6_faddr = inc->inc6_faddr;
931 sc->sc_inc.inc6_laddr = inc->inc6_laddr;
952 sc->sc_route6.ro_rt = NULL;
953 } else
954#endif
955 {
956 sc->sc_inc.inc_faddr = inc->inc_faddr;
957 sc->sc_inc.inc_laddr = inc->inc_laddr;
932 } else
933#endif
934 {
935 sc->sc_inc.inc_faddr = inc->inc_faddr;
936 sc->sc_inc.inc_laddr = inc->inc_laddr;
958 sc->sc_route.ro_rt = NULL;
959 }
960 sc->sc_irs = th->th_seq;
961 sc->sc_flags = 0;
962 sc->sc_peer_mss = to->to_flags & TOF_MSS ? to->to_mss : 0;
963 if (tcp_syncookies)
964 sc->sc_iss = syncookie_generate(sc);
965 else
966 sc->sc_iss = arc4random();

--- 55 unchanged lines hidden (view full) ---

1022 * immediately: save new CC in the cache, mark the socket
1023 * connected, enter ESTABLISHED state, turn on flag to
1024 * send a SYN in the next segment.
1025 * A virtual advertised window is set in rcv_adv to
1026 * initialize SWS prevention. Then enter normal segment
1027 * processing: drop SYN, process data and FIN.
1028 * - otherwise do a normal 3-way handshake.
1029 */
937 }
938 sc->sc_irs = th->th_seq;
939 sc->sc_flags = 0;
940 sc->sc_peer_mss = to->to_flags & TOF_MSS ? to->to_mss : 0;
941 if (tcp_syncookies)
942 sc->sc_iss = syncookie_generate(sc);
943 else
944 sc->sc_iss = arc4random();

--- 55 unchanged lines hidden (view full) ---

1000 * immediately: save new CC in the cache, mark the socket
1001 * connected, enter ESTABLISHED state, turn on flag to
1002 * send a SYN in the next segment.
1003 * A virtual advertised window is set in rcv_adv to
1004 * initialize SWS prevention. Then enter normal segment
1005 * processing: drop SYN, process data and FIN.
1006 * - otherwise do a normal 3-way handshake.
1007 */
1030 taop = tcp_gettaocache(&sc->sc_inc);
1008 if (tcp_do_rfc1644)
1009 tcp_hc_gettao(&sc->sc_inc, &tao);
1010
1031 if ((to->to_flags & TOF_CC) != 0) {
1032 if (((tp->t_flags & TF_NOPUSH) != 0) &&
1011 if ((to->to_flags & TOF_CC) != 0) {
1012 if (((tp->t_flags & TF_NOPUSH) != 0) &&
1033 sc->sc_flags & SCF_CC &&
1034 taop != NULL && taop->tao_cc != 0 &&
1035 CC_GT(to->to_cc, taop->tao_cc)) {
1013 sc->sc_flags & SCF_CC && tao.tao_cc != 0 &&
1014 CC_GT(to->to_cc, tao.tao_cc)) {
1036 sc->sc_rxtslot = 0;
1037 so = syncache_socket(sc, *sop, m);
1038 if (so != NULL) {
1015 sc->sc_rxtslot = 0;
1016 so = syncache_socket(sc, *sop, m);
1017 if (so != NULL) {
1039 sc->sc_flags |= SCF_KEEPROUTE;
1040 taop->tao_cc = to->to_cc;
1018 tao.tao_cc = to->to_cc;
1019 tcp_hc_updatetao(&sc->sc_inc, TCP_HC_TAO_CC,
1020 tao.tao_cc, 0);
1041 *sop = so;
1042 }
1043 syncache_free(sc);
1044 return (so != NULL);
1045 }
1046 } else {
1047 /*
1048 * No CC option, but maybe CC.NEW: invalidate cached value.
1049 */
1021 *sop = so;
1022 }
1023 syncache_free(sc);
1024 return (so != NULL);
1025 }
1026 } else {
1027 /*
1028 * No CC option, but maybe CC.NEW: invalidate cached value.
1029 */
1050 if (taop != NULL)
1051 taop->tao_cc = 0;
1030 if (tcp_do_rfc1644) {
1031 tao.tao_cc = 0;
1032 tcp_hc_updatetao(&sc->sc_inc, TCP_HC_TAO_CC,
1033 tao.tao_cc, 0);
1034 }
1052 }
1035 }
1036
1053 /*
1054 * TAO test failed or there was no CC option,
1055 * do a standard 3-way handshake.
1056 */
1057#ifdef TCPDEBUG
1058 if (syncache_respond(sc, m, so) == 0) {
1059#else
1060 if (syncache_respond(sc, m) == 0) {

--- 21 unchanged lines hidden (view full) ---

1082 struct syncache *sc;
1083 struct mbuf *m;
1084#endif
1085{
1086 u_int8_t *optp;
1087 int optlen, error;
1088 u_int16_t tlen, hlen, mssopt;
1089 struct ip *ip = NULL;
1037 /*
1038 * TAO test failed or there was no CC option,
1039 * do a standard 3-way handshake.
1040 */
1041#ifdef TCPDEBUG
1042 if (syncache_respond(sc, m, so) == 0) {
1043#else
1044 if (syncache_respond(sc, m) == 0) {

--- 21 unchanged lines hidden (view full) ---

1066 struct syncache *sc;
1067 struct mbuf *m;
1068#endif
1069{
1070 u_int8_t *optp;
1071 int optlen, error;
1072 u_int16_t tlen, hlen, mssopt;
1073 struct ip *ip = NULL;
1090 struct rtentry *rt;
1091 struct tcphdr *th;
1092 struct inpcb *inp;
1093#ifdef INET6
1094 struct ip6_hdr *ip6 = NULL;
1095#endif
1096
1074 struct tcphdr *th;
1075 struct inpcb *inp;
1076#ifdef INET6
1077 struct ip6_hdr *ip6 = NULL;
1078#endif
1079
1080 hlen =
1097#ifdef INET6
1081#ifdef INET6
1098 if (sc->sc_inc.inc_isipv6) {
1099 rt = tcp_rtlookup6(&sc->sc_inc);
1100 if (rt != NULL)
1101 mssopt = rt->rt_ifp->if_mtu -
1102 (sizeof(struct ip6_hdr) + sizeof(struct tcphdr));
1103 else
1104 mssopt = tcp_v6mssdflt;
1105 hlen = sizeof(struct ip6_hdr);
1106 } else
1082 (sc->sc_inc.inc_isipv6) ? sizeof(struct ip6_hdr) :
1107#endif
1083#endif
1108 {
1109 rt = tcp_rtlookup(&sc->sc_inc);
1110 if (rt != NULL)
1111 mssopt = rt->rt_ifp->if_mtu -
1112 (sizeof(struct ip) + sizeof(struct tcphdr));
1113 else
1114 mssopt = tcp_mssdflt;
1115 hlen = sizeof(struct ip);
1116 }
1084 sizeof(struct ip);
1117
1085
1086 KASSERT((&sc->sc_inc) != NULL, ("syncache_respond with NULL in_conninfo pointer"));
1087
1088 /* Determine MSS we advertize to other end of connection */
1089 mssopt = tcp_mssopt(&sc->sc_inc);
1090
1118 /* Compute the size of the TCP options. */
1119 if (sc->sc_flags & SCF_NOOPT) {
1120 optlen = 0;
1121 } else {
1122 optlen = TCPOLEN_MAXSEG +
1123 ((sc->sc_flags & SCF_WINSCALE) ? 4 : 0) +
1124 ((sc->sc_flags & SCF_TIMESTAMP) ? TCPOLEN_TSTAMP_APPA : 0) +
1125 ((sc->sc_flags & SCF_CC) ? TCPOLEN_CC_APPA * 2 : 0);

--- 113 unchanged lines hidden (view full) ---

1239 *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CCECHO));
1240 *lp = htonl(sc->sc_cc_recv);
1241 optp += TCPOLEN_CC_APPA * 2;
1242 }
1243 }
1244
1245#ifdef INET6
1246 if (sc->sc_inc.inc_isipv6) {
1091 /* Compute the size of the TCP options. */
1092 if (sc->sc_flags & SCF_NOOPT) {
1093 optlen = 0;
1094 } else {
1095 optlen = TCPOLEN_MAXSEG +
1096 ((sc->sc_flags & SCF_WINSCALE) ? 4 : 0) +
1097 ((sc->sc_flags & SCF_TIMESTAMP) ? TCPOLEN_TSTAMP_APPA : 0) +
1098 ((sc->sc_flags & SCF_CC) ? TCPOLEN_CC_APPA * 2 : 0);

--- 113 unchanged lines hidden (view full) ---

1212 *lp++ = htonl(TCPOPT_CC_HDR(TCPOPT_CCECHO));
1213 *lp = htonl(sc->sc_cc_recv);
1214 optp += TCPOLEN_CC_APPA * 2;
1215 }
1216 }
1217
1218#ifdef INET6
1219 if (sc->sc_inc.inc_isipv6) {
1247 struct route_in6 *ro6 = &sc->sc_route6;
1248
1249 th->th_sum = 0;
1250 th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen, tlen - hlen);
1220 th->th_sum = 0;
1221 th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen, tlen - hlen);
1251 ip6->ip6_hlim = in6_selecthlim(NULL,
1252 ro6->ro_rt ? ro6->ro_rt->rt_ifp : NULL);
1253 error = ip6_output(m, NULL, ro6, 0, NULL, NULL, inp);
1222 ip6->ip6_hlim = in6_selecthlim(NULL, NULL);
1223 error = ip6_output(m, NULL, NULL, 0, NULL, NULL, inp);
1254 } else
1255#endif
1256 {
1257 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
1258 htons(tlen - hlen + IPPROTO_TCP));
1259 m->m_pkthdr.csum_flags = CSUM_TCP;
1260 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
1261#ifdef TCPDEBUG
1262 /*
1263 * Trace.
1264 */
1265 if (so != NULL && so->so_options & SO_DEBUG) {
1266 struct tcpcb *tp = sototcpcb(so);
1267 tcp_trace(TA_OUTPUT, tp->t_state, tp,
1268 mtod(m, void *), th, 0);
1269 }
1270#endif
1224 } else
1225#endif
1226 {
1227 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
1228 htons(tlen - hlen + IPPROTO_TCP));
1229 m->m_pkthdr.csum_flags = CSUM_TCP;
1230 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
1231#ifdef TCPDEBUG
1232 /*
1233 * Trace.
1234 */
1235 if (so != NULL && so->so_options & SO_DEBUG) {
1236 struct tcpcb *tp = sototcpcb(so);
1237 tcp_trace(TA_OUTPUT, tp->t_state, tp,
1238 mtod(m, void *), th, 0);
1239 }
1240#endif
1271 error = ip_output(m, sc->sc_ipopts, &sc->sc_route, 0, NULL,inp);
1241 error = ip_output(m, sc->sc_ipopts, NULL, 0, NULL, inp);
1272 }
1273 INP_UNLOCK(inp);
1274 return (error);
1275}
1276
1277/*
1278 * cookie layers:
1279 *

--- 150 unchanged lines hidden (view full) ---

1430 sc->sc_ipopts = NULL;
1431 sc->sc_inc.inc_fport = inc->inc_fport;
1432 sc->sc_inc.inc_lport = inc->inc_lport;
1433#ifdef INET6
1434 sc->sc_inc.inc_isipv6 = inc->inc_isipv6;
1435 if (inc->inc_isipv6) {
1436 sc->sc_inc.inc6_faddr = inc->inc6_faddr;
1437 sc->sc_inc.inc6_laddr = inc->inc6_laddr;
1242 }
1243 INP_UNLOCK(inp);
1244 return (error);
1245}
1246
1247/*
1248 * cookie layers:
1249 *

--- 150 unchanged lines hidden (view full) ---

1400 sc->sc_ipopts = NULL;
1401 sc->sc_inc.inc_fport = inc->inc_fport;
1402 sc->sc_inc.inc_lport = inc->inc_lport;
1403#ifdef INET6
1404 sc->sc_inc.inc_isipv6 = inc->inc_isipv6;
1405 if (inc->inc_isipv6) {
1406 sc->sc_inc.inc6_faddr = inc->inc6_faddr;
1407 sc->sc_inc.inc6_laddr = inc->inc6_laddr;
1438 sc->sc_route6.ro_rt = NULL;
1439 } else
1440#endif
1441 {
1442 sc->sc_inc.inc_faddr = inc->inc_faddr;
1443 sc->sc_inc.inc_laddr = inc->inc_laddr;
1408 } else
1409#endif
1410 {
1411 sc->sc_inc.inc_faddr = inc->inc_faddr;
1412 sc->sc_inc.inc_laddr = inc->inc_laddr;
1444 sc->sc_route.ro_rt = NULL;
1445 }
1446 sc->sc_irs = th->th_seq - 1;
1447 sc->sc_iss = th->th_ack - 1;
1448 wnd = sbspace(&so->so_rcv);
1449 wnd = imax(wnd, 0);
1450 wnd = imin(wnd, TCP_MAXWIN);
1451 sc->sc_wnd = wnd;
1452 sc->sc_flags = 0;
1453 sc->sc_rxtslot = 0;
1454 sc->sc_peer_mss = tcp_msstab[data];
1455 return (sc);
1456}
1413 }
1414 sc->sc_irs = th->th_seq - 1;
1415 sc->sc_iss = th->th_ack - 1;
1416 wnd = sbspace(&so->so_rcv);
1417 wnd = imax(wnd, 0);
1418 wnd = imin(wnd, TCP_MAXWIN);
1419 sc->sc_wnd = wnd;
1420 sc->sc_flags = 0;
1421 sc->sc_rxtslot = 0;
1422 sc->sc_peer_mss = tcp_msstab[data];
1423 return (sc);
1424}