tcp_syncache.c (101405) | tcp_syncache.c (105194) |
---|---|
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 101405 2002-08-05 22:34:15Z silby $ | 34 * $FreeBSD: head/sys/netinet/tcp_syncache.c 105194 2002-10-16 01:54:46Z sam $ |
35 */ 36 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_mac.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 1056 unchanged lines hidden (view full) --- 1099 m->m_data += max_linkhdr; 1100 m->m_len = tlen; 1101 m->m_pkthdr.len = tlen; 1102 m->m_pkthdr.rcvif = NULL; 1103#ifdef MAC 1104 mac_create_mbuf_from_socket(sc->sc_tp->t_inpcb->inp_socket, m); 1105#endif 1106 | 35 */ 36 37#include "opt_inet6.h" 38#include "opt_ipsec.h" 39#include "opt_mac.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 1056 unchanged lines hidden (view full) --- 1099 m->m_data += max_linkhdr; 1100 m->m_len = tlen; 1101 m->m_pkthdr.len = tlen; 1102 m->m_pkthdr.rcvif = NULL; 1103#ifdef MAC 1104 mac_create_mbuf_from_socket(sc->sc_tp->t_inpcb->inp_socket, m); 1105#endif 1106 |
1107#ifdef IPSEC 1108 /* use IPsec policy on listening socket to send SYN,ACK */ 1109 if (ipsec_setsocket(m, sc->sc_tp->t_inpcb->inp_socket) != 0) { 1110 m_freem(m); 1111 return (ENOBUFS); 1112 } 1113#endif 1114 | |
1115#ifdef INET6 1116 if (sc->sc_inc.inc_isipv6) { 1117 ip6 = mtod(m, struct ip6_hdr *); 1118 ip6->ip6_vfc = IPV6_VERSION; 1119 ip6->ip6_nxt = IPPROTO_TCP; 1120 ip6->ip6_src = sc->sc_inc.inc6_laddr; 1121 ip6->ip6_dst = sc->sc_inc.inc6_faddr; 1122 ip6->ip6_plen = htons(tlen - hlen); --- 85 unchanged lines hidden (view full) --- 1208#ifdef INET6 1209 if (sc->sc_inc.inc_isipv6) { 1210 struct route_in6 *ro6 = &sc->sc_route6; 1211 1212 th->th_sum = 0; 1213 th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen, tlen - hlen); 1214 ip6->ip6_hlim = in6_selecthlim(NULL, 1215 ro6->ro_rt ? ro6->ro_rt->rt_ifp : NULL); | 1107#ifdef INET6 1108 if (sc->sc_inc.inc_isipv6) { 1109 ip6 = mtod(m, struct ip6_hdr *); 1110 ip6->ip6_vfc = IPV6_VERSION; 1111 ip6->ip6_nxt = IPPROTO_TCP; 1112 ip6->ip6_src = sc->sc_inc.inc6_laddr; 1113 ip6->ip6_dst = sc->sc_inc.inc6_faddr; 1114 ip6->ip6_plen = htons(tlen - hlen); --- 85 unchanged lines hidden (view full) --- 1200#ifdef INET6 1201 if (sc->sc_inc.inc_isipv6) { 1202 struct route_in6 *ro6 = &sc->sc_route6; 1203 1204 th->th_sum = 0; 1205 th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen, tlen - hlen); 1206 ip6->ip6_hlim = in6_selecthlim(NULL, 1207 ro6->ro_rt ? ro6->ro_rt->rt_ifp : NULL); |
1216 error = ip6_output(m, NULL, ro6, 0, NULL, NULL); | 1208 error = ip6_output(m, NULL, ro6, 0, NULL, NULL, 1209 sc->sc_tp->t_inpcb); |
1217 } else 1218#endif 1219 { 1220 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, 1221 htons(tlen - hlen + IPPROTO_TCP)); 1222 m->m_pkthdr.csum_flags = CSUM_TCP; 1223 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); | 1210 } else 1211#endif 1212 { 1213 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, 1214 htons(tlen - hlen + IPPROTO_TCP)); 1215 m->m_pkthdr.csum_flags = CSUM_TCP; 1216 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); |
1224 error = ip_output(m, sc->sc_ipopts, &sc->sc_route, 0, NULL); | 1217 error = ip_output(m, sc->sc_ipopts, &sc->sc_route, 0, NULL, 1218 sc->sc_tp->t_inpcb); |
1225 } 1226 return (error); 1227} 1228 1229/* 1230 * cookie layers: 1231 * 1232 * |. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .| --- 151 unchanged lines hidden --- | 1219 } 1220 return (error); 1221} 1222 1223/* 1224 * cookie layers: 1225 * 1226 * |. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .| --- 151 unchanged lines hidden --- |