diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 120 |
1 files changed, 61 insertions, 59 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 92f99927d12d..e2f25ea43b68 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -115,10 +115,10 @@ static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len, | |||
115 | 115 | ||
116 | static __u32 tcp_v6_init_sequence(struct sk_buff *skb) | 116 | static __u32 tcp_v6_init_sequence(struct sk_buff *skb) |
117 | { | 117 | { |
118 | return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32, | 118 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, |
119 | skb->nh.ipv6h->saddr.s6_addr32, | 119 | ipv6_hdr(skb)->saddr.s6_addr32, |
120 | skb->h.th->dest, | 120 | tcp_hdr(skb)->dest, |
121 | skb->h.th->source); | 121 | tcp_hdr(skb)->source); |
122 | } | 122 | } |
123 | 123 | ||
124 | static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | 124 | static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, |
@@ -486,7 +486,9 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
486 | struct sk_buff *pktopts = treq->pktopts; | 486 | struct sk_buff *pktopts = treq->pktopts; |
487 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); | 487 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); |
488 | if (rxopt->srcrt) | 488 | if (rxopt->srcrt) |
489 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt)); | 489 | opt = ipv6_invert_rthdr(sk, |
490 | (struct ipv6_rt_hdr *)(skb_network_header(pktopts) + | ||
491 | rxopt->srcrt)); | ||
490 | } | 492 | } |
491 | 493 | ||
492 | if (opt && opt->srcrt) { | 494 | if (opt && opt->srcrt) { |
@@ -507,7 +509,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
507 | 509 | ||
508 | skb = tcp_make_synack(sk, dst, req); | 510 | skb = tcp_make_synack(sk, dst, req); |
509 | if (skb) { | 511 | if (skb) { |
510 | struct tcphdr *th = skb->h.th; | 512 | struct tcphdr *th = tcp_hdr(skb); |
511 | 513 | ||
512 | th->check = tcp_v6_check(th, skb->len, | 514 | th->check = tcp_v6_check(th, skb->len, |
513 | &treq->loc_addr, &treq->rmt_addr, | 515 | &treq->loc_addr, &treq->rmt_addr, |
@@ -835,8 +837,8 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | |||
835 | { | 837 | { |
836 | __u8 *hash_location = NULL; | 838 | __u8 *hash_location = NULL; |
837 | struct tcp_md5sig_key *hash_expected; | 839 | struct tcp_md5sig_key *hash_expected; |
838 | struct ipv6hdr *ip6h = skb->nh.ipv6h; | 840 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
839 | struct tcphdr *th = skb->h.th; | 841 | struct tcphdr *th = tcp_hdr(skb); |
840 | int length = (th->doff << 2) - sizeof (*th); | 842 | int length = (th->doff << 2) - sizeof (*th); |
841 | int genhash; | 843 | int genhash; |
842 | u8 *ptr; | 844 | u8 *ptr; |
@@ -944,10 +946,11 @@ static struct timewait_sock_ops tcp6_timewait_sock_ops = { | |||
944 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) | 946 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) |
945 | { | 947 | { |
946 | struct ipv6_pinfo *np = inet6_sk(sk); | 948 | struct ipv6_pinfo *np = inet6_sk(sk); |
947 | struct tcphdr *th = skb->h.th; | 949 | struct tcphdr *th = tcp_hdr(skb); |
948 | 950 | ||
949 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 951 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
950 | th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); | 952 | th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); |
953 | skb->csum_start = skb_transport_header(skb) - skb->head; | ||
951 | skb->csum_offset = offsetof(struct tcphdr, check); | 954 | skb->csum_offset = offsetof(struct tcphdr, check); |
952 | } else { | 955 | } else { |
953 | th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, | 956 | th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, |
@@ -964,12 +967,13 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
964 | if (!pskb_may_pull(skb, sizeof(*th))) | 967 | if (!pskb_may_pull(skb, sizeof(*th))) |
965 | return -EINVAL; | 968 | return -EINVAL; |
966 | 969 | ||
967 | ipv6h = skb->nh.ipv6h; | 970 | ipv6h = ipv6_hdr(skb); |
968 | th = skb->h.th; | 971 | th = tcp_hdr(skb); |
969 | 972 | ||
970 | th->check = 0; | 973 | th->check = 0; |
971 | th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, | 974 | th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, |
972 | IPPROTO_TCP, 0); | 975 | IPPROTO_TCP, 0); |
976 | skb->csum_start = skb_transport_header(skb) - skb->head; | ||
973 | skb->csum_offset = offsetof(struct tcphdr, check); | 977 | skb->csum_offset = offsetof(struct tcphdr, check); |
974 | skb->ip_summed = CHECKSUM_PARTIAL; | 978 | skb->ip_summed = CHECKSUM_PARTIAL; |
975 | return 0; | 979 | return 0; |
@@ -977,7 +981,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
977 | 981 | ||
978 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | 982 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) |
979 | { | 983 | { |
980 | struct tcphdr *th = skb->h.th, *t1; | 984 | struct tcphdr *th = tcp_hdr(skb), *t1; |
981 | struct sk_buff *buff; | 985 | struct sk_buff *buff; |
982 | struct flowi fl; | 986 | struct flowi fl; |
983 | int tot_len = sizeof(*th); | 987 | int tot_len = sizeof(*th); |
@@ -993,7 +997,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
993 | 997 | ||
994 | #ifdef CONFIG_TCP_MD5SIG | 998 | #ifdef CONFIG_TCP_MD5SIG |
995 | if (sk) | 999 | if (sk) |
996 | key = tcp_v6_md5_do_lookup(sk, &skb->nh.ipv6h->daddr); | 1000 | key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr); |
997 | else | 1001 | else |
998 | key = NULL; | 1002 | key = NULL; |
999 | 1003 | ||
@@ -1037,20 +1041,18 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1037 | (TCPOPT_NOP << 16) | | 1041 | (TCPOPT_NOP << 16) | |
1038 | (TCPOPT_MD5SIG << 8) | | 1042 | (TCPOPT_MD5SIG << 8) | |
1039 | TCPOLEN_MD5SIG); | 1043 | TCPOLEN_MD5SIG); |
1040 | tcp_v6_do_calc_md5_hash((__u8*)&opt[1], | 1044 | tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key, |
1041 | key, | 1045 | &ipv6_hdr(skb)->daddr, |
1042 | &skb->nh.ipv6h->daddr, | 1046 | &ipv6_hdr(skb)->saddr, |
1043 | &skb->nh.ipv6h->saddr, | 1047 | t1, IPPROTO_TCP, tot_len); |
1044 | t1, IPPROTO_TCP, | ||
1045 | tot_len); | ||
1046 | } | 1048 | } |
1047 | #endif | 1049 | #endif |
1048 | 1050 | ||
1049 | buff->csum = csum_partial((char *)t1, sizeof(*t1), 0); | 1051 | buff->csum = csum_partial((char *)t1, sizeof(*t1), 0); |
1050 | 1052 | ||
1051 | memset(&fl, 0, sizeof(fl)); | 1053 | memset(&fl, 0, sizeof(fl)); |
1052 | ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); | 1054 | ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr); |
1053 | ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); | 1055 | ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr); |
1054 | 1056 | ||
1055 | t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, | 1057 | t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, |
1056 | sizeof(*t1), IPPROTO_TCP, | 1058 | sizeof(*t1), IPPROTO_TCP, |
@@ -1079,7 +1081,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1079 | static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | 1081 | static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, |
1080 | struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts) | 1082 | struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts) |
1081 | { | 1083 | { |
1082 | struct tcphdr *th = skb->h.th, *t1; | 1084 | struct tcphdr *th = tcp_hdr(skb), *t1; |
1083 | struct sk_buff *buff; | 1085 | struct sk_buff *buff; |
1084 | struct flowi fl; | 1086 | struct flowi fl; |
1085 | int tot_len = sizeof(struct tcphdr); | 1087 | int tot_len = sizeof(struct tcphdr); |
@@ -1091,7 +1093,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1091 | 1093 | ||
1092 | #ifdef CONFIG_TCP_MD5SIG | 1094 | #ifdef CONFIG_TCP_MD5SIG |
1093 | if (!tw && skb->sk) { | 1095 | if (!tw && skb->sk) { |
1094 | key = tcp_v6_md5_do_lookup(skb->sk, &skb->nh.ipv6h->daddr); | 1096 | key = tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr); |
1095 | } else if (tw && tw->tw_md5_keylen) { | 1097 | } else if (tw && tw->tw_md5_keylen) { |
1096 | tw_key.key = tw->tw_md5_key; | 1098 | tw_key.key = tw->tw_md5_key; |
1097 | tw_key.keylen = tw->tw_md5_keylen; | 1099 | tw_key.keylen = tw->tw_md5_keylen; |
@@ -1140,20 +1142,18 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1140 | if (key) { | 1142 | if (key) { |
1141 | *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | | 1143 | *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | |
1142 | (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); | 1144 | (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); |
1143 | tcp_v6_do_calc_md5_hash((__u8 *)topt, | 1145 | tcp_v6_do_calc_md5_hash((__u8 *)topt, key, |
1144 | key, | 1146 | &ipv6_hdr(skb)->daddr, |
1145 | &skb->nh.ipv6h->daddr, | 1147 | &ipv6_hdr(skb)->saddr, |
1146 | &skb->nh.ipv6h->saddr, | 1148 | t1, IPPROTO_TCP, tot_len); |
1147 | t1, IPPROTO_TCP, | ||
1148 | tot_len); | ||
1149 | } | 1149 | } |
1150 | #endif | 1150 | #endif |
1151 | 1151 | ||
1152 | buff->csum = csum_partial((char *)t1, tot_len, 0); | 1152 | buff->csum = csum_partial((char *)t1, tot_len, 0); |
1153 | 1153 | ||
1154 | memset(&fl, 0, sizeof(fl)); | 1154 | memset(&fl, 0, sizeof(fl)); |
1155 | ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr); | 1155 | ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr); |
1156 | ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr); | 1156 | ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr); |
1157 | 1157 | ||
1158 | t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, | 1158 | t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst, |
1159 | tot_len, IPPROTO_TCP, | 1159 | tot_len, IPPROTO_TCP, |
@@ -1197,18 +1197,18 @@ static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) | |||
1197 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | 1197 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) |
1198 | { | 1198 | { |
1199 | struct request_sock *req, **prev; | 1199 | struct request_sock *req, **prev; |
1200 | const struct tcphdr *th = skb->h.th; | 1200 | const struct tcphdr *th = tcp_hdr(skb); |
1201 | struct sock *nsk; | 1201 | struct sock *nsk; |
1202 | 1202 | ||
1203 | /* Find possible connection requests. */ | 1203 | /* Find possible connection requests. */ |
1204 | req = inet6_csk_search_req(sk, &prev, th->source, | 1204 | req = inet6_csk_search_req(sk, &prev, th->source, |
1205 | &skb->nh.ipv6h->saddr, | 1205 | &ipv6_hdr(skb)->saddr, |
1206 | &skb->nh.ipv6h->daddr, inet6_iif(skb)); | 1206 | &ipv6_hdr(skb)->daddr, inet6_iif(skb)); |
1207 | if (req) | 1207 | if (req) |
1208 | return tcp_check_req(sk, skb, req, prev); | 1208 | return tcp_check_req(sk, skb, req, prev); |
1209 | 1209 | ||
1210 | nsk = __inet6_lookup_established(&tcp_hashinfo, &skb->nh.ipv6h->saddr, | 1210 | nsk = __inet6_lookup_established(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, |
1211 | th->source, &skb->nh.ipv6h->daddr, | 1211 | th->source, &ipv6_hdr(skb)->daddr, |
1212 | ntohs(th->dest), inet6_iif(skb)); | 1212 | ntohs(th->dest), inet6_iif(skb)); |
1213 | 1213 | ||
1214 | if (nsk) { | 1214 | if (nsk) { |
@@ -1275,9 +1275,9 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1275 | tcp_openreq_init(req, &tmp_opt, skb); | 1275 | tcp_openreq_init(req, &tmp_opt, skb); |
1276 | 1276 | ||
1277 | treq = inet6_rsk(req); | 1277 | treq = inet6_rsk(req); |
1278 | ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr); | 1278 | ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); |
1279 | ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr); | 1279 | ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); |
1280 | TCP_ECN_create_request(req, skb->h.th); | 1280 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
1281 | treq->pktopts = NULL; | 1281 | treq->pktopts = NULL; |
1282 | if (ipv6_opt_accepted(sk, skb) || | 1282 | if (ipv6_opt_accepted(sk, skb) || |
1283 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || | 1283 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || |
@@ -1363,7 +1363,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1363 | newnp->pktoptions = NULL; | 1363 | newnp->pktoptions = NULL; |
1364 | newnp->opt = NULL; | 1364 | newnp->opt = NULL; |
1365 | newnp->mcast_oif = inet6_iif(skb); | 1365 | newnp->mcast_oif = inet6_iif(skb); |
1366 | newnp->mcast_hops = skb->nh.ipv6h->hop_limit; | 1366 | newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; |
1367 | 1367 | ||
1368 | /* | 1368 | /* |
1369 | * No need to charge this sock to the relevant IPv6 refcnt debug socks count | 1369 | * No need to charge this sock to the relevant IPv6 refcnt debug socks count |
@@ -1389,7 +1389,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1389 | opt == NULL && treq->pktopts) { | 1389 | opt == NULL && treq->pktopts) { |
1390 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); | 1390 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); |
1391 | if (rxopt->srcrt) | 1391 | if (rxopt->srcrt) |
1392 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr *)(treq->pktopts->nh.raw + rxopt->srcrt)); | 1392 | opt = ipv6_invert_rthdr(sk, |
1393 | (struct ipv6_rt_hdr *)(skb_network_header(treq->pktopts) + | ||
1394 | rxopt->srcrt)); | ||
1393 | } | 1395 | } |
1394 | 1396 | ||
1395 | if (dst == NULL) { | 1397 | if (dst == NULL) { |
@@ -1469,7 +1471,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1469 | } | 1471 | } |
1470 | newnp->opt = NULL; | 1472 | newnp->opt = NULL; |
1471 | newnp->mcast_oif = inet6_iif(skb); | 1473 | newnp->mcast_oif = inet6_iif(skb); |
1472 | newnp->mcast_hops = skb->nh.ipv6h->hop_limit; | 1474 | newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; |
1473 | 1475 | ||
1474 | /* Clone native IPv6 options from listening socket (if any) | 1476 | /* Clone native IPv6 options from listening socket (if any) |
1475 | 1477 | ||
@@ -1528,15 +1530,16 @@ out: | |||
1528 | static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) | 1530 | static __sum16 tcp_v6_checksum_init(struct sk_buff *skb) |
1529 | { | 1531 | { |
1530 | if (skb->ip_summed == CHECKSUM_COMPLETE) { | 1532 | if (skb->ip_summed == CHECKSUM_COMPLETE) { |
1531 | if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, | 1533 | if (!tcp_v6_check(tcp_hdr(skb), skb->len, &ipv6_hdr(skb)->saddr, |
1532 | &skb->nh.ipv6h->daddr,skb->csum)) { | 1534 | &ipv6_hdr(skb)->daddr, skb->csum)) { |
1533 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1535 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1534 | return 0; | 1536 | return 0; |
1535 | } | 1537 | } |
1536 | } | 1538 | } |
1537 | 1539 | ||
1538 | skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, | 1540 | skb->csum = ~csum_unfold(tcp_v6_check(tcp_hdr(skb), skb->len, |
1539 | &skb->nh.ipv6h->daddr, 0)); | 1541 | &ipv6_hdr(skb)->saddr, |
1542 | &ipv6_hdr(skb)->daddr, 0)); | ||
1540 | 1543 | ||
1541 | if (skb->len <= 76) { | 1544 | if (skb->len <= 76) { |
1542 | return __skb_checksum_complete(skb); | 1545 | return __skb_checksum_complete(skb); |
@@ -1600,7 +1603,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1600 | 1603 | ||
1601 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1604 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1602 | TCP_CHECK_TIMER(sk); | 1605 | TCP_CHECK_TIMER(sk); |
1603 | if (tcp_rcv_established(sk, skb, skb->h.th, skb->len)) | 1606 | if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) |
1604 | goto reset; | 1607 | goto reset; |
1605 | TCP_CHECK_TIMER(sk); | 1608 | TCP_CHECK_TIMER(sk); |
1606 | if (opt_skb) | 1609 | if (opt_skb) |
@@ -1608,7 +1611,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1608 | return 0; | 1611 | return 0; |
1609 | } | 1612 | } |
1610 | 1613 | ||
1611 | if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb)) | 1614 | if (skb->len < tcp_hdrlen(skb) || tcp_checksum_complete(skb)) |
1612 | goto csum_err; | 1615 | goto csum_err; |
1613 | 1616 | ||
1614 | if (sk->sk_state == TCP_LISTEN) { | 1617 | if (sk->sk_state == TCP_LISTEN) { |
@@ -1631,7 +1634,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1631 | } | 1634 | } |
1632 | 1635 | ||
1633 | TCP_CHECK_TIMER(sk); | 1636 | TCP_CHECK_TIMER(sk); |
1634 | if (tcp_rcv_state_process(sk, skb, skb->h.th, skb->len)) | 1637 | if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) |
1635 | goto reset; | 1638 | goto reset; |
1636 | TCP_CHECK_TIMER(sk); | 1639 | TCP_CHECK_TIMER(sk); |
1637 | if (opt_skb) | 1640 | if (opt_skb) |
@@ -1664,7 +1667,7 @@ ipv6_pktoptions: | |||
1664 | if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo) | 1667 | if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo) |
1665 | np->mcast_oif = inet6_iif(opt_skb); | 1668 | np->mcast_oif = inet6_iif(opt_skb); |
1666 | if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) | 1669 | if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) |
1667 | np->mcast_hops = opt_skb->nh.ipv6h->hop_limit; | 1670 | np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit; |
1668 | if (ipv6_opt_accepted(sk, opt_skb)) { | 1671 | if (ipv6_opt_accepted(sk, opt_skb)) { |
1669 | skb_set_owner_r(opt_skb, sk); | 1672 | skb_set_owner_r(opt_skb, sk); |
1670 | opt_skb = xchg(&np->pktoptions, opt_skb); | 1673 | opt_skb = xchg(&np->pktoptions, opt_skb); |
@@ -1697,28 +1700,27 @@ static int tcp_v6_rcv(struct sk_buff **pskb) | |||
1697 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) | 1700 | if (!pskb_may_pull(skb, sizeof(struct tcphdr))) |
1698 | goto discard_it; | 1701 | goto discard_it; |
1699 | 1702 | ||
1700 | th = skb->h.th; | 1703 | th = tcp_hdr(skb); |
1701 | 1704 | ||
1702 | if (th->doff < sizeof(struct tcphdr)/4) | 1705 | if (th->doff < sizeof(struct tcphdr)/4) |
1703 | goto bad_packet; | 1706 | goto bad_packet; |
1704 | if (!pskb_may_pull(skb, th->doff*4)) | 1707 | if (!pskb_may_pull(skb, th->doff*4)) |
1705 | goto discard_it; | 1708 | goto discard_it; |
1706 | 1709 | ||
1707 | if ((skb->ip_summed != CHECKSUM_UNNECESSARY && | 1710 | if (!skb_csum_unnecessary(skb) && tcp_v6_checksum_init(skb)) |
1708 | tcp_v6_checksum_init(skb))) | ||
1709 | goto bad_packet; | 1711 | goto bad_packet; |
1710 | 1712 | ||
1711 | th = skb->h.th; | 1713 | th = tcp_hdr(skb); |
1712 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); | 1714 | TCP_SKB_CB(skb)->seq = ntohl(th->seq); |
1713 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + | 1715 | TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + |
1714 | skb->len - th->doff*4); | 1716 | skb->len - th->doff*4); |
1715 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); | 1717 | TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); |
1716 | TCP_SKB_CB(skb)->when = 0; | 1718 | TCP_SKB_CB(skb)->when = 0; |
1717 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h); | 1719 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb)); |
1718 | TCP_SKB_CB(skb)->sacked = 0; | 1720 | TCP_SKB_CB(skb)->sacked = 0; |
1719 | 1721 | ||
1720 | sk = __inet6_lookup(&tcp_hashinfo, &skb->nh.ipv6h->saddr, th->source, | 1722 | sk = __inet6_lookup(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, th->source, |
1721 | &skb->nh.ipv6h->daddr, ntohs(th->dest), | 1723 | &ipv6_hdr(skb)->daddr, ntohs(th->dest), |
1722 | inet6_iif(skb)); | 1724 | inet6_iif(skb)); |
1723 | 1725 | ||
1724 | if (!sk) | 1726 | if (!sk) |
@@ -1798,7 +1800,7 @@ do_time_wait: | |||
1798 | struct sock *sk2; | 1800 | struct sock *sk2; |
1799 | 1801 | ||
1800 | sk2 = inet6_lookup_listener(&tcp_hashinfo, | 1802 | sk2 = inet6_lookup_listener(&tcp_hashinfo, |
1801 | &skb->nh.ipv6h->daddr, | 1803 | &ipv6_hdr(skb)->daddr, |
1802 | ntohs(th->dest), inet6_iif(skb)); | 1804 | ntohs(th->dest), inet6_iif(skb)); |
1803 | if (sk2 != NULL) { | 1805 | if (sk2 != NULL) { |
1804 | struct inet_timewait_sock *tw = inet_twsk(sk); | 1806 | struct inet_timewait_sock *tw = inet_twsk(sk); |
@@ -1945,6 +1947,7 @@ static int tcp_v6_destroy_sock(struct sock *sk) | |||
1945 | return inet6_destroy_sock(sk); | 1947 | return inet6_destroy_sock(sk); |
1946 | } | 1948 | } |
1947 | 1949 | ||
1950 | #ifdef CONFIG_PROC_FS | ||
1948 | /* Proc filesystem TCPv6 sock list dumping. */ | 1951 | /* Proc filesystem TCPv6 sock list dumping. */ |
1949 | static void get_openreq6(struct seq_file *seq, | 1952 | static void get_openreq6(struct seq_file *seq, |
1950 | struct sock *sk, struct request_sock *req, int i, int uid) | 1953 | struct sock *sk, struct request_sock *req, int i, int uid) |
@@ -2061,7 +2064,6 @@ static void get_timewait6_sock(struct seq_file *seq, | |||
2061 | atomic_read(&tw->tw_refcnt), tw); | 2064 | atomic_read(&tw->tw_refcnt), tw); |
2062 | } | 2065 | } |
2063 | 2066 | ||
2064 | #ifdef CONFIG_PROC_FS | ||
2065 | static int tcp6_seq_show(struct seq_file *seq, void *v) | 2067 | static int tcp6_seq_show(struct seq_file *seq, void *v) |
2066 | { | 2068 | { |
2067 | struct tcp_iter_state *st; | 2069 | struct tcp_iter_state *st; |