diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 120 |
1 files changed, 55 insertions, 65 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 78aa53492b3e..36131d122a6f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <net/timewait_sock.h> | 61 | #include <net/timewait_sock.h> |
62 | #include <net/netdma.h> | 62 | #include <net/netdma.h> |
63 | #include <net/inet_common.h> | 63 | #include <net/inet_common.h> |
64 | #include <net/secure_seq.h> | ||
64 | 65 | ||
65 | #include <asm/uaccess.h> | 66 | #include <asm/uaccess.h> |
66 | 67 | ||
@@ -113,7 +114,7 @@ static __inline__ __sum16 tcp_v6_check(int len, | |||
113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); | 114 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); |
114 | } | 115 | } |
115 | 116 | ||
116 | static __u32 tcp_v6_init_sequence(struct sk_buff *skb) | 117 | static __u32 tcp_v6_init_sequence(const struct sk_buff *skb) |
117 | { | 118 | { |
118 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, | 119 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, |
119 | ipv6_hdr(skb)->saddr.s6_addr32, | 120 | ipv6_hdr(skb)->saddr.s6_addr32, |
@@ -512,7 +513,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
512 | __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); | 513 | __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); |
513 | 514 | ||
514 | ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr); | 515 | ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr); |
515 | err = ip6_xmit(sk, skb, &fl6, opt); | 516 | err = ip6_xmit(sk, skb, &fl6, opt, np->tclass); |
516 | err = net_xmit_eval(err); | 517 | err = net_xmit_eval(err); |
517 | } | 518 | } |
518 | 519 | ||
@@ -530,20 +531,6 @@ static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req, | |||
530 | return tcp_v6_send_synack(sk, req, rvp); | 531 | return tcp_v6_send_synack(sk, req, rvp); |
531 | } | 532 | } |
532 | 533 | ||
533 | static inline void syn_flood_warning(struct sk_buff *skb) | ||
534 | { | ||
535 | #ifdef CONFIG_SYN_COOKIES | ||
536 | if (sysctl_tcp_syncookies) | ||
537 | printk(KERN_INFO | ||
538 | "TCPv6: Possible SYN flooding on port %d. " | ||
539 | "Sending cookies.\n", ntohs(tcp_hdr(skb)->dest)); | ||
540 | else | ||
541 | #endif | ||
542 | printk(KERN_INFO | ||
543 | "TCPv6: Possible SYN flooding on port %d. " | ||
544 | "Dropping request.\n", ntohs(tcp_hdr(skb)->dest)); | ||
545 | } | ||
546 | |||
547 | static void tcp_v6_reqsk_destructor(struct request_sock *req) | 534 | static void tcp_v6_reqsk_destructor(struct request_sock *req) |
548 | { | 535 | { |
549 | kfree_skb(inet6_rsk(req)->pktopts); | 536 | kfree_skb(inet6_rsk(req)->pktopts); |
@@ -604,7 +591,8 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer, | |||
604 | } | 591 | } |
605 | sk_nocaps_add(sk, NETIF_F_GSO_MASK); | 592 | sk_nocaps_add(sk, NETIF_F_GSO_MASK); |
606 | } | 593 | } |
607 | if (tcp_alloc_md5sig_pool(sk) == NULL) { | 594 | if (tp->md5sig_info->entries6 == 0 && |
595 | tcp_alloc_md5sig_pool(sk) == NULL) { | ||
608 | kfree(newkey); | 596 | kfree(newkey); |
609 | return -ENOMEM; | 597 | return -ENOMEM; |
610 | } | 598 | } |
@@ -613,8 +601,9 @@ static int tcp_v6_md5_do_add(struct sock *sk, const struct in6_addr *peer, | |||
613 | (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC); | 601 | (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC); |
614 | 602 | ||
615 | if (!keys) { | 603 | if (!keys) { |
616 | tcp_free_md5sig_pool(); | ||
617 | kfree(newkey); | 604 | kfree(newkey); |
605 | if (tp->md5sig_info->entries6 == 0) | ||
606 | tcp_free_md5sig_pool(); | ||
618 | return -ENOMEM; | 607 | return -ENOMEM; |
619 | } | 608 | } |
620 | 609 | ||
@@ -660,6 +649,7 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer) | |||
660 | kfree(tp->md5sig_info->keys6); | 649 | kfree(tp->md5sig_info->keys6); |
661 | tp->md5sig_info->keys6 = NULL; | 650 | tp->md5sig_info->keys6 = NULL; |
662 | tp->md5sig_info->alloced6 = 0; | 651 | tp->md5sig_info->alloced6 = 0; |
652 | tcp_free_md5sig_pool(); | ||
663 | } else { | 653 | } else { |
664 | /* shrink the database */ | 654 | /* shrink the database */ |
665 | if (tp->md5sig_info->entries6 != i) | 655 | if (tp->md5sig_info->entries6 != i) |
@@ -668,7 +658,6 @@ static int tcp_v6_md5_do_del(struct sock *sk, const struct in6_addr *peer) | |||
668 | (tp->md5sig_info->entries6 - i) | 658 | (tp->md5sig_info->entries6 - i) |
669 | * sizeof (tp->md5sig_info->keys6[0])); | 659 | * sizeof (tp->md5sig_info->keys6[0])); |
670 | } | 660 | } |
671 | tcp_free_md5sig_pool(); | ||
672 | return 0; | 661 | return 0; |
673 | } | 662 | } |
674 | } | 663 | } |
@@ -772,7 +761,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
772 | 761 | ||
773 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 762 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
774 | const struct in6_addr *daddr, struct in6_addr *saddr, | 763 | const struct in6_addr *daddr, struct in6_addr *saddr, |
775 | struct tcphdr *th) | 764 | const struct tcphdr *th) |
776 | { | 765 | { |
777 | struct tcp_md5sig_pool *hp; | 766 | struct tcp_md5sig_pool *hp; |
778 | struct hash_desc *desc; | 767 | struct hash_desc *desc; |
@@ -804,13 +793,14 @@ clear_hash_noput: | |||
804 | } | 793 | } |
805 | 794 | ||
806 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 795 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
807 | struct sock *sk, struct request_sock *req, | 796 | const struct sock *sk, |
808 | struct sk_buff *skb) | 797 | const struct request_sock *req, |
798 | const struct sk_buff *skb) | ||
809 | { | 799 | { |
810 | const struct in6_addr *saddr, *daddr; | 800 | const struct in6_addr *saddr, *daddr; |
811 | struct tcp_md5sig_pool *hp; | 801 | struct tcp_md5sig_pool *hp; |
812 | struct hash_desc *desc; | 802 | struct hash_desc *desc; |
813 | struct tcphdr *th = tcp_hdr(skb); | 803 | const struct tcphdr *th = tcp_hdr(skb); |
814 | 804 | ||
815 | if (sk) { | 805 | if (sk) { |
816 | saddr = &inet6_sk(sk)->saddr; | 806 | saddr = &inet6_sk(sk)->saddr; |
@@ -853,12 +843,12 @@ clear_hash_noput: | |||
853 | return 1; | 843 | return 1; |
854 | } | 844 | } |
855 | 845 | ||
856 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | 846 | static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) |
857 | { | 847 | { |
858 | __u8 *hash_location = NULL; | 848 | const __u8 *hash_location = NULL; |
859 | struct tcp_md5sig_key *hash_expected; | 849 | struct tcp_md5sig_key *hash_expected; |
860 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 850 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
861 | struct tcphdr *th = tcp_hdr(skb); | 851 | const struct tcphdr *th = tcp_hdr(skb); |
862 | int genhash; | 852 | int genhash; |
863 | u8 newhash[16]; | 853 | u8 newhash[16]; |
864 | 854 | ||
@@ -989,9 +979,10 @@ static int tcp6_gro_complete(struct sk_buff *skb) | |||
989 | } | 979 | } |
990 | 980 | ||
991 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | 981 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, |
992 | u32 ts, struct tcp_md5sig_key *key, int rst) | 982 | u32 ts, struct tcp_md5sig_key *key, int rst, u8 tclass) |
993 | { | 983 | { |
994 | struct tcphdr *th = tcp_hdr(skb), *t1; | 984 | const struct tcphdr *th = tcp_hdr(skb); |
985 | struct tcphdr *t1; | ||
995 | struct sk_buff *buff; | 986 | struct sk_buff *buff; |
996 | struct flowi6 fl6; | 987 | struct flowi6 fl6; |
997 | struct net *net = dev_net(skb_dst(skb)->dev); | 988 | struct net *net = dev_net(skb_dst(skb)->dev); |
@@ -1069,7 +1060,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
1069 | dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false); | 1060 | dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false); |
1070 | if (!IS_ERR(dst)) { | 1061 | if (!IS_ERR(dst)) { |
1071 | skb_dst_set(buff, dst); | 1062 | skb_dst_set(buff, dst); |
1072 | ip6_xmit(ctl_sk, buff, &fl6, NULL); | 1063 | ip6_xmit(ctl_sk, buff, &fl6, NULL, tclass); |
1073 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); | 1064 | TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); |
1074 | if (rst) | 1065 | if (rst) |
1075 | TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS); | 1066 | TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS); |
@@ -1081,7 +1072,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
1081 | 1072 | ||
1082 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | 1073 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) |
1083 | { | 1074 | { |
1084 | struct tcphdr *th = tcp_hdr(skb); | 1075 | const struct tcphdr *th = tcp_hdr(skb); |
1085 | u32 seq = 0, ack_seq = 0; | 1076 | u32 seq = 0, ack_seq = 0; |
1086 | struct tcp_md5sig_key *key = NULL; | 1077 | struct tcp_md5sig_key *key = NULL; |
1087 | 1078 | ||
@@ -1102,13 +1093,13 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1102 | ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - | 1093 | ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - |
1103 | (th->doff << 2); | 1094 | (th->doff << 2); |
1104 | 1095 | ||
1105 | tcp_v6_send_response(skb, seq, ack_seq, 0, 0, key, 1); | 1096 | tcp_v6_send_response(skb, seq, ack_seq, 0, 0, key, 1, 0); |
1106 | } | 1097 | } |
1107 | 1098 | ||
1108 | static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts, | 1099 | static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts, |
1109 | struct tcp_md5sig_key *key) | 1100 | struct tcp_md5sig_key *key, u8 tclass) |
1110 | { | 1101 | { |
1111 | tcp_v6_send_response(skb, seq, ack, win, ts, key, 0); | 1102 | tcp_v6_send_response(skb, seq, ack, win, ts, key, 0, tclass); |
1112 | } | 1103 | } |
1113 | 1104 | ||
1114 | static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | 1105 | static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) |
@@ -1118,7 +1109,8 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
1118 | 1109 | ||
1119 | tcp_v6_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, | 1110 | tcp_v6_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, |
1120 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, | 1111 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, |
1121 | tcptw->tw_ts_recent, tcp_twsk_md5_key(tcptw)); | 1112 | tcptw->tw_ts_recent, tcp_twsk_md5_key(tcptw), |
1113 | tw->tw_tclass); | ||
1122 | 1114 | ||
1123 | inet_twsk_put(tw); | 1115 | inet_twsk_put(tw); |
1124 | } | 1116 | } |
@@ -1127,7 +1119,7 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
1127 | struct request_sock *req) | 1119 | struct request_sock *req) |
1128 | { | 1120 | { |
1129 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent, | 1121 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent, |
1130 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr)); | 1122 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), 0); |
1131 | } | 1123 | } |
1132 | 1124 | ||
1133 | 1125 | ||
@@ -1171,18 +1163,14 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1171 | { | 1163 | { |
1172 | struct tcp_extend_values tmp_ext; | 1164 | struct tcp_extend_values tmp_ext; |
1173 | struct tcp_options_received tmp_opt; | 1165 | struct tcp_options_received tmp_opt; |
1174 | u8 *hash_location; | 1166 | const u8 *hash_location; |
1175 | struct request_sock *req; | 1167 | struct request_sock *req; |
1176 | struct inet6_request_sock *treq; | 1168 | struct inet6_request_sock *treq; |
1177 | struct ipv6_pinfo *np = inet6_sk(sk); | 1169 | struct ipv6_pinfo *np = inet6_sk(sk); |
1178 | struct tcp_sock *tp = tcp_sk(sk); | 1170 | struct tcp_sock *tp = tcp_sk(sk); |
1179 | __u32 isn = TCP_SKB_CB(skb)->when; | 1171 | __u32 isn = TCP_SKB_CB(skb)->when; |
1180 | struct dst_entry *dst = NULL; | 1172 | struct dst_entry *dst = NULL; |
1181 | #ifdef CONFIG_SYN_COOKIES | ||
1182 | int want_cookie = 0; | 1173 | int want_cookie = 0; |
1183 | #else | ||
1184 | #define want_cookie 0 | ||
1185 | #endif | ||
1186 | 1174 | ||
1187 | if (skb->protocol == htons(ETH_P_IP)) | 1175 | if (skb->protocol == htons(ETH_P_IP)) |
1188 | return tcp_v4_conn_request(sk, skb); | 1176 | return tcp_v4_conn_request(sk, skb); |
@@ -1191,14 +1179,9 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1191 | goto drop; | 1179 | goto drop; |
1192 | 1180 | ||
1193 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { | 1181 | if (inet_csk_reqsk_queue_is_full(sk) && !isn) { |
1194 | if (net_ratelimit()) | 1182 | want_cookie = tcp_syn_flood_action(sk, skb, "TCPv6"); |
1195 | syn_flood_warning(skb); | 1183 | if (!want_cookie) |
1196 | #ifdef CONFIG_SYN_COOKIES | 1184 | goto drop; |
1197 | if (sysctl_tcp_syncookies) | ||
1198 | want_cookie = 1; | ||
1199 | else | ||
1200 | #endif | ||
1201 | goto drop; | ||
1202 | } | 1185 | } |
1203 | 1186 | ||
1204 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) | 1187 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) |
@@ -1248,9 +1231,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1248 | while (l-- > 0) | 1231 | while (l-- > 0) |
1249 | *c++ ^= *hash_location++; | 1232 | *c++ ^= *hash_location++; |
1250 | 1233 | ||
1251 | #ifdef CONFIG_SYN_COOKIES | ||
1252 | want_cookie = 0; /* not our kind of cookie */ | 1234 | want_cookie = 0; /* not our kind of cookie */ |
1253 | #endif | ||
1254 | tmp_ext.cookie_out_never = 0; /* false */ | 1235 | tmp_ext.cookie_out_never = 0; /* false */ |
1255 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; | 1236 | tmp_ext.cookie_plus = tmp_opt.cookie_plus; |
1256 | } else if (!tp->rx_opt.cookie_in_always) { | 1237 | } else if (!tp->rx_opt.cookie_in_always) { |
@@ -1407,6 +1388,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1407 | newtp->af_specific = &tcp_sock_ipv6_mapped_specific; | 1388 | newtp->af_specific = &tcp_sock_ipv6_mapped_specific; |
1408 | #endif | 1389 | #endif |
1409 | 1390 | ||
1391 | newnp->ipv6_ac_list = NULL; | ||
1392 | newnp->ipv6_fl_list = NULL; | ||
1410 | newnp->pktoptions = NULL; | 1393 | newnp->pktoptions = NULL; |
1411 | newnp->opt = NULL; | 1394 | newnp->opt = NULL; |
1412 | newnp->mcast_oif = inet6_iif(skb); | 1395 | newnp->mcast_oif = inet6_iif(skb); |
@@ -1471,6 +1454,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1471 | First: no IPv4 options. | 1454 | First: no IPv4 options. |
1472 | */ | 1455 | */ |
1473 | newinet->inet_opt = NULL; | 1456 | newinet->inet_opt = NULL; |
1457 | newnp->ipv6_ac_list = NULL; | ||
1474 | newnp->ipv6_fl_list = NULL; | 1458 | newnp->ipv6_fl_list = NULL; |
1475 | 1459 | ||
1476 | /* Clone RX bits */ | 1460 | /* Clone RX bits */ |
@@ -1627,7 +1611,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1627 | opt_skb = skb_clone(skb, GFP_ATOMIC); | 1611 | opt_skb = skb_clone(skb, GFP_ATOMIC); |
1628 | 1612 | ||
1629 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1613 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1630 | sock_rps_save_rxhash(sk, skb->rxhash); | 1614 | sock_rps_save_rxhash(sk, skb); |
1631 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) | 1615 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) |
1632 | goto reset; | 1616 | goto reset; |
1633 | if (opt_skb) | 1617 | if (opt_skb) |
@@ -1649,7 +1633,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1649 | * the new socket.. | 1633 | * the new socket.. |
1650 | */ | 1634 | */ |
1651 | if(nsk != sk) { | 1635 | if(nsk != sk) { |
1652 | sock_rps_save_rxhash(nsk, skb->rxhash); | 1636 | sock_rps_save_rxhash(nsk, skb); |
1653 | if (tcp_child_process(sk, nsk, skb)) | 1637 | if (tcp_child_process(sk, nsk, skb)) |
1654 | goto reset; | 1638 | goto reset; |
1655 | if (opt_skb) | 1639 | if (opt_skb) |
@@ -1657,7 +1641,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1657 | return 0; | 1641 | return 0; |
1658 | } | 1642 | } |
1659 | } else | 1643 | } else |
1660 | sock_rps_save_rxhash(sk, skb->rxhash); | 1644 | sock_rps_save_rxhash(sk, skb); |
1661 | 1645 | ||
1662 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) | 1646 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) |
1663 | goto reset; | 1647 | goto reset; |
@@ -1707,7 +1691,7 @@ ipv6_pktoptions: | |||
1707 | 1691 | ||
1708 | static int tcp_v6_rcv(struct sk_buff *skb) | 1692 | static int tcp_v6_rcv(struct sk_buff *skb) |
1709 | { | 1693 | { |
1710 | struct tcphdr *th; | 1694 | const struct tcphdr *th; |
1711 | const struct ipv6hdr *hdr; | 1695 | const struct ipv6hdr *hdr; |
1712 | struct sock *sk; | 1696 | struct sock *sk; |
1713 | int ret; | 1697 | int ret; |
@@ -1741,7 +1725,7 @@ static int tcp_v6_rcv(struct sk_buff *skb) | |||
1741 | skb->len - th->doff*4); | 1725 | skb->len - th->doff*4); |
1742 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); | 1726 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); |
1743 | TCP_SKB_CB(skb)->when = 0; | 1727 | TCP_SKB_CB(skb)->when = 0; |
1744 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(hdr); | 1728 | TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); |
1745 | TCP_SKB_CB(skb)->sacked = 0; | 1729 | TCP_SKB_CB(skb)->sacked = 0; |
1746 | 1730 | ||
1747 | sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); | 1731 | sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest); |
@@ -1875,8 +1859,8 @@ static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) | |||
1875 | 1859 | ||
1876 | static void *tcp_v6_tw_get_peer(struct sock *sk) | 1860 | static void *tcp_v6_tw_get_peer(struct sock *sk) |
1877 | { | 1861 | { |
1878 | struct inet6_timewait_sock *tw6 = inet6_twsk(sk); | 1862 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
1879 | struct inet_timewait_sock *tw = inet_twsk(sk); | 1863 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
1880 | 1864 | ||
1881 | if (tw->tw_family == AF_INET) | 1865 | if (tw->tw_family == AF_INET) |
1882 | return tcp_v4_tw_get_peer(sk); | 1866 | return tcp_v4_tw_get_peer(sk); |
@@ -2031,7 +2015,7 @@ static void tcp_v6_destroy_sock(struct sock *sk) | |||
2031 | #ifdef CONFIG_PROC_FS | 2015 | #ifdef CONFIG_PROC_FS |
2032 | /* Proc filesystem TCPv6 sock list dumping. */ | 2016 | /* Proc filesystem TCPv6 sock list dumping. */ |
2033 | static void get_openreq6(struct seq_file *seq, | 2017 | static void get_openreq6(struct seq_file *seq, |
2034 | struct sock *sk, struct request_sock *req, int i, int uid) | 2018 | const struct sock *sk, struct request_sock *req, int i, int uid) |
2035 | { | 2019 | { |
2036 | int ttd = req->expires - jiffies; | 2020 | int ttd = req->expires - jiffies; |
2037 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; | 2021 | const struct in6_addr *src = &inet6_rsk(req)->loc_addr; |
@@ -2067,10 +2051,10 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
2067 | __u16 destp, srcp; | 2051 | __u16 destp, srcp; |
2068 | int timer_active; | 2052 | int timer_active; |
2069 | unsigned long timer_expires; | 2053 | unsigned long timer_expires; |
2070 | struct inet_sock *inet = inet_sk(sp); | 2054 | const struct inet_sock *inet = inet_sk(sp); |
2071 | struct tcp_sock *tp = tcp_sk(sp); | 2055 | const struct tcp_sock *tp = tcp_sk(sp); |
2072 | const struct inet_connection_sock *icsk = inet_csk(sp); | 2056 | const struct inet_connection_sock *icsk = inet_csk(sp); |
2073 | struct ipv6_pinfo *np = inet6_sk(sp); | 2057 | const struct ipv6_pinfo *np = inet6_sk(sp); |
2074 | 2058 | ||
2075 | dest = &np->daddr; | 2059 | dest = &np->daddr; |
2076 | src = &np->rcv_saddr; | 2060 | src = &np->rcv_saddr; |
@@ -2122,7 +2106,7 @@ static void get_timewait6_sock(struct seq_file *seq, | |||
2122 | { | 2106 | { |
2123 | const struct in6_addr *dest, *src; | 2107 | const struct in6_addr *dest, *src; |
2124 | __u16 destp, srcp; | 2108 | __u16 destp, srcp; |
2125 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); | 2109 | const struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
2126 | int ttd = tw->tw_ttd - jiffies; | 2110 | int ttd = tw->tw_ttd - jiffies; |
2127 | 2111 | ||
2128 | if (ttd < 0) | 2112 | if (ttd < 0) |
@@ -2177,12 +2161,18 @@ out: | |||
2177 | return 0; | 2161 | return 0; |
2178 | } | 2162 | } |
2179 | 2163 | ||
2164 | static const struct file_operations tcp6_afinfo_seq_fops = { | ||
2165 | .owner = THIS_MODULE, | ||
2166 | .open = tcp_seq_open, | ||
2167 | .read = seq_read, | ||
2168 | .llseek = seq_lseek, | ||
2169 | .release = seq_release_net | ||
2170 | }; | ||
2171 | |||
2180 | static struct tcp_seq_afinfo tcp6_seq_afinfo = { | 2172 | static struct tcp_seq_afinfo tcp6_seq_afinfo = { |
2181 | .name = "tcp6", | 2173 | .name = "tcp6", |
2182 | .family = AF_INET6, | 2174 | .family = AF_INET6, |
2183 | .seq_fops = { | 2175 | .seq_fops = &tcp6_afinfo_seq_fops, |
2184 | .owner = THIS_MODULE, | ||
2185 | }, | ||
2186 | .seq_ops = { | 2176 | .seq_ops = { |
2187 | .show = tcp6_seq_show, | 2177 | .show = tcp6_seq_show, |
2188 | }, | 2178 | }, |