tcp_ipv4.c (5d3848bc33b7d13fc97b5b6e0dccde2d0755bfd5) tcp_ipv4.c (90bbcc608369a1b46089b0f5aa22b8ea31ffa12e)
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

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

692 offsetof(struct inet_timewait_sock, tw_bound_dev_if));
693
694 arg.tos = ip_hdr(skb)->tos;
695 ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
696 skb, &TCP_SKB_CB(skb)->header.h4.opt,
697 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
698 &arg, arg.iov[0].iov_len);
699
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

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

692 offsetof(struct inet_timewait_sock, tw_bound_dev_if));
693
694 arg.tos = ip_hdr(skb)->tos;
695 ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
696 skb, &TCP_SKB_CB(skb)->header.h4.opt,
697 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
698 &arg, arg.iov[0].iov_len);
699
700 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
701 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
700 __TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
701 __TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
702
703#ifdef CONFIG_TCP_MD5SIG
704out:
705 rcu_read_unlock();
706#endif
707}
708
709/* The code following below sending ACKs in SYN-RECV and TIME-WAIT states

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

774 if (oif)
775 arg.bound_dev_if = oif;
776 arg.tos = tos;
777 ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
778 skb, &TCP_SKB_CB(skb)->header.h4.opt,
779 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
780 &arg, arg.iov[0].iov_len);
781
702
703#ifdef CONFIG_TCP_MD5SIG
704out:
705 rcu_read_unlock();
706#endif
707}
708
709/* The code following below sending ACKs in SYN-RECV and TIME-WAIT states

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

774 if (oif)
775 arg.bound_dev_if = oif;
776 arg.tos = tos;
777 ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
778 skb, &TCP_SKB_CB(skb)->header.h4.opt,
779 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
780 &arg, arg.iov[0].iov_len);
781
782 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
782 __TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
783}
784
785static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
786{
787 struct inet_timewait_sock *tw = inet_twsk(sk);
788 struct tcp_timewait_sock *tcptw = tcp_twsk(sk);
789
790 tcp_v4_send_ack(sock_net(sk), skb,

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

1427 /* Be careful here. If this function gets more complicated and
1428 * gcc suffers from register pressure on the x86, sk (in %ebx)
1429 * might be destroyed here. This current version compiles correctly,
1430 * but you have been warned.
1431 */
1432 return 0;
1433
1434csum_err:
783}
784
785static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
786{
787 struct inet_timewait_sock *tw = inet_twsk(sk);
788 struct tcp_timewait_sock *tcptw = tcp_twsk(sk);
789
790 tcp_v4_send_ack(sock_net(sk), skb,

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

1427 /* Be careful here. If this function gets more complicated and
1428 * gcc suffers from register pressure on the x86, sk (in %ebx)
1429 * might be destroyed here. This current version compiles correctly,
1430 * but you have been warned.
1431 */
1432 return 0;
1433
1434csum_err:
1435 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS);
1436 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);
1435 __TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
1436 __TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
1437 goto discard;
1438}
1439EXPORT_SYMBOL(tcp_v4_do_rcv);
1440
1441void tcp_v4_early_demux(struct sk_buff *skb)
1442{
1443 const struct iphdr *iph;
1444 const struct tcphdr *th;

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

1542 bool refcounted;
1543 struct sock *sk;
1544 int ret;
1545
1546 if (skb->pkt_type != PACKET_HOST)
1547 goto discard_it;
1548
1549 /* Count it even if it's bad */
1437 goto discard;
1438}
1439EXPORT_SYMBOL(tcp_v4_do_rcv);
1440
1441void tcp_v4_early_demux(struct sk_buff *skb)
1442{
1443 const struct iphdr *iph;
1444 const struct tcphdr *th;

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

1542 bool refcounted;
1543 struct sock *sk;
1544 int ret;
1545
1546 if (skb->pkt_type != PACKET_HOST)
1547 goto discard_it;
1548
1549 /* Count it even if it's bad */
1550 TCP_INC_STATS_BH(net, TCP_MIB_INSEGS);
1550 __TCP_INC_STATS(net, TCP_MIB_INSEGS);
1551
1552 if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
1553 goto discard_it;
1554
1555 th = tcp_hdr(skb);
1556
1557 if (th->doff < sizeof(struct tcphdr) / 4)
1558 goto bad_packet;

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

1674 return ret;
1675
1676no_tcp_socket:
1677 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1678 goto discard_it;
1679
1680 if (tcp_checksum_complete(skb)) {
1681csum_error:
1551
1552 if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
1553 goto discard_it;
1554
1555 th = tcp_hdr(skb);
1556
1557 if (th->doff < sizeof(struct tcphdr) / 4)
1558 goto bad_packet;

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

1674 return ret;
1675
1676no_tcp_socket:
1677 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1678 goto discard_it;
1679
1680 if (tcp_checksum_complete(skb)) {
1681csum_error:
1682 TCP_INC_STATS_BH(net, TCP_MIB_CSUMERRORS);
1682 __TCP_INC_STATS(net, TCP_MIB_CSUMERRORS);
1683bad_packet:
1683bad_packet:
1684 TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
1684 __TCP_INC_STATS(net, TCP_MIB_INERRS);
1685 } else {
1686 tcp_v4_send_reset(NULL, skb);
1687 }
1688
1689discard_it:
1690 /* Discard frame. */
1691 kfree_skb(skb);
1692 return 0;

--- 741 unchanged lines hidden ---
1685 } else {
1686 tcp_v4_send_reset(NULL, skb);
1687 }
1688
1689discard_it:
1690 /* Discard frame. */
1691 kfree_skb(skb);
1692 return 0;

--- 741 unchanged lines hidden ---