tcp_ipv4.c (a6ff1a2f1e91578860b37df9fd861ef7af207de4) tcp_ipv4.c (be9f4a44e7d41cee50ddb5f038fc2391cbbb4046)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Implementation of the Transmission Control Protocol(TCP).
7 *
8 * IPv4 specific functions

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

683 /* When socket is gone, all binding information is lost.
684 * routing might fail in this case. using iif for oif to
685 * make sure we can deliver it
686 */
687 arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb);
688
689 net = dev_net(skb_dst(skb)->dev);
690 arg.tos = ip_hdr(skb)->tos;
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Implementation of the Transmission Control Protocol(TCP).
7 *
8 * IPv4 specific functions

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

683 /* When socket is gone, all binding information is lost.
684 * routing might fail in this case. using iif for oif to
685 * make sure we can deliver it
686 */
687 arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb);
688
689 net = dev_net(skb_dst(skb)->dev);
690 arg.tos = ip_hdr(skb)->tos;
691 ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
691 ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
692 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
693
694 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
695 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
696
697#ifdef CONFIG_TCP_MD5SIG
698release_sk1:
699 if (sk1) {

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

766 arg.flags = reply_flags;
767 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
768 ip_hdr(skb)->saddr, /* XXX */
769 arg.iov[0].iov_len, IPPROTO_TCP, 0);
770 arg.csumoffset = offsetof(struct tcphdr, check) / 2;
771 if (oif)
772 arg.bound_dev_if = oif;
773 arg.tos = tos;
692 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
693
694 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
695 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
696
697#ifdef CONFIG_TCP_MD5SIG
698release_sk1:
699 if (sk1) {

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

766 arg.flags = reply_flags;
767 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
768 ip_hdr(skb)->saddr, /* XXX */
769 arg.iov[0].iov_len, IPPROTO_TCP, 0);
770 arg.csumoffset = offsetof(struct tcphdr, check) / 2;
771 if (oif)
772 arg.bound_dev_if = oif;
773 arg.tos = tos;
774 ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
774 ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
775 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
776
777 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
778}
779
780static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
781{
782 struct inet_timewait_sock *tw = inet_twsk(sk);

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

2619 .destroy_cgroup = tcp_destroy_cgroup,
2620 .proto_cgroup = tcp_proto_cgroup,
2621#endif
2622};
2623EXPORT_SYMBOL(tcp_prot);
2624
2625static int __net_init tcp_sk_init(struct net *net)
2626{
775 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
776
777 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
778}
779
780static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
781{
782 struct inet_timewait_sock *tw = inet_twsk(sk);

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

2619 .destroy_cgroup = tcp_destroy_cgroup,
2620 .proto_cgroup = tcp_proto_cgroup,
2621#endif
2622};
2623EXPORT_SYMBOL(tcp_prot);
2624
2625static int __net_init tcp_sk_init(struct net *net)
2626{
2627 return inet_ctl_sock_create(&net->ipv4.tcp_sock,
2628 PF_INET, SOCK_RAW, IPPROTO_TCP, net);
2627 return 0;
2629}
2630
2631static void __net_exit tcp_sk_exit(struct net *net)
2632{
2628}
2629
2630static void __net_exit tcp_sk_exit(struct net *net)
2631{
2633 inet_ctl_sock_destroy(net->ipv4.tcp_sock);
2634}
2635
2636static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
2637{
2638 inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET);
2639}
2640
2641static struct pernet_operations __net_initdata tcp_sk_ops = {
2642 .init = tcp_sk_init,
2643 .exit = tcp_sk_exit,
2644 .exit_batch = tcp_sk_exit_batch,
2645};
2646
2647void __init tcp_v4_init(void)
2648{
2649 inet_hashinfo_init(&tcp_hashinfo);
2650 if (register_pernet_subsys(&tcp_sk_ops))
2651 panic("Failed to create the TCP control socket.\n");
2652}
2632}
2633
2634static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
2635{
2636 inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET);
2637}
2638
2639static struct pernet_operations __net_initdata tcp_sk_ops = {
2640 .init = tcp_sk_init,
2641 .exit = tcp_sk_exit,
2642 .exit_batch = tcp_sk_exit_batch,
2643};
2644
2645void __init tcp_v4_init(void)
2646{
2647 inet_hashinfo_init(&tcp_hashinfo);
2648 if (register_pernet_subsys(&tcp_sk_ops))
2649 panic("Failed to create the TCP control socket.\n");
2650}