tcp_subr.c (108265) | tcp_subr.c (109623) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 |
34 * $FreeBSD: head/sys/netinet/tcp_subr.c 108265 2002-12-24 21:00:31Z hsu $ | 34 * $FreeBSD: head/sys/netinet/tcp_subr.c 109623 2003-01-21 08:56:16Z alfred $ |
35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_ipsec.h" 40#include "opt_mac.h" 41#include "opt_tcpdebug.h" 42 --- 284 unchanged lines hidden (view full) --- 327 */ 328struct tcptemp * 329tcp_maketemplate(tp) 330 struct tcpcb *tp; 331{ 332 struct mbuf *m; 333 struct tcptemp *n; 334 | 35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_ipsec.h" 40#include "opt_mac.h" 41#include "opt_tcpdebug.h" 42 --- 284 unchanged lines hidden (view full) --- 327 */ 328struct tcptemp * 329tcp_maketemplate(tp) 330 struct tcpcb *tp; 331{ 332 struct mbuf *m; 333 struct tcptemp *n; 334 |
335 m = m_get(M_DONTWAIT, MT_HEADER); | 335 m = m_get(M_NOWAIT, MT_HEADER); |
336 if (m == NULL) 337 return (0); 338 m->m_len = sizeof(struct tcptemp); 339 n = mtod(m, struct tcptemp *); 340 341 tcp_fillheaders(tp, (void *)&n->tt_ipgen, (void *)&n->tt_t); 342 return (n); 343} --- 63 unchanged lines hidden (view full) --- 407 } else 408#endif /* INET6 */ 409 { 410 ro = &sro; 411 bzero(ro, sizeof *ro); 412 } 413 } 414 if (m == 0) { | 336 if (m == NULL) 337 return (0); 338 m->m_len = sizeof(struct tcptemp); 339 n = mtod(m, struct tcptemp *); 340 341 tcp_fillheaders(tp, (void *)&n->tt_ipgen, (void *)&n->tt_t); 342 return (n); 343} --- 63 unchanged lines hidden (view full) --- 407 } else 408#endif /* INET6 */ 409 { 410 ro = &sro; 411 bzero(ro, sizeof *ro); 412 } 413 } 414 if (m == 0) { |
415 m = m_gethdr(M_DONTWAIT, MT_HEADER); | 415 m = m_gethdr(M_NOWAIT, MT_HEADER); |
416 if (m == NULL) 417 return; 418 tlen = 0; 419 m->m_data += max_linkhdr; 420#ifdef INET6 421 if (isipv6) { 422 bcopy((caddr_t)ip6, mtod(m, caddr_t), 423 sizeof(struct ip6_hdr)); --- 472 unchanged lines hidden (view full) --- 896 xig.xig_len = sizeof xig; 897 xig.xig_count = n; 898 xig.xig_gen = gencnt; 899 xig.xig_sogen = so_gencnt; 900 error = SYSCTL_OUT(req, &xig, sizeof xig); 901 if (error) 902 return error; 903 | 416 if (m == NULL) 417 return; 418 tlen = 0; 419 m->m_data += max_linkhdr; 420#ifdef INET6 421 if (isipv6) { 422 bcopy((caddr_t)ip6, mtod(m, caddr_t), 423 sizeof(struct ip6_hdr)); --- 472 unchanged lines hidden (view full) --- 896 xig.xig_len = sizeof xig; 897 xig.xig_count = n; 898 xig.xig_gen = gencnt; 899 xig.xig_sogen = so_gencnt; 900 error = SYSCTL_OUT(req, &xig, sizeof xig); 901 if (error) 902 return error; 903 |
904 inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); | 904 inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); |
905 if (inp_list == 0) 906 return ENOMEM; 907 908 s = splnet(); 909 INP_INFO_RLOCK(&tcbinfo); 910 for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n; 911 inp = LIST_NEXT(inp, inp_list)) { 912 INP_LOCK(inp); --- 578 unchanged lines hidden (view full) --- 1491 struct ip *ip; 1492#ifdef INET6 1493 struct ip6_hdr *ip6; 1494#endif /* INET6 */ 1495 struct tcphdr *th; 1496 1497 if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) 1498 return 0; | 905 if (inp_list == 0) 906 return ENOMEM; 907 908 s = splnet(); 909 INP_INFO_RLOCK(&tcbinfo); 910 for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n; 911 inp = LIST_NEXT(inp, inp_list)) { 912 INP_LOCK(inp); --- 578 unchanged lines hidden (view full) --- 1491 struct ip *ip; 1492#ifdef INET6 1493 struct ip6_hdr *ip6; 1494#endif /* INET6 */ 1495 struct tcphdr *th; 1496 1497 if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) 1498 return 0; |
1499 MGETHDR(m, M_DONTWAIT, MT_DATA); | 1499 MGETHDR(m, M_NOWAIT, MT_DATA); |
1500 if (!m) 1501 return 0; 1502 1503#ifdef INET6 1504 if ((inp->inp_vflag & INP_IPV6) != 0) { 1505 ip6 = mtod(m, struct ip6_hdr *); 1506 th = (struct tcphdr *)(ip6 + 1); 1507 m->m_pkthdr.len = m->m_len = --- 202 unchanged lines hidden --- | 1500 if (!m) 1501 return 0; 1502 1503#ifdef INET6 1504 if ((inp->inp_vflag & INP_IPV6) != 0) { 1505 ip6 = mtod(m, struct ip6_hdr *); 1506 th = (struct tcphdr *)(ip6 + 1); 1507 m->m_pkthdr.len = m->m_len = --- 202 unchanged lines hidden --- |