diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 148 |
1 files changed, 73 insertions, 75 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0f69e800a0ad..2414937f2a83 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -65,7 +65,7 @@ | |||
65 | #include <linux/seq_file.h> | 65 | #include <linux/seq_file.h> |
66 | 66 | ||
67 | static void tcp_v6_send_reset(struct sk_buff *skb); | 67 | static void tcp_v6_send_reset(struct sk_buff *skb); |
68 | static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req); | 68 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); |
69 | static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, | 69 | static void tcp_v6_send_check(struct sock *sk, struct tcphdr *th, int len, |
70 | struct sk_buff *skb); | 70 | struct sk_buff *skb); |
71 | 71 | ||
@@ -394,24 +394,26 @@ static u32 tcp_v6_synq_hash(struct in6_addr *raddr, u16 rport, u32 rnd) | |||
394 | return c & (TCP_SYNQ_HSIZE - 1); | 394 | return c & (TCP_SYNQ_HSIZE - 1); |
395 | } | 395 | } |
396 | 396 | ||
397 | static struct open_request *tcp_v6_search_req(struct tcp_sock *tp, | 397 | static struct request_sock *tcp_v6_search_req(struct tcp_sock *tp, |
398 | struct open_request ***prevp, | 398 | struct request_sock ***prevp, |
399 | __u16 rport, | 399 | __u16 rport, |
400 | struct in6_addr *raddr, | 400 | struct in6_addr *raddr, |
401 | struct in6_addr *laddr, | 401 | struct in6_addr *laddr, |
402 | int iif) | 402 | int iif) |
403 | { | 403 | { |
404 | struct tcp_listen_opt *lopt = tp->listen_opt; | 404 | struct listen_sock *lopt = tp->accept_queue.listen_opt; |
405 | struct open_request *req, **prev; | 405 | struct request_sock *req, **prev; |
406 | 406 | ||
407 | for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)]; | 407 | for (prev = &lopt->syn_table[tcp_v6_synq_hash(raddr, rport, lopt->hash_rnd)]; |
408 | (req = *prev) != NULL; | 408 | (req = *prev) != NULL; |
409 | prev = &req->dl_next) { | 409 | prev = &req->dl_next) { |
410 | if (req->rmt_port == rport && | 410 | const struct tcp6_request_sock *treq = tcp6_rsk(req); |
411 | req->class->family == AF_INET6 && | 411 | |
412 | ipv6_addr_equal(&req->af.v6_req.rmt_addr, raddr) && | 412 | if (inet_rsk(req)->rmt_port == rport && |
413 | ipv6_addr_equal(&req->af.v6_req.loc_addr, laddr) && | 413 | req->rsk_ops->family == AF_INET6 && |
414 | (!req->af.v6_req.iif || req->af.v6_req.iif == iif)) { | 414 | ipv6_addr_equal(&treq->rmt_addr, raddr) && |
415 | ipv6_addr_equal(&treq->loc_addr, laddr) && | ||
416 | (!treq->iif || treq->iif == iif)) { | ||
415 | BUG_TRAP(req->sk == NULL); | 417 | BUG_TRAP(req->sk == NULL); |
416 | *prevp = prev; | 418 | *prevp = prev; |
417 | return req; | 419 | return req; |
@@ -906,9 +908,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
906 | 908 | ||
907 | icmpv6_err_convert(type, code, &err); | 909 | icmpv6_err_convert(type, code, &err); |
908 | 910 | ||
909 | /* Might be for an open_request */ | 911 | /* Might be for an request_sock */ |
910 | switch (sk->sk_state) { | 912 | switch (sk->sk_state) { |
911 | struct open_request *req, **prev; | 913 | struct request_sock *req, **prev; |
912 | case TCP_LISTEN: | 914 | case TCP_LISTEN: |
913 | if (sock_owned_by_user(sk)) | 915 | if (sock_owned_by_user(sk)) |
914 | goto out; | 916 | goto out; |
@@ -923,7 +925,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
923 | */ | 925 | */ |
924 | BUG_TRAP(req->sk == NULL); | 926 | BUG_TRAP(req->sk == NULL); |
925 | 927 | ||
926 | if (seq != req->snt_isn) { | 928 | if (seq != tcp_rsk(req)->snt_isn) { |
927 | NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); | 929 | NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); |
928 | goto out; | 930 | goto out; |
929 | } | 931 | } |
@@ -957,9 +959,10 @@ out: | |||
957 | } | 959 | } |
958 | 960 | ||
959 | 961 | ||
960 | static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | 962 | static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, |
961 | struct dst_entry *dst) | 963 | struct dst_entry *dst) |
962 | { | 964 | { |
965 | struct tcp6_request_sock *treq = tcp6_rsk(req); | ||
963 | struct ipv6_pinfo *np = inet6_sk(sk); | 966 | struct ipv6_pinfo *np = inet6_sk(sk); |
964 | struct sk_buff * skb; | 967 | struct sk_buff * skb; |
965 | struct ipv6_txoptions *opt = NULL; | 968 | struct ipv6_txoptions *opt = NULL; |
@@ -969,19 +972,19 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | |||
969 | 972 | ||
970 | memset(&fl, 0, sizeof(fl)); | 973 | memset(&fl, 0, sizeof(fl)); |
971 | fl.proto = IPPROTO_TCP; | 974 | fl.proto = IPPROTO_TCP; |
972 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 975 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
973 | ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); | 976 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
974 | fl.fl6_flowlabel = 0; | 977 | fl.fl6_flowlabel = 0; |
975 | fl.oif = req->af.v6_req.iif; | 978 | fl.oif = treq->iif; |
976 | fl.fl_ip_dport = req->rmt_port; | 979 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
977 | fl.fl_ip_sport = inet_sk(sk)->sport; | 980 | fl.fl_ip_sport = inet_sk(sk)->sport; |
978 | 981 | ||
979 | if (dst == NULL) { | 982 | if (dst == NULL) { |
980 | opt = np->opt; | 983 | opt = np->opt; |
981 | if (opt == NULL && | 984 | if (opt == NULL && |
982 | np->rxopt.bits.srcrt == 2 && | 985 | np->rxopt.bits.srcrt == 2 && |
983 | req->af.v6_req.pktopts) { | 986 | treq->pktopts) { |
984 | struct sk_buff *pktopts = req->af.v6_req.pktopts; | 987 | struct sk_buff *pktopts = treq->pktopts; |
985 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); | 988 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); |
986 | if (rxopt->srcrt) | 989 | if (rxopt->srcrt) |
987 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt)); | 990 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt)); |
@@ -1008,10 +1011,10 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req, | |||
1008 | struct tcphdr *th = skb->h.th; | 1011 | struct tcphdr *th = skb->h.th; |
1009 | 1012 | ||
1010 | th->check = tcp_v6_check(th, skb->len, | 1013 | th->check = tcp_v6_check(th, skb->len, |
1011 | &req->af.v6_req.loc_addr, &req->af.v6_req.rmt_addr, | 1014 | &treq->loc_addr, &treq->rmt_addr, |
1012 | csum_partial((char *)th, skb->len, skb->csum)); | 1015 | csum_partial((char *)th, skb->len, skb->csum)); |
1013 | 1016 | ||
1014 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 1017 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
1015 | err = ip6_xmit(sk, skb, &fl, opt, 0); | 1018 | err = ip6_xmit(sk, skb, &fl, opt, 0); |
1016 | if (err == NET_XMIT_CN) | 1019 | if (err == NET_XMIT_CN) |
1017 | err = 0; | 1020 | err = 0; |
@@ -1024,17 +1027,18 @@ done: | |||
1024 | return err; | 1027 | return err; |
1025 | } | 1028 | } |
1026 | 1029 | ||
1027 | static void tcp_v6_or_free(struct open_request *req) | 1030 | static void tcp_v6_reqsk_destructor(struct request_sock *req) |
1028 | { | 1031 | { |
1029 | if (req->af.v6_req.pktopts) | 1032 | if (tcp6_rsk(req)->pktopts) |
1030 | kfree_skb(req->af.v6_req.pktopts); | 1033 | kfree_skb(tcp6_rsk(req)->pktopts); |
1031 | } | 1034 | } |
1032 | 1035 | ||
1033 | static struct or_calltable or_ipv6 = { | 1036 | static struct request_sock_ops tcp6_request_sock_ops = { |
1034 | .family = AF_INET6, | 1037 | .family = AF_INET6, |
1038 | .obj_size = sizeof(struct tcp6_request_sock), | ||
1035 | .rtx_syn_ack = tcp_v6_send_synack, | 1039 | .rtx_syn_ack = tcp_v6_send_synack, |
1036 | .send_ack = tcp_v6_or_send_ack, | 1040 | .send_ack = tcp_v6_reqsk_send_ack, |
1037 | .destructor = tcp_v6_or_free, | 1041 | .destructor = tcp_v6_reqsk_destructor, |
1038 | .send_reset = tcp_v6_send_reset | 1042 | .send_reset = tcp_v6_send_reset |
1039 | }; | 1043 | }; |
1040 | 1044 | ||
@@ -1219,15 +1223,15 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
1219 | tcp_tw_put(tw); | 1223 | tcp_tw_put(tw); |
1220 | } | 1224 | } |
1221 | 1225 | ||
1222 | static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req) | 1226 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) |
1223 | { | 1227 | { |
1224 | tcp_v6_send_ack(skb, req->snt_isn+1, req->rcv_isn+1, req->rcv_wnd, req->ts_recent); | 1228 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent); |
1225 | } | 1229 | } |
1226 | 1230 | ||
1227 | 1231 | ||
1228 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | 1232 | static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) |
1229 | { | 1233 | { |
1230 | struct open_request *req, **prev; | 1234 | struct request_sock *req, **prev; |
1231 | struct tcphdr *th = skb->h.th; | 1235 | struct tcphdr *th = skb->h.th; |
1232 | struct tcp_sock *tp = tcp_sk(sk); | 1236 | struct tcp_sock *tp = tcp_sk(sk); |
1233 | struct sock *nsk; | 1237 | struct sock *nsk; |
@@ -1260,21 +1264,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
1260 | return sk; | 1264 | return sk; |
1261 | } | 1265 | } |
1262 | 1266 | ||
1263 | static void tcp_v6_synq_add(struct sock *sk, struct open_request *req) | 1267 | static void tcp_v6_synq_add(struct sock *sk, struct request_sock *req) |
1264 | { | 1268 | { |
1265 | struct tcp_sock *tp = tcp_sk(sk); | 1269 | struct tcp_sock *tp = tcp_sk(sk); |
1266 | struct tcp_listen_opt *lopt = tp->listen_opt; | 1270 | struct listen_sock *lopt = tp->accept_queue.listen_opt; |
1267 | u32 h = tcp_v6_synq_hash(&req->af.v6_req.rmt_addr, req->rmt_port, lopt->hash_rnd); | 1271 | u32 h = tcp_v6_synq_hash(&tcp6_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port, lopt->hash_rnd); |
1268 | |||
1269 | req->sk = NULL; | ||
1270 | req->expires = jiffies + TCP_TIMEOUT_INIT; | ||
1271 | req->retrans = 0; | ||
1272 | req->dl_next = lopt->syn_table[h]; | ||
1273 | |||
1274 | write_lock(&tp->syn_wait_lock); | ||
1275 | lopt->syn_table[h] = req; | ||
1276 | write_unlock(&tp->syn_wait_lock); | ||
1277 | 1272 | ||
1273 | reqsk_queue_hash_req(&tp->accept_queue, h, req, TCP_TIMEOUT_INIT); | ||
1278 | tcp_synq_added(sk); | 1274 | tcp_synq_added(sk); |
1279 | } | 1275 | } |
1280 | 1276 | ||
@@ -1284,10 +1280,11 @@ static void tcp_v6_synq_add(struct sock *sk, struct open_request *req) | |||
1284 | */ | 1280 | */ |
1285 | static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | 1281 | static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) |
1286 | { | 1282 | { |
1283 | struct tcp6_request_sock *treq; | ||
1287 | struct ipv6_pinfo *np = inet6_sk(sk); | 1284 | struct ipv6_pinfo *np = inet6_sk(sk); |
1288 | struct tcp_options_received tmp_opt; | 1285 | struct tcp_options_received tmp_opt; |
1289 | struct tcp_sock *tp = tcp_sk(sk); | 1286 | struct tcp_sock *tp = tcp_sk(sk); |
1290 | struct open_request *req = NULL; | 1287 | struct request_sock *req = NULL; |
1291 | __u32 isn = TCP_SKB_CB(skb)->when; | 1288 | __u32 isn = TCP_SKB_CB(skb)->when; |
1292 | 1289 | ||
1293 | if (skb->protocol == htons(ETH_P_IP)) | 1290 | if (skb->protocol == htons(ETH_P_IP)) |
@@ -1308,7 +1305,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1308 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) | 1305 | if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1) |
1309 | goto drop; | 1306 | goto drop; |
1310 | 1307 | ||
1311 | req = tcp_openreq_alloc(); | 1308 | req = reqsk_alloc(&tcp6_request_sock_ops); |
1312 | if (req == NULL) | 1309 | if (req == NULL) |
1313 | goto drop; | 1310 | goto drop; |
1314 | 1311 | ||
@@ -1321,28 +1318,28 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1321 | tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; | 1318 | tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; |
1322 | tcp_openreq_init(req, &tmp_opt, skb); | 1319 | tcp_openreq_init(req, &tmp_opt, skb); |
1323 | 1320 | ||
1324 | req->class = &or_ipv6; | 1321 | treq = tcp6_rsk(req); |
1325 | ipv6_addr_copy(&req->af.v6_req.rmt_addr, &skb->nh.ipv6h->saddr); | 1322 | ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr); |
1326 | ipv6_addr_copy(&req->af.v6_req.loc_addr, &skb->nh.ipv6h->daddr); | 1323 | ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr); |
1327 | TCP_ECN_create_request(req, skb->h.th); | 1324 | TCP_ECN_create_request(req, skb->h.th); |
1328 | req->af.v6_req.pktopts = NULL; | 1325 | treq->pktopts = NULL; |
1329 | if (ipv6_opt_accepted(sk, skb) || | 1326 | if (ipv6_opt_accepted(sk, skb) || |
1330 | np->rxopt.bits.rxinfo || | 1327 | np->rxopt.bits.rxinfo || |
1331 | np->rxopt.bits.rxhlim) { | 1328 | np->rxopt.bits.rxhlim) { |
1332 | atomic_inc(&skb->users); | 1329 | atomic_inc(&skb->users); |
1333 | req->af.v6_req.pktopts = skb; | 1330 | treq->pktopts = skb; |
1334 | } | 1331 | } |
1335 | req->af.v6_req.iif = sk->sk_bound_dev_if; | 1332 | treq->iif = sk->sk_bound_dev_if; |
1336 | 1333 | ||
1337 | /* So that link locals have meaning */ | 1334 | /* So that link locals have meaning */ |
1338 | if (!sk->sk_bound_dev_if && | 1335 | if (!sk->sk_bound_dev_if && |
1339 | ipv6_addr_type(&req->af.v6_req.rmt_addr) & IPV6_ADDR_LINKLOCAL) | 1336 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) |
1340 | req->af.v6_req.iif = tcp_v6_iif(skb); | 1337 | treq->iif = tcp_v6_iif(skb); |
1341 | 1338 | ||
1342 | if (isn == 0) | 1339 | if (isn == 0) |
1343 | isn = tcp_v6_init_sequence(sk,skb); | 1340 | isn = tcp_v6_init_sequence(sk,skb); |
1344 | 1341 | ||
1345 | req->snt_isn = isn; | 1342 | tcp_rsk(req)->snt_isn = isn; |
1346 | 1343 | ||
1347 | if (tcp_v6_send_synack(sk, req, NULL)) | 1344 | if (tcp_v6_send_synack(sk, req, NULL)) |
1348 | goto drop; | 1345 | goto drop; |
@@ -1353,16 +1350,17 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1353 | 1350 | ||
1354 | drop: | 1351 | drop: |
1355 | if (req) | 1352 | if (req) |
1356 | tcp_openreq_free(req); | 1353 | reqsk_free(req); |
1357 | 1354 | ||
1358 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | 1355 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); |
1359 | return 0; /* don't send reset */ | 1356 | return 0; /* don't send reset */ |
1360 | } | 1357 | } |
1361 | 1358 | ||
1362 | static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | 1359 | static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, |
1363 | struct open_request *req, | 1360 | struct request_sock *req, |
1364 | struct dst_entry *dst) | 1361 | struct dst_entry *dst) |
1365 | { | 1362 | { |
1363 | struct tcp6_request_sock *treq = tcp6_rsk(req); | ||
1366 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 1364 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
1367 | struct tcp6_sock *newtcp6sk; | 1365 | struct tcp6_sock *newtcp6sk; |
1368 | struct inet_sock *newinet; | 1366 | struct inet_sock *newinet; |
@@ -1426,10 +1424,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1426 | goto out_overflow; | 1424 | goto out_overflow; |
1427 | 1425 | ||
1428 | if (np->rxopt.bits.srcrt == 2 && | 1426 | if (np->rxopt.bits.srcrt == 2 && |
1429 | opt == NULL && req->af.v6_req.pktopts) { | 1427 | opt == NULL && treq->pktopts) { |
1430 | struct inet6_skb_parm *rxopt = IP6CB(req->af.v6_req.pktopts); | 1428 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); |
1431 | if (rxopt->srcrt) | 1429 | if (rxopt->srcrt) |
1432 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(req->af.v6_req.pktopts->nh.raw+rxopt->srcrt)); | 1430 | opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr *)(treq->pktopts->nh.raw + rxopt->srcrt)); |
1433 | } | 1431 | } |
1434 | 1432 | ||
1435 | if (dst == NULL) { | 1433 | if (dst == NULL) { |
@@ -1438,16 +1436,16 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1438 | 1436 | ||
1439 | memset(&fl, 0, sizeof(fl)); | 1437 | memset(&fl, 0, sizeof(fl)); |
1440 | fl.proto = IPPROTO_TCP; | 1438 | fl.proto = IPPROTO_TCP; |
1441 | ipv6_addr_copy(&fl.fl6_dst, &req->af.v6_req.rmt_addr); | 1439 | ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); |
1442 | if (opt && opt->srcrt) { | 1440 | if (opt && opt->srcrt) { |
1443 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | 1441 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; |
1444 | ipv6_addr_copy(&final, &fl.fl6_dst); | 1442 | ipv6_addr_copy(&final, &fl.fl6_dst); |
1445 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | 1443 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); |
1446 | final_p = &final; | 1444 | final_p = &final; |
1447 | } | 1445 | } |
1448 | ipv6_addr_copy(&fl.fl6_src, &req->af.v6_req.loc_addr); | 1446 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
1449 | fl.oif = sk->sk_bound_dev_if; | 1447 | fl.oif = sk->sk_bound_dev_if; |
1450 | fl.fl_ip_dport = req->rmt_port; | 1448 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
1451 | fl.fl_ip_sport = inet_sk(sk)->sport; | 1449 | fl.fl_ip_sport = inet_sk(sk)->sport; |
1452 | 1450 | ||
1453 | if (ip6_dst_lookup(sk, &dst, &fl)) | 1451 | if (ip6_dst_lookup(sk, &dst, &fl)) |
@@ -1482,10 +1480,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1482 | 1480 | ||
1483 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 1481 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
1484 | 1482 | ||
1485 | ipv6_addr_copy(&newnp->daddr, &req->af.v6_req.rmt_addr); | 1483 | ipv6_addr_copy(&newnp->daddr, &treq->rmt_addr); |
1486 | ipv6_addr_copy(&newnp->saddr, &req->af.v6_req.loc_addr); | 1484 | ipv6_addr_copy(&newnp->saddr, &treq->loc_addr); |
1487 | ipv6_addr_copy(&newnp->rcv_saddr, &req->af.v6_req.loc_addr); | 1485 | ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); |
1488 | newsk->sk_bound_dev_if = req->af.v6_req.iif; | 1486 | newsk->sk_bound_dev_if = treq->iif; |
1489 | 1487 | ||
1490 | /* Now IPv6 options... | 1488 | /* Now IPv6 options... |
1491 | 1489 | ||
@@ -1498,11 +1496,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1498 | 1496 | ||
1499 | /* Clone pktoptions received with SYN */ | 1497 | /* Clone pktoptions received with SYN */ |
1500 | newnp->pktoptions = NULL; | 1498 | newnp->pktoptions = NULL; |
1501 | if (req->af.v6_req.pktopts) { | 1499 | if (treq->pktopts != NULL) { |
1502 | newnp->pktoptions = skb_clone(req->af.v6_req.pktopts, | 1500 | newnp->pktoptions = skb_clone(treq->pktopts, GFP_ATOMIC); |
1503 | GFP_ATOMIC); | 1501 | kfree_skb(treq->pktopts); |
1504 | kfree_skb(req->af.v6_req.pktopts); | 1502 | treq->pktopts = NULL; |
1505 | req->af.v6_req.pktopts = NULL; | ||
1506 | if (newnp->pktoptions) | 1503 | if (newnp->pktoptions) |
1507 | skb_set_owner_r(newnp->pktoptions, newsk); | 1504 | skb_set_owner_r(newnp->pktoptions, newsk); |
1508 | } | 1505 | } |
@@ -2050,7 +2047,7 @@ static int tcp_v6_destroy_sock(struct sock *sk) | |||
2050 | 2047 | ||
2051 | /* Proc filesystem TCPv6 sock list dumping. */ | 2048 | /* Proc filesystem TCPv6 sock list dumping. */ |
2052 | static void get_openreq6(struct seq_file *seq, | 2049 | static void get_openreq6(struct seq_file *seq, |
2053 | struct sock *sk, struct open_request *req, int i, int uid) | 2050 | struct sock *sk, struct request_sock *req, int i, int uid) |
2054 | { | 2051 | { |
2055 | struct in6_addr *dest, *src; | 2052 | struct in6_addr *dest, *src; |
2056 | int ttd = req->expires - jiffies; | 2053 | int ttd = req->expires - jiffies; |
@@ -2058,8 +2055,8 @@ static void get_openreq6(struct seq_file *seq, | |||
2058 | if (ttd < 0) | 2055 | if (ttd < 0) |
2059 | ttd = 0; | 2056 | ttd = 0; |
2060 | 2057 | ||
2061 | src = &req->af.v6_req.loc_addr; | 2058 | src = &tcp6_rsk(req)->loc_addr; |
2062 | dest = &req->af.v6_req.rmt_addr; | 2059 | dest = &tcp6_rsk(req)->rmt_addr; |
2063 | seq_printf(seq, | 2060 | seq_printf(seq, |
2064 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 2061 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
2065 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n", | 2062 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n", |
@@ -2069,7 +2066,7 @@ static void get_openreq6(struct seq_file *seq, | |||
2069 | ntohs(inet_sk(sk)->sport), | 2066 | ntohs(inet_sk(sk)->sport), |
2070 | dest->s6_addr32[0], dest->s6_addr32[1], | 2067 | dest->s6_addr32[0], dest->s6_addr32[1], |
2071 | dest->s6_addr32[2], dest->s6_addr32[3], | 2068 | dest->s6_addr32[2], dest->s6_addr32[3], |
2072 | ntohs(req->rmt_port), | 2069 | ntohs(inet_rsk(req)->rmt_port), |
2073 | TCP_SYN_RECV, | 2070 | TCP_SYN_RECV, |
2074 | 0,0, /* could print option size, but that is af dependent. */ | 2071 | 0,0, /* could print option size, but that is af dependent. */ |
2075 | 1, /* timers active (only the expire timer) */ | 2072 | 1, /* timers active (only the expire timer) */ |
@@ -2239,6 +2236,7 @@ struct proto tcpv6_prot = { | |||
2239 | .sysctl_rmem = sysctl_tcp_rmem, | 2236 | .sysctl_rmem = sysctl_tcp_rmem, |
2240 | .max_header = MAX_TCP_HEADER, | 2237 | .max_header = MAX_TCP_HEADER, |
2241 | .obj_size = sizeof(struct tcp6_sock), | 2238 | .obj_size = sizeof(struct tcp6_sock), |
2239 | .rsk_prot = &tcp6_request_sock_ops, | ||
2242 | }; | 2240 | }; |
2243 | 2241 | ||
2244 | static struct inet6_protocol tcpv6_protocol = { | 2242 | static struct inet6_protocol tcpv6_protocol = { |