1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// src/sys/netinet/tcp_subr.c
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
7 |
|
|
//
|
8 |
|
|
// -------------------------------------------
|
9 |
|
|
//
|
10 |
|
|
// Portions of this software may have been derived from OpenBSD,
|
11 |
|
|
// FreeBSD or other sources, and are covered by the appropriate
|
12 |
|
|
// copyright disclaimers included herein.
|
13 |
|
|
//
|
14 |
|
|
// Portions created by Red Hat are
|
15 |
|
|
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
|
16 |
|
|
//
|
17 |
|
|
// -------------------------------------------
|
18 |
|
|
//
|
19 |
|
|
//####BSDCOPYRIGHTEND####
|
20 |
|
|
//==========================================================================
|
21 |
|
|
|
22 |
|
|
/*
|
23 |
|
|
* Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
|
24 |
|
|
* The Regents of the University of California. All rights reserved.
|
25 |
|
|
*
|
26 |
|
|
* Redistribution and use in source and binary forms, with or without
|
27 |
|
|
* modification, are permitted provided that the following conditions
|
28 |
|
|
* are met:
|
29 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
30 |
|
|
* notice, this list of conditions and the following disclaimer.
|
31 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
32 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
33 |
|
|
* documentation and/or other materials provided with the distribution.
|
34 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
35 |
|
|
* must display the following acknowledgement:
|
36 |
|
|
* This product includes software developed by the University of
|
37 |
|
|
* California, Berkeley and its contributors.
|
38 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
39 |
|
|
* may be used to endorse or promote products derived from this software
|
40 |
|
|
* without specific prior written permission.
|
41 |
|
|
*
|
42 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
43 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
45 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
46 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
47 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
48 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
49 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
50 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
51 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
52 |
|
|
* SUCH DAMAGE.
|
53 |
|
|
*
|
54 |
|
|
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
|
55 |
|
|
* $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.22 2001/08/22 00:59:12 silby Exp $
|
56 |
|
|
*/
|
57 |
|
|
|
58 |
|
|
#include <sys/param.h>
|
59 |
|
|
#include <sys/malloc.h>
|
60 |
|
|
#include <sys/mbuf.h>
|
61 |
|
|
#ifdef INET6
|
62 |
|
|
#include <sys/domain.h>
|
63 |
|
|
#endif
|
64 |
|
|
#include <sys/socket.h>
|
65 |
|
|
#include <sys/socketvar.h>
|
66 |
|
|
#include <sys/protosw.h>
|
67 |
|
|
|
68 |
|
|
#include <net/route.h>
|
69 |
|
|
#include <net/if.h>
|
70 |
|
|
|
71 |
|
|
#define _IP_VHL
|
72 |
|
|
#include <netinet/in.h>
|
73 |
|
|
#include <netinet/in_systm.h>
|
74 |
|
|
#include <netinet/ip.h>
|
75 |
|
|
#ifdef INET6
|
76 |
|
|
#include <netinet/ip6.h>
|
77 |
|
|
#endif
|
78 |
|
|
#include <netinet/in_pcb.h>
|
79 |
|
|
#ifdef INET6
|
80 |
|
|
#include <netinet6/in6_pcb.h>
|
81 |
|
|
#endif
|
82 |
|
|
#include <netinet/in_var.h>
|
83 |
|
|
#include <netinet/ip_var.h>
|
84 |
|
|
#ifdef INET6
|
85 |
|
|
#include <netinet6/ip6_var.h>
|
86 |
|
|
#endif
|
87 |
|
|
#include <netinet/tcp.h>
|
88 |
|
|
#include <netinet/tcp_fsm.h>
|
89 |
|
|
#include <netinet/tcp_seq.h>
|
90 |
|
|
#include <netinet/tcp_timer.h>
|
91 |
|
|
#include <netinet/tcp_var.h>
|
92 |
|
|
#ifdef INET6
|
93 |
|
|
#include <netinet6/tcp6_var.h>
|
94 |
|
|
#include <netinet6/ip6protosw.h>
|
95 |
|
|
#endif
|
96 |
|
|
#include <netinet/tcpip.h>
|
97 |
|
|
#ifdef TCPDEBUG
|
98 |
|
|
#include <netinet/tcp_debug.h>
|
99 |
|
|
#endif
|
100 |
|
|
|
101 |
|
|
#ifdef IPSEC
|
102 |
|
|
#include <netinet6/ipsec.h>
|
103 |
|
|
#endif /*IPSEC*/
|
104 |
|
|
|
105 |
|
|
#include <sys/md5.h>
|
106 |
|
|
|
107 |
|
|
int tcp_mssdflt = TCP_MSS;
|
108 |
|
|
|
109 |
|
|
#ifdef INET6
|
110 |
|
|
int tcp_v6mssdflt = TCP6_MSS;
|
111 |
|
|
#endif
|
112 |
|
|
|
113 |
|
|
#if 0
|
114 |
|
|
static int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
|
115 |
|
|
#endif
|
116 |
|
|
|
117 |
|
|
static int tcp_do_rfc1323 = 1;
|
118 |
|
|
static int tcp_do_rfc1644 = 0;
|
119 |
|
|
static int tcp_tcbhashsize = 0;
|
120 |
|
|
static int do_tcpdrain = 1;
|
121 |
|
|
static int icmp_may_rst = 1;
|
122 |
|
|
static int tcp_strict_rfc1948 = 0;
|
123 |
|
|
static int tcp_isn_reseed_interval = 0;
|
124 |
|
|
static void tcp_cleartaocache __P((void));
|
125 |
|
|
static void tcp_notify __P((struct inpcb *, int));
|
126 |
|
|
|
127 |
|
|
/*
|
128 |
|
|
* Target size of TCP PCB hash tables. Must be a power of two.
|
129 |
|
|
*
|
130 |
|
|
* Note that this can be overridden by the kernel environment
|
131 |
|
|
* variable net.inet.tcp.tcbhashsize
|
132 |
|
|
*/
|
133 |
|
|
#ifndef TCBHASHSIZE
|
134 |
|
|
#define TCBHASHSIZE 512
|
135 |
|
|
#endif
|
136 |
|
|
|
137 |
|
|
/*
|
138 |
|
|
* This is the actual shape of what we allocate using the zone
|
139 |
|
|
* allocator. Doing it this way allows us to protect both structures
|
140 |
|
|
* using the same generation count, and also eliminates the overhead
|
141 |
|
|
* of allocating tcpcbs separately. By hiding the structure here,
|
142 |
|
|
* we avoid changing most of the rest of the code (although it needs
|
143 |
|
|
* to be changed, eventually, for greater efficiency).
|
144 |
|
|
*/
|
145 |
|
|
#define ALIGNMENT 32
|
146 |
|
|
#define ALIGNM1 (ALIGNMENT - 1)
|
147 |
|
|
struct inp_tp {
|
148 |
|
|
union {
|
149 |
|
|
struct inpcb inp;
|
150 |
|
|
char align[(sizeof(struct inpcb) + ALIGNM1) & ~ALIGNM1];
|
151 |
|
|
} inp_tp_u;
|
152 |
|
|
struct tcpcb tcb;
|
153 |
|
|
struct callout inp_tp_rexmt, inp_tp_persist, inp_tp_keep, inp_tp_2msl;
|
154 |
|
|
struct callout inp_tp_delack;
|
155 |
|
|
};
|
156 |
|
|
#undef ALIGNMENT
|
157 |
|
|
#undef ALIGNM1
|
158 |
|
|
|
159 |
|
|
/*
|
160 |
|
|
* Tcp initialization
|
161 |
|
|
*/
|
162 |
|
|
void
|
163 |
|
|
tcp_init()
|
164 |
|
|
{
|
165 |
|
|
int hashsize = TCBHASHSIZE;
|
166 |
|
|
|
167 |
|
|
tcp_ccgen = 1;
|
168 |
|
|
tcp_cleartaocache();
|
169 |
|
|
|
170 |
|
|
tcp_delacktime = TCPTV_DELACK;
|
171 |
|
|
tcp_keepinit = TCPTV_KEEP_INIT;
|
172 |
|
|
tcp_keepidle = TCPTV_KEEP_IDLE;
|
173 |
|
|
tcp_keepintvl = TCPTV_KEEPINTVL;
|
174 |
|
|
tcp_maxpersistidle = TCPTV_KEEP_IDLE;
|
175 |
|
|
tcp_msl = TCPTV_MSL;
|
176 |
|
|
|
177 |
|
|
LIST_INIT(&tcb);
|
178 |
|
|
tcbinfo.listhead = &tcb;
|
179 |
|
|
tcp_tcbhashsize = hashsize;
|
180 |
|
|
tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask);
|
181 |
|
|
tcbinfo.porthashbase = hashinit(hashsize, M_PCB,
|
182 |
|
|
&tcbinfo.porthashmask);
|
183 |
|
|
tcbinfo.ipi_zone = zinit("tcpcb", sizeof(struct inp_tp), maxsockets,
|
184 |
|
|
ZONE_INTERRUPT, 0);
|
185 |
|
|
#ifdef INET6
|
186 |
|
|
#define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr))
|
187 |
|
|
#else /* INET6 */
|
188 |
|
|
#define TCP_MINPROTOHDR (sizeof(struct tcpiphdr))
|
189 |
|
|
#endif /* INET6 */
|
190 |
|
|
if (max_protohdr < TCP_MINPROTOHDR)
|
191 |
|
|
max_protohdr = TCP_MINPROTOHDR;
|
192 |
|
|
if (max_linkhdr + TCP_MINPROTOHDR > MHLEN)
|
193 |
|
|
panic("tcp_init");
|
194 |
|
|
#undef TCP_MINPROTOHDR
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
/*
|
198 |
|
|
* Fill in the IP and TCP headers for an outgoing packet, given the tcpcb.
|
199 |
|
|
* tcp_template used to store this data in mbufs, but we now recopy it out
|
200 |
|
|
* of the tcpcb each time to conserve mbufs.
|
201 |
|
|
*/
|
202 |
|
|
void
|
203 |
|
|
tcp_fillheaders(tp, ip_ptr, tcp_ptr)
|
204 |
|
|
struct tcpcb *tp;
|
205 |
|
|
void *ip_ptr;
|
206 |
|
|
void *tcp_ptr;
|
207 |
|
|
{
|
208 |
|
|
struct inpcb *inp = tp->t_inpcb;
|
209 |
|
|
struct tcphdr *tcp_hdr = (struct tcphdr *)tcp_ptr;
|
210 |
|
|
|
211 |
|
|
#ifdef INET6
|
212 |
|
|
if ((inp->inp_vflag & INP_IPV6) != 0) {
|
213 |
|
|
struct ip6_hdr *ip6;
|
214 |
|
|
|
215 |
|
|
ip6 = (struct ip6_hdr *)ip_ptr;
|
216 |
|
|
ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) |
|
217 |
|
|
(inp->in6p_flowinfo & IPV6_FLOWINFO_MASK);
|
218 |
|
|
ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) |
|
219 |
|
|
(IPV6_VERSION & IPV6_VERSION_MASK);
|
220 |
|
|
ip6->ip6_nxt = IPPROTO_TCP;
|
221 |
|
|
ip6->ip6_plen = sizeof(struct tcphdr);
|
222 |
|
|
ip6->ip6_src = inp->in6p_laddr;
|
223 |
|
|
ip6->ip6_dst = inp->in6p_faddr;
|
224 |
|
|
tcp_hdr->th_sum = 0;
|
225 |
|
|
} else
|
226 |
|
|
#endif
|
227 |
|
|
{
|
228 |
|
|
struct ip *ip = (struct ip *) ip_ptr;
|
229 |
|
|
|
230 |
|
|
ip->ip_vhl = IP_VHL_BORING;
|
231 |
|
|
ip->ip_tos = 0;
|
232 |
|
|
ip->ip_len = 0;
|
233 |
|
|
ip->ip_id = 0;
|
234 |
|
|
ip->ip_off = 0;
|
235 |
|
|
ip->ip_ttl = 0;
|
236 |
|
|
ip->ip_sum = 0;
|
237 |
|
|
ip->ip_p = IPPROTO_TCP;
|
238 |
|
|
ip->ip_src = inp->inp_laddr;
|
239 |
|
|
ip->ip_dst = inp->inp_faddr;
|
240 |
|
|
tcp_hdr->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
|
241 |
|
|
htons(sizeof(struct tcphdr) + IPPROTO_TCP));
|
242 |
|
|
}
|
243 |
|
|
|
244 |
|
|
tcp_hdr->th_sport = inp->inp_lport;
|
245 |
|
|
tcp_hdr->th_dport = inp->inp_fport;
|
246 |
|
|
tcp_hdr->th_seq = 0;
|
247 |
|
|
tcp_hdr->th_ack = 0;
|
248 |
|
|
tcp_hdr->th_x2 = 0;
|
249 |
|
|
tcp_hdr->th_off = 5;
|
250 |
|
|
tcp_hdr->th_flags = 0;
|
251 |
|
|
tcp_hdr->th_win = 0;
|
252 |
|
|
tcp_hdr->th_urp = 0;
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
/*
|
256 |
|
|
* Create template to be used to send tcp packets on a connection.
|
257 |
|
|
* Allocates an mbuf and fills in a skeletal tcp/ip header. The only
|
258 |
|
|
* use for this function is in keepalives, which use tcp_respond.
|
259 |
|
|
*/
|
260 |
|
|
struct tcptemp *
|
261 |
|
|
tcp_maketemplate(tp)
|
262 |
|
|
struct tcpcb *tp;
|
263 |
|
|
{
|
264 |
|
|
struct mbuf *m;
|
265 |
|
|
struct tcptemp *n;
|
266 |
|
|
|
267 |
|
|
m = m_get(M_DONTWAIT, MT_HEADER);
|
268 |
|
|
if (m == NULL)
|
269 |
|
|
return (0);
|
270 |
|
|
m->m_len = sizeof(struct tcptemp);
|
271 |
|
|
n = mtod(m, struct tcptemp *);
|
272 |
|
|
|
273 |
|
|
tcp_fillheaders(tp, (void *)&n->tt_ipgen, (void *)&n->tt_t);
|
274 |
|
|
return (n);
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
/*
|
278 |
|
|
* Send a single message to the TCP at address specified by
|
279 |
|
|
* the given TCP/IP header. If m == 0, then we make a copy
|
280 |
|
|
* of the tcpiphdr at ti and send directly to the addressed host.
|
281 |
|
|
* This is used to force keep alive messages out using the TCP
|
282 |
|
|
* template for a connection. If flags are given then we send
|
283 |
|
|
* a message back to the TCP which originated the * segment ti,
|
284 |
|
|
* and discard the mbuf containing it and any other attached mbufs.
|
285 |
|
|
*
|
286 |
|
|
* In any case the ack and sequence number of the transmitted
|
287 |
|
|
* segment are as specified by the parameters.
|
288 |
|
|
*
|
289 |
|
|
* NOTE: If m != NULL, then ti must point to *inside* the mbuf.
|
290 |
|
|
*/
|
291 |
|
|
void
|
292 |
|
|
tcp_respond(tp, ipgen, th, m, ack, seq, flags)
|
293 |
|
|
struct tcpcb *tp;
|
294 |
|
|
void *ipgen;
|
295 |
|
|
register struct tcphdr *th;
|
296 |
|
|
register struct mbuf *m;
|
297 |
|
|
tcp_seq ack, seq;
|
298 |
|
|
int flags;
|
299 |
|
|
{
|
300 |
|
|
register int tlen;
|
301 |
|
|
int win = 0;
|
302 |
|
|
struct route *ro = 0;
|
303 |
|
|
struct route sro;
|
304 |
|
|
struct ip *ip;
|
305 |
|
|
struct tcphdr *nth;
|
306 |
|
|
#ifdef INET6
|
307 |
|
|
#ifdef NEW_STRUCT_ROUTE
|
308 |
|
|
struct route *ro6 = 0;
|
309 |
|
|
struct route sro6;
|
310 |
|
|
#else
|
311 |
|
|
struct route_in6 *ro6 = 0;
|
312 |
|
|
struct route_in6 sro6;
|
313 |
|
|
#endif
|
314 |
|
|
struct ip6_hdr *ip6;
|
315 |
|
|
int isipv6;
|
316 |
|
|
#endif /* INET6 */
|
317 |
|
|
int ipflags = 0;
|
318 |
|
|
|
319 |
|
|
#ifdef INET6
|
320 |
|
|
isipv6 = IP_VHL_V(((struct ip *)ipgen)->ip_vhl) == 6;
|
321 |
|
|
ip6 = ipgen;
|
322 |
|
|
#endif /* INET6 */
|
323 |
|
|
ip = ipgen;
|
324 |
|
|
|
325 |
|
|
if (tp) {
|
326 |
|
|
if (!(flags & TH_RST)) {
|
327 |
|
|
win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
|
328 |
|
|
if (win > (long)TCP_MAXWIN << tp->rcv_scale)
|
329 |
|
|
win = (long)TCP_MAXWIN << tp->rcv_scale;
|
330 |
|
|
}
|
331 |
|
|
#ifdef INET6
|
332 |
|
|
if (isipv6)
|
333 |
|
|
ro6 = &tp->t_inpcb->in6p_route;
|
334 |
|
|
else
|
335 |
|
|
#endif /* INET6 */
|
336 |
|
|
ro = &tp->t_inpcb->inp_route;
|
337 |
|
|
} else {
|
338 |
|
|
#ifdef INET6
|
339 |
|
|
if (isipv6) {
|
340 |
|
|
ro6 = &sro6;
|
341 |
|
|
bzero(ro6, sizeof *ro6);
|
342 |
|
|
} else
|
343 |
|
|
#endif /* INET6 */
|
344 |
|
|
{
|
345 |
|
|
ro = &sro;
|
346 |
|
|
bzero(ro, sizeof *ro);
|
347 |
|
|
}
|
348 |
|
|
}
|
349 |
|
|
if (m == 0) {
|
350 |
|
|
m = m_gethdr(M_DONTWAIT, MT_HEADER);
|
351 |
|
|
if (m == NULL)
|
352 |
|
|
return;
|
353 |
|
|
tlen = 0;
|
354 |
|
|
m->m_data += max_linkhdr;
|
355 |
|
|
#ifdef INET6
|
356 |
|
|
if (isipv6) {
|
357 |
|
|
bcopy((caddr_t)ip6, mtod(m, caddr_t),
|
358 |
|
|
sizeof(struct ip6_hdr));
|
359 |
|
|
ip6 = mtod(m, struct ip6_hdr *);
|
360 |
|
|
nth = (struct tcphdr *)(ip6 + 1);
|
361 |
|
|
} else
|
362 |
|
|
#endif /* INET6 */
|
363 |
|
|
{
|
364 |
|
|
bcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip));
|
365 |
|
|
ip = mtod(m, struct ip *);
|
366 |
|
|
nth = (struct tcphdr *)(ip + 1);
|
367 |
|
|
}
|
368 |
|
|
bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr));
|
369 |
|
|
flags = TH_ACK;
|
370 |
|
|
} else {
|
371 |
|
|
m_freem(m->m_next);
|
372 |
|
|
m->m_next = 0;
|
373 |
|
|
m->m_data = (caddr_t)ipgen;
|
374 |
|
|
/* m_len is set later */
|
375 |
|
|
tlen = 0;
|
376 |
|
|
#define xchg(a,b,type) { type t; t=a; a=b; b=t; }
|
377 |
|
|
#ifdef INET6
|
378 |
|
|
if (isipv6) {
|
379 |
|
|
xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr);
|
380 |
|
|
nth = (struct tcphdr *)(ip6 + 1);
|
381 |
|
|
} else
|
382 |
|
|
#endif /* INET6 */
|
383 |
|
|
{
|
384 |
|
|
xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, n_long);
|
385 |
|
|
nth = (struct tcphdr *)(ip + 1);
|
386 |
|
|
}
|
387 |
|
|
if (th != nth) {
|
388 |
|
|
/*
|
389 |
|
|
* this is usually a case when an extension header
|
390 |
|
|
* exists between the IPv6 header and the
|
391 |
|
|
* TCP header.
|
392 |
|
|
*/
|
393 |
|
|
nth->th_sport = th->th_sport;
|
394 |
|
|
nth->th_dport = th->th_dport;
|
395 |
|
|
}
|
396 |
|
|
xchg(nth->th_dport, nth->th_sport, n_short);
|
397 |
|
|
#undef xchg
|
398 |
|
|
}
|
399 |
|
|
#ifdef INET6
|
400 |
|
|
if (isipv6) {
|
401 |
|
|
ip6->ip6_plen = htons((u_short)(sizeof (struct tcphdr) +
|
402 |
|
|
tlen));
|
403 |
|
|
tlen += sizeof (struct ip6_hdr) + sizeof (struct tcphdr);
|
404 |
|
|
} else
|
405 |
|
|
#endif
|
406 |
|
|
{
|
407 |
|
|
tlen += sizeof (struct tcpiphdr);
|
408 |
|
|
ip->ip_len = tlen;
|
409 |
|
|
ip->ip_ttl = ip_defttl;
|
410 |
|
|
}
|
411 |
|
|
m->m_len = tlen;
|
412 |
|
|
m->m_pkthdr.len = tlen;
|
413 |
|
|
m->m_pkthdr.rcvif = (struct ifnet *) 0;
|
414 |
|
|
nth->th_seq = htonl(seq);
|
415 |
|
|
nth->th_ack = htonl(ack);
|
416 |
|
|
nth->th_x2 = 0;
|
417 |
|
|
nth->th_off = sizeof (struct tcphdr) >> 2;
|
418 |
|
|
nth->th_flags = flags;
|
419 |
|
|
if (tp)
|
420 |
|
|
nth->th_win = htons((u_short) (win >> tp->rcv_scale));
|
421 |
|
|
else
|
422 |
|
|
nth->th_win = htons((u_short)win);
|
423 |
|
|
nth->th_urp = 0;
|
424 |
|
|
#ifdef INET6
|
425 |
|
|
if (isipv6) {
|
426 |
|
|
nth->th_sum = 0;
|
427 |
|
|
nth->th_sum = in6_cksum(m, IPPROTO_TCP,
|
428 |
|
|
sizeof(struct ip6_hdr),
|
429 |
|
|
tlen - sizeof(struct ip6_hdr));
|
430 |
|
|
ip6->ip6_hlim = in6_selecthlim(tp ? tp->t_inpcb : NULL,
|
431 |
|
|
ro6 && ro6->ro_rt ?
|
432 |
|
|
ro6->ro_rt->rt_ifp :
|
433 |
|
|
NULL);
|
434 |
|
|
} else
|
435 |
|
|
#endif /* INET6 */
|
436 |
|
|
{
|
437 |
|
|
nth->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
|
438 |
|
|
htons((u_short)(tlen - sizeof(struct ip) + ip->ip_p)));
|
439 |
|
|
m->m_pkthdr.csum_flags = CSUM_TCP;
|
440 |
|
|
m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
|
441 |
|
|
}
|
442 |
|
|
#ifdef TCPDEBUG
|
443 |
|
|
if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
|
444 |
|
|
tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
|
445 |
|
|
#endif
|
446 |
|
|
#ifdef IPSEC
|
447 |
|
|
if (ipsec_setsocket(m, tp ? tp->t_inpcb->inp_socket : NULL) != 0) {
|
448 |
|
|
m_freem(m);
|
449 |
|
|
return;
|
450 |
|
|
}
|
451 |
|
|
#endif
|
452 |
|
|
#ifdef INET6
|
453 |
|
|
if (isipv6) {
|
454 |
|
|
(void)ip6_output(m, NULL, ro6, ipflags, NULL, NULL);
|
455 |
|
|
if (ro6 == &sro6 && ro6->ro_rt) {
|
456 |
|
|
RTFREE(ro6->ro_rt);
|
457 |
|
|
ro6->ro_rt = NULL;
|
458 |
|
|
}
|
459 |
|
|
} else
|
460 |
|
|
#endif /* INET6 */
|
461 |
|
|
{
|
462 |
|
|
(void) ip_output(m, NULL, ro, ipflags, NULL);
|
463 |
|
|
if (ro == &sro && ro->ro_rt) {
|
464 |
|
|
RTFREE(ro->ro_rt);
|
465 |
|
|
ro->ro_rt = NULL;
|
466 |
|
|
}
|
467 |
|
|
}
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
/*
|
471 |
|
|
* Create a new TCP control block, making an
|
472 |
|
|
* empty reassembly queue and hooking it to the argument
|
473 |
|
|
* protocol control block. The `inp' parameter must have
|
474 |
|
|
* come from the zone allocator set up in tcp_init().
|
475 |
|
|
*/
|
476 |
|
|
struct tcpcb *
|
477 |
|
|
tcp_newtcpcb(inp)
|
478 |
|
|
struct inpcb *inp;
|
479 |
|
|
{
|
480 |
|
|
struct inp_tp *it;
|
481 |
|
|
register struct tcpcb *tp;
|
482 |
|
|
#ifdef INET6
|
483 |
|
|
int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
|
484 |
|
|
#endif /* INET6 */
|
485 |
|
|
|
486 |
|
|
it = (struct inp_tp *)inp;
|
487 |
|
|
tp = &it->tcb;
|
488 |
|
|
bzero((char *) tp, sizeof(struct tcpcb));
|
489 |
|
|
LIST_INIT(&tp->t_segq);
|
490 |
|
|
tp->t_maxseg = tp->t_maxopd =
|
491 |
|
|
#ifdef INET6
|
492 |
|
|
isipv6 ? tcp_v6mssdflt :
|
493 |
|
|
#endif /* INET6 */
|
494 |
|
|
tcp_mssdflt;
|
495 |
|
|
|
496 |
|
|
/* Set up our timeouts. */
|
497 |
|
|
callout_init(tp->tt_rexmt = &it->inp_tp_rexmt);
|
498 |
|
|
callout_init(tp->tt_persist = &it->inp_tp_persist);
|
499 |
|
|
callout_init(tp->tt_keep = &it->inp_tp_keep);
|
500 |
|
|
callout_init(tp->tt_2msl = &it->inp_tp_2msl);
|
501 |
|
|
callout_init(tp->tt_delack = &it->inp_tp_delack);
|
502 |
|
|
|
503 |
|
|
if (tcp_do_rfc1323)
|
504 |
|
|
tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);
|
505 |
|
|
if (tcp_do_rfc1644)
|
506 |
|
|
tp->t_flags |= TF_REQ_CC;
|
507 |
|
|
tp->t_inpcb = inp; /* XXX */
|
508 |
|
|
/*
|
509 |
|
|
* Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
|
510 |
|
|
* rtt estimate. Set rttvar so that srtt + 4 * rttvar gives
|
511 |
|
|
* reasonable initial retransmit time.
|
512 |
|
|
*/
|
513 |
|
|
tp->t_srtt = TCPTV_SRTTBASE;
|
514 |
|
|
tp->t_rttvar = ((TCPTV_RTOBASE - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4;
|
515 |
|
|
tp->t_rttmin = TCPTV_MIN;
|
516 |
|
|
tp->t_rxtcur = TCPTV_RTOBASE;
|
517 |
|
|
tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
|
518 |
|
|
tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT;
|
519 |
|
|
tp->t_rcvtime = ticks;
|
520 |
|
|
/*
|
521 |
|
|
* IPv4 TTL initialization is necessary for an IPv6 socket as well,
|
522 |
|
|
* because the socket may be bound to an IPv6 wildcard address,
|
523 |
|
|
* which may match an IPv4-mapped IPv6 address.
|
524 |
|
|
*/
|
525 |
|
|
inp->inp_ip_ttl = ip_defttl;
|
526 |
|
|
inp->inp_ppcb = (caddr_t)tp;
|
527 |
|
|
return (tp); /* XXX */
|
528 |
|
|
}
|
529 |
|
|
|
530 |
|
|
/*
|
531 |
|
|
* Drop a TCP connection, reporting
|
532 |
|
|
* the specified error. If connection is synchronized,
|
533 |
|
|
* then send a RST to peer.
|
534 |
|
|
*/
|
535 |
|
|
struct tcpcb *
|
536 |
|
|
tcp_drop(tp, _errno)
|
537 |
|
|
register struct tcpcb *tp;
|
538 |
|
|
int _errno;
|
539 |
|
|
{
|
540 |
|
|
struct socket *so = tp->t_inpcb->inp_socket;
|
541 |
|
|
|
542 |
|
|
if (TCPS_HAVERCVDSYN(tp->t_state)) {
|
543 |
|
|
tp->t_state = TCPS_CLOSED;
|
544 |
|
|
(void) tcp_output(tp);
|
545 |
|
|
tcpstat.tcps_drops++;
|
546 |
|
|
} else
|
547 |
|
|
tcpstat.tcps_conndrops++;
|
548 |
|
|
if (_errno == ETIMEDOUT && tp->t_softerror)
|
549 |
|
|
_errno = tp->t_softerror;
|
550 |
|
|
so->so_error = _errno;
|
551 |
|
|
return (tcp_close(tp));
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
/*
|
555 |
|
|
* Close a TCP control block:
|
556 |
|
|
* discard all space held by the tcp
|
557 |
|
|
* discard internet protocol block
|
558 |
|
|
* wake up any sleepers
|
559 |
|
|
*/
|
560 |
|
|
struct tcpcb *
|
561 |
|
|
tcp_close(tp)
|
562 |
|
|
register struct tcpcb *tp;
|
563 |
|
|
{
|
564 |
|
|
register struct tseg_qent *q;
|
565 |
|
|
struct inpcb *inp = tp->t_inpcb;
|
566 |
|
|
struct socket *so = inp->inp_socket;
|
567 |
|
|
#ifdef INET6
|
568 |
|
|
int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
|
569 |
|
|
#endif /* INET6 */
|
570 |
|
|
register struct rtentry *rt;
|
571 |
|
|
int dosavessthresh;
|
572 |
|
|
|
573 |
|
|
/*
|
574 |
|
|
* Make sure that all of our timers are stopped before we
|
575 |
|
|
* delete the PCB.
|
576 |
|
|
*/
|
577 |
|
|
callout_stop(tp->tt_rexmt);
|
578 |
|
|
callout_stop(tp->tt_persist);
|
579 |
|
|
callout_stop(tp->tt_keep);
|
580 |
|
|
callout_stop(tp->tt_2msl);
|
581 |
|
|
callout_stop(tp->tt_delack);
|
582 |
|
|
|
583 |
|
|
/*
|
584 |
|
|
* If we got enough samples through the srtt filter,
|
585 |
|
|
* save the rtt and rttvar in the routing entry.
|
586 |
|
|
* 'Enough' is arbitrarily defined as the 16 samples.
|
587 |
|
|
* 16 samples is enough for the srtt filter to converge
|
588 |
|
|
* to within 5% of the correct value; fewer samples and
|
589 |
|
|
* we could save a very bogus rtt.
|
590 |
|
|
*
|
591 |
|
|
* Don't update the default route's characteristics and don't
|
592 |
|
|
* update anything that the user "locked".
|
593 |
|
|
*/
|
594 |
|
|
if (tp->t_rttupdated >= 16) {
|
595 |
|
|
register u_long i = 0;
|
596 |
|
|
#ifdef INET6
|
597 |
|
|
if (isipv6) {
|
598 |
|
|
struct sockaddr_in6 *sin6;
|
599 |
|
|
|
600 |
|
|
if ((rt = inp->in6p_route.ro_rt) == NULL)
|
601 |
|
|
goto no_valid_rt;
|
602 |
|
|
sin6 = (struct sockaddr_in6 *)rt_key(rt);
|
603 |
|
|
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
|
604 |
|
|
goto no_valid_rt;
|
605 |
|
|
}
|
606 |
|
|
else
|
607 |
|
|
#endif /* INET6 */
|
608 |
|
|
if ((rt = inp->inp_route.ro_rt) == NULL ||
|
609 |
|
|
((struct sockaddr_in *)rt_key(rt))->sin_addr.s_addr
|
610 |
|
|
== INADDR_ANY)
|
611 |
|
|
goto no_valid_rt;
|
612 |
|
|
|
613 |
|
|
if ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0) {
|
614 |
|
|
i = tp->t_srtt *
|
615 |
|
|
(RTM_RTTUNIT / (hz * TCP_RTT_SCALE));
|
616 |
|
|
if (rt->rt_rmx.rmx_rtt && i)
|
617 |
|
|
/*
|
618 |
|
|
* filter this update to half the old & half
|
619 |
|
|
* the new values, converting scale.
|
620 |
|
|
* See route.h and tcp_var.h for a
|
621 |
|
|
* description of the scaling constants.
|
622 |
|
|
*/
|
623 |
|
|
rt->rt_rmx.rmx_rtt =
|
624 |
|
|
(rt->rt_rmx.rmx_rtt + i) / 2;
|
625 |
|
|
else
|
626 |
|
|
rt->rt_rmx.rmx_rtt = i;
|
627 |
|
|
tcpstat.tcps_cachedrtt++;
|
628 |
|
|
}
|
629 |
|
|
if ((rt->rt_rmx.rmx_locks & RTV_RTTVAR) == 0) {
|
630 |
|
|
i = tp->t_rttvar *
|
631 |
|
|
(RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE));
|
632 |
|
|
if (rt->rt_rmx.rmx_rttvar && i)
|
633 |
|
|
rt->rt_rmx.rmx_rttvar =
|
634 |
|
|
(rt->rt_rmx.rmx_rttvar + i) / 2;
|
635 |
|
|
else
|
636 |
|
|
rt->rt_rmx.rmx_rttvar = i;
|
637 |
|
|
tcpstat.tcps_cachedrttvar++;
|
638 |
|
|
}
|
639 |
|
|
/*
|
640 |
|
|
* The old comment here said:
|
641 |
|
|
* update the pipelimit (ssthresh) if it has been updated
|
642 |
|
|
* already or if a pipesize was specified & the threshhold
|
643 |
|
|
* got below half the pipesize. I.e., wait for bad news
|
644 |
|
|
* before we start updating, then update on both good
|
645 |
|
|
* and bad news.
|
646 |
|
|
*
|
647 |
|
|
* But we want to save the ssthresh even if no pipesize is
|
648 |
|
|
* specified explicitly in the route, because such
|
649 |
|
|
* connections still have an implicit pipesize specified
|
650 |
|
|
* by the global tcp_sendspace. In the absence of a reliable
|
651 |
|
|
* way to calculate the pipesize, it will have to do.
|
652 |
|
|
*/
|
653 |
|
|
i = tp->snd_ssthresh;
|
654 |
|
|
if (rt->rt_rmx.rmx_sendpipe != 0)
|
655 |
|
|
dosavessthresh = (i < rt->rt_rmx.rmx_sendpipe / 2);
|
656 |
|
|
else
|
657 |
|
|
dosavessthresh = (i < so->so_snd.sb_hiwat / 2);
|
658 |
|
|
if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 &&
|
659 |
|
|
i != 0 && rt->rt_rmx.rmx_ssthresh != 0)
|
660 |
|
|
|| dosavessthresh) {
|
661 |
|
|
/*
|
662 |
|
|
* convert the limit from user data bytes to
|
663 |
|
|
* packets then to packet data bytes.
|
664 |
|
|
*/
|
665 |
|
|
i = (i + tp->t_maxseg / 2) / tp->t_maxseg;
|
666 |
|
|
if (i < 2)
|
667 |
|
|
i = 2;
|
668 |
|
|
i *= (u_long)(tp->t_maxseg +
|
669 |
|
|
#ifdef INET6
|
670 |
|
|
(isipv6 ? sizeof (struct ip6_hdr) +
|
671 |
|
|
sizeof (struct tcphdr) :
|
672 |
|
|
#endif
|
673 |
|
|
sizeof (struct tcpiphdr)
|
674 |
|
|
#ifdef INET6
|
675 |
|
|
)
|
676 |
|
|
#endif
|
677 |
|
|
);
|
678 |
|
|
if (rt->rt_rmx.rmx_ssthresh)
|
679 |
|
|
rt->rt_rmx.rmx_ssthresh =
|
680 |
|
|
(rt->rt_rmx.rmx_ssthresh + i) / 2;
|
681 |
|
|
else
|
682 |
|
|
rt->rt_rmx.rmx_ssthresh = i;
|
683 |
|
|
tcpstat.tcps_cachedssthresh++;
|
684 |
|
|
}
|
685 |
|
|
}
|
686 |
|
|
rt = inp->inp_route.ro_rt;
|
687 |
|
|
if (rt) {
|
688 |
|
|
/*
|
689 |
|
|
* mark route for deletion if no information is
|
690 |
|
|
* cached.
|
691 |
|
|
*/
|
692 |
|
|
if ((tp->t_flags & TF_LQ_OVERFLOW) &&
|
693 |
|
|
((rt->rt_rmx.rmx_locks & RTV_RTT) == 0)){
|
694 |
|
|
if (rt->rt_rmx.rmx_rtt == 0)
|
695 |
|
|
rt->rt_flags |= RTF_DELCLONE;
|
696 |
|
|
}
|
697 |
|
|
}
|
698 |
|
|
no_valid_rt:
|
699 |
|
|
/* free the reassembly queue, if any */
|
700 |
|
|
while((q = LIST_FIRST(&tp->t_segq)) != NULL) {
|
701 |
|
|
LIST_REMOVE(q, tqe_q);
|
702 |
|
|
m_freem(q->tqe_m);
|
703 |
|
|
FREE(q, M_TSEGQ);
|
704 |
|
|
}
|
705 |
|
|
inp->inp_ppcb = NULL;
|
706 |
|
|
soisdisconnected(so);
|
707 |
|
|
#ifdef INET6
|
708 |
|
|
if (INP_CHECK_SOCKAF(so, AF_INET6))
|
709 |
|
|
in6_pcbdetach(inp);
|
710 |
|
|
else
|
711 |
|
|
#endif /* INET6 */
|
712 |
|
|
in_pcbdetach(inp);
|
713 |
|
|
tcpstat.tcps_closed++;
|
714 |
|
|
return ((struct tcpcb *)0);
|
715 |
|
|
}
|
716 |
|
|
|
717 |
|
|
void
|
718 |
|
|
tcp_drain()
|
719 |
|
|
{
|
720 |
|
|
if (do_tcpdrain)
|
721 |
|
|
{
|
722 |
|
|
struct inpcb *inpb;
|
723 |
|
|
struct tcpcb *tcpb;
|
724 |
|
|
struct tseg_qent *te;
|
725 |
|
|
|
726 |
|
|
/*
|
727 |
|
|
* Walk the tcpbs, if existing, and flush the reassembly queue,
|
728 |
|
|
* if there is one...
|
729 |
|
|
* XXX: The "Net/3" implementation doesn't imply that the TCP
|
730 |
|
|
* reassembly queue should be flushed, but in a situation
|
731 |
|
|
* where we're really low on mbufs, this is potentially
|
732 |
|
|
* usefull.
|
733 |
|
|
*/
|
734 |
|
|
for (inpb = LIST_FIRST(tcbinfo.listhead); inpb;
|
735 |
|
|
inpb = LIST_NEXT(inpb, inp_list)) {
|
736 |
|
|
if ((tcpb = intotcpcb(inpb))) {
|
737 |
|
|
while ((te = LIST_FIRST(&tcpb->t_segq))
|
738 |
|
|
!= NULL) {
|
739 |
|
|
LIST_REMOVE(te, tqe_q);
|
740 |
|
|
m_freem(te->tqe_m);
|
741 |
|
|
FREE(te, M_TSEGQ);
|
742 |
|
|
}
|
743 |
|
|
}
|
744 |
|
|
}
|
745 |
|
|
|
746 |
|
|
}
|
747 |
|
|
}
|
748 |
|
|
|
749 |
|
|
/*
|
750 |
|
|
* Notify a tcp user of an asynchronous error;
|
751 |
|
|
* store error as soft error, but wake up user
|
752 |
|
|
* (for now, won't do anything until can select for soft error).
|
753 |
|
|
*
|
754 |
|
|
* Do not wake up user since there currently is no mechanism for
|
755 |
|
|
* reporting soft errors (yet - a kqueue filter may be added).
|
756 |
|
|
*/
|
757 |
|
|
static void
|
758 |
|
|
tcp_notify(inp, error)
|
759 |
|
|
struct inpcb *inp;
|
760 |
|
|
int error;
|
761 |
|
|
{
|
762 |
|
|
struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb;
|
763 |
|
|
|
764 |
|
|
/*
|
765 |
|
|
* Ignore some errors if we are hooked up.
|
766 |
|
|
* If connection hasn't completed, has retransmitted several times,
|
767 |
|
|
* and receives a second error, give up now. This is better
|
768 |
|
|
* than waiting a long time to establish a connection that
|
769 |
|
|
* can never complete.
|
770 |
|
|
*/
|
771 |
|
|
if (tp->t_state == TCPS_ESTABLISHED &&
|
772 |
|
|
(error == EHOSTUNREACH || error == ENETUNREACH ||
|
773 |
|
|
error == EHOSTDOWN)) {
|
774 |
|
|
return;
|
775 |
|
|
} else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 &&
|
776 |
|
|
tp->t_softerror)
|
777 |
|
|
tcp_drop(tp, error);
|
778 |
|
|
else
|
779 |
|
|
tp->t_softerror = error;
|
780 |
|
|
#if 0
|
781 |
|
|
wakeup((caddr_t) &so->so_timeo);
|
782 |
|
|
sorwakeup(so);
|
783 |
|
|
sowwakeup(so);
|
784 |
|
|
#endif
|
785 |
|
|
}
|
786 |
|
|
|
787 |
|
|
void
|
788 |
|
|
tcp_ctlinput(cmd, sa, vip)
|
789 |
|
|
int cmd;
|
790 |
|
|
struct sockaddr *sa;
|
791 |
|
|
void *vip;
|
792 |
|
|
{
|
793 |
|
|
struct ip *ip = vip;
|
794 |
|
|
struct tcphdr *th;
|
795 |
|
|
struct in_addr faddr;
|
796 |
|
|
struct inpcb *inp;
|
797 |
|
|
struct tcpcb *tp;
|
798 |
|
|
void (*notify) __P((struct inpcb *, int)) = tcp_notify;
|
799 |
|
|
tcp_seq icmp_seq;
|
800 |
|
|
int s;
|
801 |
|
|
|
802 |
|
|
faddr = ((struct sockaddr_in *)sa)->sin_addr;
|
803 |
|
|
if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
|
804 |
|
|
return;
|
805 |
|
|
|
806 |
|
|
if (cmd == PRC_QUENCH)
|
807 |
|
|
notify = tcp_quench;
|
808 |
|
|
else if (icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
|
809 |
|
|
cmd == PRC_UNREACH_PORT) && ip)
|
810 |
|
|
notify = tcp_drop_syn_sent;
|
811 |
|
|
else if (cmd == PRC_MSGSIZE)
|
812 |
|
|
notify = tcp_mtudisc;
|
813 |
|
|
else if (PRC_IS_REDIRECT(cmd)) {
|
814 |
|
|
ip = 0;
|
815 |
|
|
notify = in_rtchange;
|
816 |
|
|
} else if (cmd == PRC_HOSTDEAD)
|
817 |
|
|
ip = 0;
|
818 |
|
|
else if ((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0)
|
819 |
|
|
return;
|
820 |
|
|
if (ip) {
|
821 |
|
|
s = splnet();
|
822 |
|
|
th = (struct tcphdr *)((caddr_t)ip
|
823 |
|
|
+ (IP_VHL_HL(ip->ip_vhl) << 2));
|
824 |
|
|
inp = in_pcblookup_hash(&tcbinfo, faddr, th->th_dport,
|
825 |
|
|
ip->ip_src, th->th_sport, 0, NULL);
|
826 |
|
|
if (inp != NULL && inp->inp_socket != NULL) {
|
827 |
|
|
icmp_seq = htonl(th->th_seq);
|
828 |
|
|
tp = intotcpcb(inp);
|
829 |
|
|
if (SEQ_GEQ(icmp_seq, tp->snd_una) &&
|
830 |
|
|
SEQ_LT(icmp_seq, tp->snd_max))
|
831 |
|
|
(*notify)(inp, inetctlerrmap[cmd]);
|
832 |
|
|
}
|
833 |
|
|
splx(s);
|
834 |
|
|
} else
|
835 |
|
|
in_pcbnotifyall(&tcb, faddr, inetctlerrmap[cmd], notify);
|
836 |
|
|
}
|
837 |
|
|
|
838 |
|
|
#ifdef INET6
|
839 |
|
|
void
|
840 |
|
|
tcp6_ctlinput(cmd, sa, d)
|
841 |
|
|
int cmd;
|
842 |
|
|
struct sockaddr *sa;
|
843 |
|
|
void *d;
|
844 |
|
|
{
|
845 |
|
|
struct tcphdr th;
|
846 |
|
|
void (*notify) __P((struct inpcb *, int)) = tcp_notify;
|
847 |
|
|
struct ip6_hdr *ip6;
|
848 |
|
|
struct mbuf *m;
|
849 |
|
|
struct ip6ctlparam *ip6cp = NULL;
|
850 |
|
|
const struct sockaddr_in6 *sa6_src = NULL;
|
851 |
|
|
int off;
|
852 |
|
|
struct tcp_portonly {
|
853 |
|
|
u_int16_t th_sport;
|
854 |
|
|
u_int16_t th_dport;
|
855 |
|
|
} *thp;
|
856 |
|
|
|
857 |
|
|
if (sa->sa_family != AF_INET6 ||
|
858 |
|
|
sa->sa_len != sizeof(struct sockaddr_in6))
|
859 |
|
|
return;
|
860 |
|
|
|
861 |
|
|
if (cmd == PRC_QUENCH)
|
862 |
|
|
notify = tcp_quench;
|
863 |
|
|
else if (cmd == PRC_MSGSIZE)
|
864 |
|
|
notify = tcp_mtudisc;
|
865 |
|
|
else if (!PRC_IS_REDIRECT(cmd) &&
|
866 |
|
|
((unsigned)cmd > PRC_NCMDS || inet6ctlerrmap[cmd] == 0))
|
867 |
|
|
return;
|
868 |
|
|
|
869 |
|
|
/* if the parameter is from icmp6, decode it. */
|
870 |
|
|
if (d != NULL) {
|
871 |
|
|
ip6cp = (struct ip6ctlparam *)d;
|
872 |
|
|
m = ip6cp->ip6c_m;
|
873 |
|
|
ip6 = ip6cp->ip6c_ip6;
|
874 |
|
|
off = ip6cp->ip6c_off;
|
875 |
|
|
sa6_src = ip6cp->ip6c_src;
|
876 |
|
|
} else {
|
877 |
|
|
m = NULL;
|
878 |
|
|
ip6 = NULL;
|
879 |
|
|
off = 0; /* fool gcc */
|
880 |
|
|
sa6_src = &sa6_any;
|
881 |
|
|
}
|
882 |
|
|
|
883 |
|
|
if (ip6) {
|
884 |
|
|
/*
|
885 |
|
|
* XXX: We assume that when IPV6 is non NULL,
|
886 |
|
|
* M and OFF are valid.
|
887 |
|
|
*/
|
888 |
|
|
|
889 |
|
|
/* check if we can safely examine src and dst ports */
|
890 |
|
|
if (m->m_pkthdr.len < off + sizeof(*thp))
|
891 |
|
|
return;
|
892 |
|
|
|
893 |
|
|
bzero(&th, sizeof(th));
|
894 |
|
|
m_copydata(m, off, sizeof(*thp), (caddr_t)&th);
|
895 |
|
|
|
896 |
|
|
in6_pcbnotify(&tcb, sa, th.th_dport,
|
897 |
|
|
(struct sockaddr *)ip6cp->ip6c_src,
|
898 |
|
|
th.th_sport, cmd, NULL, notify);
|
899 |
|
|
} else
|
900 |
|
|
in6_pcbnotify(&tcb, sa, 0, (struct sockaddr *)sa6_src,
|
901 |
|
|
0, cmd, NULL, notify);
|
902 |
|
|
}
|
903 |
|
|
#endif /* INET6 */
|
904 |
|
|
|
905 |
|
|
/*
|
906 |
|
|
* Following is where TCP initial sequence number generation occurs.
|
907 |
|
|
*
|
908 |
|
|
* There are two places where we must use initial sequence numbers:
|
909 |
|
|
* 1. In SYN-ACK packets.
|
910 |
|
|
* 2. In SYN packets.
|
911 |
|
|
*
|
912 |
|
|
* The ISNs in SYN-ACK packets have no monotonicity requirement,
|
913 |
|
|
* and should be as unpredictable as possible to avoid the possibility
|
914 |
|
|
* of spoofing and/or connection hijacking. To satisfy this
|
915 |
|
|
* requirement, SYN-ACK ISNs are generated via the arc4random()
|
916 |
|
|
* function. If exact RFC 1948 compliance is requested via sysctl,
|
917 |
|
|
* these ISNs will be generated just like those in SYN packets.
|
918 |
|
|
*
|
919 |
|
|
* The ISNs in SYN packets must be monotonic; TIME_WAIT recycling
|
920 |
|
|
* depends on this property. In addition, these ISNs should be
|
921 |
|
|
* unguessable so as to prevent connection hijacking. To satisfy
|
922 |
|
|
* the requirements of this situation, the algorithm outlined in
|
923 |
|
|
* RFC 1948 is used to generate sequence numbers.
|
924 |
|
|
*
|
925 |
|
|
* For more information on the theory of operation, please see
|
926 |
|
|
* RFC 1948.
|
927 |
|
|
*
|
928 |
|
|
* Implementation details:
|
929 |
|
|
*
|
930 |
|
|
* Time is based off the system timer, and is corrected so that it
|
931 |
|
|
* increases by one megabyte per second. This allows for proper
|
932 |
|
|
* recycling on high speed LANs while still leaving over an hour
|
933 |
|
|
* before rollover.
|
934 |
|
|
*
|
935 |
|
|
* Two sysctls control the generation of ISNs:
|
936 |
|
|
*
|
937 |
|
|
* net.inet.tcp.isn_reseed_interval controls the number of seconds
|
938 |
|
|
* between seeding of isn_secret. This is normally set to zero,
|
939 |
|
|
* as reseeding should not be necessary.
|
940 |
|
|
*
|
941 |
|
|
* net.inet.tcp.strict_rfc1948 controls whether RFC 1948 is followed
|
942 |
|
|
* strictly. When strict compliance is requested, reseeding is
|
943 |
|
|
* disabled and SYN-ACKs will be generated in the same manner as
|
944 |
|
|
* SYNs. Strict mode is disabled by default.
|
945 |
|
|
*
|
946 |
|
|
*/
|
947 |
|
|
|
948 |
|
|
#define ISN_BYTES_PER_SECOND 1048576
|
949 |
|
|
|
950 |
|
|
u_char isn_secret[32];
|
951 |
|
|
int isn_last_reseed;
|
952 |
|
|
MD5_CTX isn_ctx;
|
953 |
|
|
|
954 |
|
|
tcp_seq
|
955 |
|
|
tcp_new_isn(tp)
|
956 |
|
|
struct tcpcb *tp;
|
957 |
|
|
{
|
958 |
|
|
u_int32_t md5_buffer[4];
|
959 |
|
|
tcp_seq new_isn;
|
960 |
|
|
|
961 |
|
|
/* Use arc4random for SYN-ACKs when not in exact RFC1948 mode. */
|
962 |
|
|
if (((tp->t_state == TCPS_LISTEN) || (tp->t_state == TCPS_TIME_WAIT))
|
963 |
|
|
&& tcp_strict_rfc1948 == 0)
|
964 |
|
|
return arc4random();
|
965 |
|
|
|
966 |
|
|
/* Seed if this is the first use, reseed if requested. */
|
967 |
|
|
if ((isn_last_reseed == 0) ||
|
968 |
|
|
((tcp_strict_rfc1948 == 0) && (tcp_isn_reseed_interval > 0) &&
|
969 |
|
|
(((u_int)isn_last_reseed + (u_int)tcp_isn_reseed_interval*hz)
|
970 |
|
|
< (u_int)ticks))) {
|
971 |
|
|
read_random_unlimited(&isn_secret, sizeof(isn_secret));
|
972 |
|
|
isn_last_reseed = ticks;
|
973 |
|
|
}
|
974 |
|
|
|
975 |
|
|
/* Compute the md5 hash and return the ISN. */
|
976 |
|
|
MD5Init(&isn_ctx);
|
977 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_fport, sizeof(u_short));
|
978 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_lport, sizeof(u_short));
|
979 |
|
|
#ifdef INET6
|
980 |
|
|
if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) {
|
981 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_faddr,
|
982 |
|
|
sizeof(struct in6_addr));
|
983 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_laddr,
|
984 |
|
|
sizeof(struct in6_addr));
|
985 |
|
|
} else
|
986 |
|
|
#endif
|
987 |
|
|
{
|
988 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_faddr,
|
989 |
|
|
sizeof(struct in_addr));
|
990 |
|
|
MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_laddr,
|
991 |
|
|
sizeof(struct in_addr));
|
992 |
|
|
}
|
993 |
|
|
MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret));
|
994 |
|
|
MD5Final((u_char *) &md5_buffer, &isn_ctx);
|
995 |
|
|
new_isn = (tcp_seq) md5_buffer[0];
|
996 |
|
|
new_isn += ticks * (ISN_BYTES_PER_SECOND / hz);
|
997 |
|
|
return new_isn;
|
998 |
|
|
}
|
999 |
|
|
|
1000 |
|
|
/*
|
1001 |
|
|
* When a source quench is received, close congestion window
|
1002 |
|
|
* to one segment. We will gradually open it again as we proceed.
|
1003 |
|
|
*/
|
1004 |
|
|
void
|
1005 |
|
|
tcp_quench(inp, _errno)
|
1006 |
|
|
struct inpcb *inp;
|
1007 |
|
|
int _errno;
|
1008 |
|
|
{
|
1009 |
|
|
struct tcpcb *tp = intotcpcb(inp);
|
1010 |
|
|
|
1011 |
|
|
if (tp)
|
1012 |
|
|
tp->snd_cwnd = tp->t_maxseg;
|
1013 |
|
|
}
|
1014 |
|
|
|
1015 |
|
|
/*
|
1016 |
|
|
* When a specific ICMP unreachable message is received and the
|
1017 |
|
|
* connection state is SYN-SENT, drop the connection. This behavior
|
1018 |
|
|
* is controlled by the icmp_may_rst sysctl.
|
1019 |
|
|
*/
|
1020 |
|
|
void
|
1021 |
|
|
tcp_drop_syn_sent(inp, _errno)
|
1022 |
|
|
struct inpcb *inp;
|
1023 |
|
|
int _errno;
|
1024 |
|
|
{
|
1025 |
|
|
struct tcpcb *tp = intotcpcb(inp);
|
1026 |
|
|
|
1027 |
|
|
if (tp && tp->t_state == TCPS_SYN_SENT)
|
1028 |
|
|
tcp_drop(tp, _errno);
|
1029 |
|
|
}
|
1030 |
|
|
|
1031 |
|
|
/*
|
1032 |
|
|
* When `need fragmentation' ICMP is received, update our idea of the MSS
|
1033 |
|
|
* based on the new value in the route. Also nudge TCP to send something,
|
1034 |
|
|
* since we know the packet we just sent was dropped.
|
1035 |
|
|
* This duplicates some code in the tcp_mss() function in tcp_input.c.
|
1036 |
|
|
*/
|
1037 |
|
|
void
|
1038 |
|
|
tcp_mtudisc(inp, _errno)
|
1039 |
|
|
struct inpcb *inp;
|
1040 |
|
|
int _errno;
|
1041 |
|
|
{
|
1042 |
|
|
struct tcpcb *tp = intotcpcb(inp);
|
1043 |
|
|
struct rtentry *rt;
|
1044 |
|
|
struct rmxp_tao *taop;
|
1045 |
|
|
struct socket *so = inp->inp_socket;
|
1046 |
|
|
int offered;
|
1047 |
|
|
int mss;
|
1048 |
|
|
#ifdef INET6
|
1049 |
|
|
int isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0;
|
1050 |
|
|
#endif /* INET6 */
|
1051 |
|
|
|
1052 |
|
|
if (tp) {
|
1053 |
|
|
#ifdef INET6
|
1054 |
|
|
if (isipv6)
|
1055 |
|
|
rt = tcp_rtlookup6(inp);
|
1056 |
|
|
else
|
1057 |
|
|
#endif /* INET6 */
|
1058 |
|
|
rt = tcp_rtlookup(inp);
|
1059 |
|
|
if (!rt || !rt->rt_rmx.rmx_mtu) {
|
1060 |
|
|
tp->t_maxopd = tp->t_maxseg =
|
1061 |
|
|
#ifdef INET6
|
1062 |
|
|
isipv6 ? tcp_v6mssdflt :
|
1063 |
|
|
#endif /* INET6 */
|
1064 |
|
|
tcp_mssdflt;
|
1065 |
|
|
return;
|
1066 |
|
|
}
|
1067 |
|
|
taop = rmx_taop(rt->rt_rmx);
|
1068 |
|
|
offered = taop->tao_mssopt;
|
1069 |
|
|
mss = rt->rt_rmx.rmx_mtu -
|
1070 |
|
|
#ifdef INET6
|
1071 |
|
|
(isipv6 ?
|
1072 |
|
|
sizeof(struct ip6_hdr) + sizeof(struct tcphdr) :
|
1073 |
|
|
#endif /* INET6 */
|
1074 |
|
|
sizeof(struct tcpiphdr)
|
1075 |
|
|
#ifdef INET6
|
1076 |
|
|
)
|
1077 |
|
|
#endif /* INET6 */
|
1078 |
|
|
;
|
1079 |
|
|
|
1080 |
|
|
if (offered)
|
1081 |
|
|
mss = min(mss, offered);
|
1082 |
|
|
/*
|
1083 |
|
|
* XXX - The above conditional probably violates the TCP
|
1084 |
|
|
* spec. The problem is that, since we don't know the
|
1085 |
|
|
* other end's MSS, we are supposed to use a conservative
|
1086 |
|
|
* default. But, if we do that, then MTU discovery will
|
1087 |
|
|
* never actually take place, because the conservative
|
1088 |
|
|
* default is much less than the MTUs typically seen
|
1089 |
|
|
* on the Internet today. For the moment, we'll sweep
|
1090 |
|
|
* this under the carpet.
|
1091 |
|
|
*
|
1092 |
|
|
* The conservative default might not actually be a problem
|
1093 |
|
|
* if the only case this occurs is when sending an initial
|
1094 |
|
|
* SYN with options and data to a host we've never talked
|
1095 |
|
|
* to before. Then, they will reply with an MSS value which
|
1096 |
|
|
* will get recorded and the new parameters should get
|
1097 |
|
|
* recomputed. For Further Study.
|
1098 |
|
|
*/
|
1099 |
|
|
if (tp->t_maxopd <= mss)
|
1100 |
|
|
return;
|
1101 |
|
|
tp->t_maxopd = mss;
|
1102 |
|
|
|
1103 |
|
|
if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
|
1104 |
|
|
(tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)
|
1105 |
|
|
mss -= TCPOLEN_TSTAMP_APPA;
|
1106 |
|
|
if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC &&
|
1107 |
|
|
(tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC)
|
1108 |
|
|
mss -= TCPOLEN_CC_APPA;
|
1109 |
|
|
#if (MCLBYTES & (MCLBYTES - 1)) == 0
|
1110 |
|
|
if (mss > MCLBYTES)
|
1111 |
|
|
mss &= ~(MCLBYTES-1);
|
1112 |
|
|
#else
|
1113 |
|
|
if (mss > MCLBYTES)
|
1114 |
|
|
mss = mss / MCLBYTES * MCLBYTES;
|
1115 |
|
|
#endif
|
1116 |
|
|
if (so->so_snd.sb_hiwat < mss)
|
1117 |
|
|
mss = so->so_snd.sb_hiwat;
|
1118 |
|
|
|
1119 |
|
|
tp->t_maxseg = mss;
|
1120 |
|
|
|
1121 |
|
|
tcpstat.tcps_mturesent++;
|
1122 |
|
|
tp->t_rtttime = 0;
|
1123 |
|
|
tp->snd_nxt = tp->snd_una;
|
1124 |
|
|
tcp_output(tp);
|
1125 |
|
|
}
|
1126 |
|
|
}
|
1127 |
|
|
|
1128 |
|
|
/*
|
1129 |
|
|
* Look-up the routing entry to the peer of this inpcb. If no route
|
1130 |
|
|
* is found and it cannot be allocated the return NULL. This routine
|
1131 |
|
|
* is called by TCP routines that access the rmx structure and by tcp_mss
|
1132 |
|
|
* to get the interface MTU.
|
1133 |
|
|
*/
|
1134 |
|
|
struct rtentry *
|
1135 |
|
|
tcp_rtlookup(inp)
|
1136 |
|
|
struct inpcb *inp;
|
1137 |
|
|
{
|
1138 |
|
|
struct route *ro;
|
1139 |
|
|
struct rtentry *rt;
|
1140 |
|
|
|
1141 |
|
|
ro = &inp->inp_route;
|
1142 |
|
|
rt = ro->ro_rt;
|
1143 |
|
|
if (rt == NULL || !(rt->rt_flags & RTF_UP)) {
|
1144 |
|
|
/* No route yet, so try to acquire one */
|
1145 |
|
|
if (inp->inp_faddr.s_addr != INADDR_ANY) {
|
1146 |
|
|
ro->ro_dst.sa_family = AF_INET;
|
1147 |
|
|
ro->ro_dst.sa_len = sizeof(struct sockaddr_in);
|
1148 |
|
|
((struct sockaddr_in *) &ro->ro_dst)->sin_addr =
|
1149 |
|
|
inp->inp_faddr;
|
1150 |
|
|
rtalloc(ro);
|
1151 |
|
|
rt = ro->ro_rt;
|
1152 |
|
|
}
|
1153 |
|
|
}
|
1154 |
|
|
return rt;
|
1155 |
|
|
}
|
1156 |
|
|
|
1157 |
|
|
#ifdef INET6
|
1158 |
|
|
struct rtentry *
|
1159 |
|
|
tcp_rtlookup6(inp)
|
1160 |
|
|
struct inpcb *inp;
|
1161 |
|
|
{
|
1162 |
|
|
#ifdef NEW_STRUCT_ROUTE
|
1163 |
|
|
struct route *ro6;
|
1164 |
|
|
#else
|
1165 |
|
|
struct route_in6 *ro6;
|
1166 |
|
|
#endif
|
1167 |
|
|
struct rtentry *rt;
|
1168 |
|
|
|
1169 |
|
|
ro6 = &inp->in6p_route;
|
1170 |
|
|
rt = ro6->ro_rt;
|
1171 |
|
|
if (rt == NULL || !(rt->rt_flags & RTF_UP)) {
|
1172 |
|
|
/* No route yet, so try to acquire one */
|
1173 |
|
|
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
|
1174 |
|
|
struct sockaddr_in6 *dst6;
|
1175 |
|
|
|
1176 |
|
|
dst6 = (struct sockaddr_in6 *)&ro6->ro_dst;
|
1177 |
|
|
dst6->sin6_family = AF_INET6;
|
1178 |
|
|
dst6->sin6_len = sizeof(*dst6);
|
1179 |
|
|
dst6->sin6_addr = inp->in6p_faddr;
|
1180 |
|
|
rtalloc((struct route *)ro6);
|
1181 |
|
|
rt = ro6->ro_rt;
|
1182 |
|
|
}
|
1183 |
|
|
}
|
1184 |
|
|
return rt;
|
1185 |
|
|
}
|
1186 |
|
|
#endif /* INET6 */
|
1187 |
|
|
|
1188 |
|
|
#ifdef IPSEC
|
1189 |
|
|
/* compute ESP/AH header size for TCP, including outer IP header. */
|
1190 |
|
|
size_t
|
1191 |
|
|
ipsec_hdrsiz_tcp(tp)
|
1192 |
|
|
struct tcpcb *tp;
|
1193 |
|
|
{
|
1194 |
|
|
struct inpcb *inp;
|
1195 |
|
|
struct mbuf *m;
|
1196 |
|
|
size_t hdrsiz;
|
1197 |
|
|
struct ip *ip;
|
1198 |
|
|
#ifdef INET6
|
1199 |
|
|
struct ip6_hdr *ip6;
|
1200 |
|
|
#endif /* INET6 */
|
1201 |
|
|
struct tcphdr *th;
|
1202 |
|
|
|
1203 |
|
|
if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL))
|
1204 |
|
|
return 0;
|
1205 |
|
|
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
1206 |
|
|
if (!m)
|
1207 |
|
|
return 0;
|
1208 |
|
|
|
1209 |
|
|
#ifdef INET6
|
1210 |
|
|
if ((inp->inp_vflag & INP_IPV6) != 0) {
|
1211 |
|
|
ip6 = mtod(m, struct ip6_hdr *);
|
1212 |
|
|
th = (struct tcphdr *)(ip6 + 1);
|
1213 |
|
|
m->m_pkthdr.len = m->m_len =
|
1214 |
|
|
sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
|
1215 |
|
|
tcp_fillheaders(tp, ip6, th);
|
1216 |
|
|
hdrsiz = ipsec6_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
|
1217 |
|
|
} else
|
1218 |
|
|
#endif /* INET6 */
|
1219 |
|
|
{
|
1220 |
|
|
ip = mtod(m, struct ip *);
|
1221 |
|
|
th = (struct tcphdr *)(ip + 1);
|
1222 |
|
|
m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr);
|
1223 |
|
|
tcp_fillheaders(tp, ip, th);
|
1224 |
|
|
hdrsiz = ipsec4_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
|
1225 |
|
|
}
|
1226 |
|
|
|
1227 |
|
|
m_free(m);
|
1228 |
|
|
return hdrsiz;
|
1229 |
|
|
}
|
1230 |
|
|
#endif /*IPSEC*/
|
1231 |
|
|
|
1232 |
|
|
/*
|
1233 |
|
|
* Return a pointer to the cached information about the remote host.
|
1234 |
|
|
* The cached information is stored in the protocol specific part of
|
1235 |
|
|
* the route metrics.
|
1236 |
|
|
*/
|
1237 |
|
|
struct rmxp_tao *
|
1238 |
|
|
tcp_gettaocache(inp)
|
1239 |
|
|
struct inpcb *inp;
|
1240 |
|
|
{
|
1241 |
|
|
struct rtentry *rt;
|
1242 |
|
|
|
1243 |
|
|
#ifdef INET6
|
1244 |
|
|
if ((inp->inp_vflag & INP_IPV6) != 0)
|
1245 |
|
|
rt = tcp_rtlookup6(inp);
|
1246 |
|
|
else
|
1247 |
|
|
#endif /* INET6 */
|
1248 |
|
|
rt = tcp_rtlookup(inp);
|
1249 |
|
|
|
1250 |
|
|
/* Make sure this is a host route and is up. */
|
1251 |
|
|
if (rt == NULL ||
|
1252 |
|
|
(rt->rt_flags & (RTF_UP|RTF_HOST)) != (RTF_UP|RTF_HOST))
|
1253 |
|
|
return NULL;
|
1254 |
|
|
|
1255 |
|
|
return rmx_taop(rt->rt_rmx);
|
1256 |
|
|
}
|
1257 |
|
|
|
1258 |
|
|
/*
|
1259 |
|
|
* Clear all the TAO cache entries, called from tcp_init.
|
1260 |
|
|
*
|
1261 |
|
|
* XXX
|
1262 |
|
|
* This routine is just an empty one, because we assume that the routing
|
1263 |
|
|
* routing tables are initialized at the same time when TCP, so there is
|
1264 |
|
|
* nothing in the cache left over.
|
1265 |
|
|
*/
|
1266 |
|
|
static void
|
1267 |
|
|
tcp_cleartaocache()
|
1268 |
|
|
{
|
1269 |
|
|
}
|