Deleted Added
sdiff udiff text old ( 251296 ) new ( 254889 )
full compact
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_subr.c 251296 2013-06-03 12:55:13Z andre $");
34
35#include "opt_compat.h"
36#include "opt_inet.h"
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_tcpdebug.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/callout.h>
44#include <sys/hhook.h>
45#include <sys/kernel.h>
46#include <sys/khelp.h>
47#include <sys/sysctl.h>
48#include <sys/jail.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#ifdef INET6
52#include <sys/domain.h>
53#endif
54#include <sys/priv.h>
55#include <sys/proc.h>
56#include <sys/socket.h>
57#include <sys/socketvar.h>
58#include <sys/protosw.h>
59#include <sys/random.h>
60
61#include <vm/uma.h>
62
63#include <net/route.h>
64#include <net/if.h>
65#include <net/vnet.h>
66
67#include <netinet/cc.h>
68#include <netinet/in.h>
69#include <netinet/in_pcb.h>
70#include <netinet/in_systm.h>
71#include <netinet/in_var.h>
72#include <netinet/ip.h>
73#include <netinet/ip_icmp.h>
74#include <netinet/ip_var.h>
75#ifdef INET6
76#include <netinet/ip6.h>

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

627 xchg(nth->th_dport, nth->th_sport, uint16_t);
628#undef xchg
629 }
630#ifdef INET6
631 if (isipv6) {
632 ip6->ip6_flow = 0;
633 ip6->ip6_vfc = IPV6_VERSION;
634 ip6->ip6_nxt = IPPROTO_TCP;
635 ip6->ip6_plen = 0; /* Set in ip6_output(). */
636 tlen += sizeof (struct ip6_hdr) + sizeof (struct tcphdr);
637 }
638#endif
639#if defined(INET) && defined(INET6)
640 else
641#endif
642#ifdef INET
643 {
644 tlen += sizeof (struct tcpiphdr);

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

697 nth->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
698 htons((u_short)(tlen - sizeof(struct ip) + ip->ip_p)));
699 }
700#endif /* INET */
701#ifdef TCPDEBUG
702 if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG))
703 tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
704#endif
705#ifdef INET6
706 if (isipv6)
707 (void) ip6_output(m, NULL, NULL, ipflags, NULL, NULL, inp);
708#endif /* INET6 */
709#if defined(INET) && defined(INET6)
710 else
711#endif
712#ifdef INET

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

877tcp_drop(struct tcpcb *tp, int errno)
878{
879 struct socket *so = tp->t_inpcb->inp_socket;
880
881 INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
882 INP_WLOCK_ASSERT(tp->t_inpcb);
883
884 if (TCPS_HAVERCVDSYN(tp->t_state)) {
885 tp->t_state = TCPS_CLOSED;
886 (void) tcp_output(tp);
887 TCPSTAT_INC(tcps_drops);
888 } else
889 TCPSTAT_INC(tcps_conndrops);
890 if (errno == ETIMEDOUT && tp->t_softerror)
891 errno = tp->t_softerror;
892 so->so_error = errno;
893 return (tcp_close(tp));

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

2371 }
2372 sp = s + strlen(s);
2373 if (th)
2374 sprintf(sp, " tcpflags 0x%b", th->th_flags, PRINT_TH_FLAGS);
2375 if (*(s + size - 1) != '\0')
2376 panic("%s: string too long", __func__);
2377 return (s);
2378}