diff options
Diffstat (limited to 'net/ipv4/tcp_diag.c')
| -rw-r--r-- | net/ipv4/tcp_diag.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index 8faa8948f75c..634befc07921 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c | |||
| @@ -455,9 +455,10 @@ static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk, | |||
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, | 457 | static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, |
| 458 | struct open_request *req, | 458 | struct request_sock *req, |
| 459 | u32 pid, u32 seq) | 459 | u32 pid, u32 seq) |
| 460 | { | 460 | { |
| 461 | const struct inet_request_sock *ireq = inet_rsk(req); | ||
| 461 | struct inet_sock *inet = inet_sk(sk); | 462 | struct inet_sock *inet = inet_sk(sk); |
| 462 | unsigned char *b = skb->tail; | 463 | unsigned char *b = skb->tail; |
| 463 | struct tcpdiagmsg *r; | 464 | struct tcpdiagmsg *r; |
| @@ -482,9 +483,9 @@ static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
| 482 | tmo = 0; | 483 | tmo = 0; |
| 483 | 484 | ||
| 484 | r->id.tcpdiag_sport = inet->sport; | 485 | r->id.tcpdiag_sport = inet->sport; |
| 485 | r->id.tcpdiag_dport = req->rmt_port; | 486 | r->id.tcpdiag_dport = ireq->rmt_port; |
| 486 | r->id.tcpdiag_src[0] = req->af.v4_req.loc_addr; | 487 | r->id.tcpdiag_src[0] = ireq->loc_addr; |
| 487 | r->id.tcpdiag_dst[0] = req->af.v4_req.rmt_addr; | 488 | r->id.tcpdiag_dst[0] = ireq->rmt_addr; |
| 488 | r->tcpdiag_expires = jiffies_to_msecs(tmo), | 489 | r->tcpdiag_expires = jiffies_to_msecs(tmo), |
| 489 | r->tcpdiag_rqueue = 0; | 490 | r->tcpdiag_rqueue = 0; |
| 490 | r->tcpdiag_wqueue = 0; | 491 | r->tcpdiag_wqueue = 0; |
| @@ -493,9 +494,9 @@ static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
| 493 | #ifdef CONFIG_IP_TCPDIAG_IPV6 | 494 | #ifdef CONFIG_IP_TCPDIAG_IPV6 |
| 494 | if (r->tcpdiag_family == AF_INET6) { | 495 | if (r->tcpdiag_family == AF_INET6) { |
| 495 | ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src, | 496 | ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src, |
| 496 | &req->af.v6_req.loc_addr); | 497 | &tcp6_rsk(req)->loc_addr); |
| 497 | ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_dst, | 498 | ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_dst, |
| 498 | &req->af.v6_req.rmt_addr); | 499 | &tcp6_rsk(req)->rmt_addr); |
| 499 | } | 500 | } |
| 500 | #endif | 501 | #endif |
| 501 | nlh->nlmsg_len = skb->tail - b; | 502 | nlh->nlmsg_len = skb->tail - b; |
| @@ -513,7 +514,7 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 513 | struct tcpdiag_entry entry; | 514 | struct tcpdiag_entry entry; |
| 514 | struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); | 515 | struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); |
| 515 | struct tcp_sock *tp = tcp_sk(sk); | 516 | struct tcp_sock *tp = tcp_sk(sk); |
| 516 | struct tcp_listen_opt *lopt; | 517 | struct listen_sock *lopt; |
| 517 | struct rtattr *bc = NULL; | 518 | struct rtattr *bc = NULL; |
| 518 | struct inet_sock *inet = inet_sk(sk); | 519 | struct inet_sock *inet = inet_sk(sk); |
| 519 | int j, s_j; | 520 | int j, s_j; |
| @@ -528,9 +529,9 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 528 | 529 | ||
| 529 | entry.family = sk->sk_family; | 530 | entry.family = sk->sk_family; |
| 530 | 531 | ||
| 531 | read_lock_bh(&tp->syn_wait_lock); | 532 | read_lock_bh(&tp->accept_queue.syn_wait_lock); |
| 532 | 533 | ||
| 533 | lopt = tp->listen_opt; | 534 | lopt = tp->accept_queue.listen_opt; |
| 534 | if (!lopt || !lopt->qlen) | 535 | if (!lopt || !lopt->qlen) |
| 535 | goto out; | 536 | goto out; |
| 536 | 537 | ||
| @@ -541,13 +542,15 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 541 | } | 542 | } |
| 542 | 543 | ||
| 543 | for (j = s_j; j < TCP_SYNQ_HSIZE; j++) { | 544 | for (j = s_j; j < TCP_SYNQ_HSIZE; j++) { |
| 544 | struct open_request *req, *head = lopt->syn_table[j]; | 545 | struct request_sock *req, *head = lopt->syn_table[j]; |
| 545 | 546 | ||
| 546 | reqnum = 0; | 547 | reqnum = 0; |
| 547 | for (req = head; req; reqnum++, req = req->dl_next) { | 548 | for (req = head; req; reqnum++, req = req->dl_next) { |
| 549 | struct inet_request_sock *ireq = inet_rsk(req); | ||
| 550 | |||
| 548 | if (reqnum < s_reqnum) | 551 | if (reqnum < s_reqnum) |
| 549 | continue; | 552 | continue; |
| 550 | if (r->id.tcpdiag_dport != req->rmt_port && | 553 | if (r->id.tcpdiag_dport != ireq->rmt_port && |
| 551 | r->id.tcpdiag_dport) | 554 | r->id.tcpdiag_dport) |
| 552 | continue; | 555 | continue; |
| 553 | 556 | ||
| @@ -555,16 +558,16 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 555 | entry.saddr = | 558 | entry.saddr = |
| 556 | #ifdef CONFIG_IP_TCPDIAG_IPV6 | 559 | #ifdef CONFIG_IP_TCPDIAG_IPV6 |
| 557 | (entry.family == AF_INET6) ? | 560 | (entry.family == AF_INET6) ? |
| 558 | req->af.v6_req.loc_addr.s6_addr32 : | 561 | tcp6_rsk(req)->loc_addr.s6_addr32 : |
| 559 | #endif | 562 | #endif |
| 560 | &req->af.v4_req.loc_addr; | 563 | &ireq->loc_addr; |
| 561 | entry.daddr = | 564 | entry.daddr = |
| 562 | #ifdef CONFIG_IP_TCPDIAG_IPV6 | 565 | #ifdef CONFIG_IP_TCPDIAG_IPV6 |
| 563 | (entry.family == AF_INET6) ? | 566 | (entry.family == AF_INET6) ? |
| 564 | req->af.v6_req.rmt_addr.s6_addr32 : | 567 | tcp6_rsk(req)->rmt_addr.s6_addr32 : |
| 565 | #endif | 568 | #endif |
| 566 | &req->af.v4_req.rmt_addr; | 569 | &ireq->rmt_addr; |
| 567 | entry.dport = ntohs(req->rmt_port); | 570 | entry.dport = ntohs(ireq->rmt_port); |
| 568 | 571 | ||
| 569 | if (!tcpdiag_bc_run(RTA_DATA(bc), | 572 | if (!tcpdiag_bc_run(RTA_DATA(bc), |
| 570 | RTA_PAYLOAD(bc), &entry)) | 573 | RTA_PAYLOAD(bc), &entry)) |
| @@ -585,7 +588,7 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 585 | } | 588 | } |
| 586 | 589 | ||
| 587 | out: | 590 | out: |
| 588 | read_unlock_bh(&tp->syn_wait_lock); | 591 | read_unlock_bh(&tp->accept_queue.syn_wait_lock); |
| 589 | 592 | ||
| 590 | return err; | 593 | return err; |
| 591 | } | 594 | } |
