diff options
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r-- | net/ipv4/inet_diag.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index a706a47f4dbb..e5fa2ddce320 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/fcntl.h> | 15 | #include <linux/fcntl.h> |
16 | #include <linux/random.h> | 16 | #include <linux/random.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/cache.h> | 18 | #include <linux/cache.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/time.h> | 20 | #include <linux/time.h> |
@@ -116,10 +117,10 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
116 | r->id.idiag_cookie[0] = (u32)(unsigned long)sk; | 117 | r->id.idiag_cookie[0] = (u32)(unsigned long)sk; |
117 | r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); | 118 | r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); |
118 | 119 | ||
119 | r->id.idiag_sport = inet->sport; | 120 | r->id.idiag_sport = inet->inet_sport; |
120 | r->id.idiag_dport = inet->dport; | 121 | r->id.idiag_dport = inet->inet_dport; |
121 | r->id.idiag_src[0] = inet->rcv_saddr; | 122 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
122 | r->id.idiag_dst[0] = inet->daddr; | 123 | r->id.idiag_dst[0] = inet->inet_daddr; |
123 | 124 | ||
124 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 125 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
125 | if (r->idiag_family == AF_INET6) { | 126 | if (r->idiag_family == AF_INET6) { |
@@ -368,7 +369,7 @@ static int inet_diag_bc_run(const void *bc, int len, | |||
368 | yes = entry->sport >= op[1].no; | 369 | yes = entry->sport >= op[1].no; |
369 | break; | 370 | break; |
370 | case INET_DIAG_BC_S_LE: | 371 | case INET_DIAG_BC_S_LE: |
371 | yes = entry->dport <= op[1].no; | 372 | yes = entry->sport <= op[1].no; |
372 | break; | 373 | break; |
373 | case INET_DIAG_BC_D_GE: | 374 | case INET_DIAG_BC_D_GE: |
374 | yes = entry->dport >= op[1].no; | 375 | yes = entry->dport >= op[1].no; |
@@ -504,11 +505,11 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
504 | } else | 505 | } else |
505 | #endif | 506 | #endif |
506 | { | 507 | { |
507 | entry.saddr = &inet->rcv_saddr; | 508 | entry.saddr = &inet->inet_rcv_saddr; |
508 | entry.daddr = &inet->daddr; | 509 | entry.daddr = &inet->inet_daddr; |
509 | } | 510 | } |
510 | entry.sport = inet->num; | 511 | entry.sport = inet->inet_num; |
511 | entry.dport = ntohs(inet->dport); | 512 | entry.dport = ntohs(inet->inet_dport); |
512 | entry.userlocks = sk->sk_userlocks; | 513 | entry.userlocks = sk->sk_userlocks; |
513 | 514 | ||
514 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 515 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) |
@@ -584,7 +585,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
584 | if (tmo < 0) | 585 | if (tmo < 0) |
585 | tmo = 0; | 586 | tmo = 0; |
586 | 587 | ||
587 | r->id.idiag_sport = inet->sport; | 588 | r->id.idiag_sport = inet->inet_sport; |
588 | r->id.idiag_dport = ireq->rmt_port; | 589 | r->id.idiag_dport = ireq->rmt_port; |
589 | r->id.idiag_src[0] = ireq->loc_addr; | 590 | r->id.idiag_src[0] = ireq->loc_addr; |
590 | r->id.idiag_dst[0] = ireq->rmt_addr; | 591 | r->id.idiag_dst[0] = ireq->rmt_addr; |
@@ -639,7 +640,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
639 | 640 | ||
640 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 641 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { |
641 | bc = (struct rtattr *)(r + 1); | 642 | bc = (struct rtattr *)(r + 1); |
642 | entry.sport = inet->num; | 643 | entry.sport = inet->inet_num; |
643 | entry.userlocks = sk->sk_userlocks; | 644 | entry.userlocks = sk->sk_userlocks; |
644 | } | 645 | } |
645 | 646 | ||
@@ -732,7 +733,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
732 | continue; | 733 | continue; |
733 | } | 734 | } |
734 | 735 | ||
735 | if (r->id.idiag_sport != inet->sport && | 736 | if (r->id.idiag_sport != inet->inet_sport && |
736 | r->id.idiag_sport) | 737 | r->id.idiag_sport) |
737 | goto next_listen; | 738 | goto next_listen; |
738 | 739 | ||
@@ -774,7 +775,7 @@ skip_listen_ht: | |||
774 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) | 775 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) |
775 | goto unlock; | 776 | goto unlock; |
776 | 777 | ||
777 | for (i = s_i; i < hashinfo->ehash_size; i++) { | 778 | for (i = s_i; i <= hashinfo->ehash_mask; i++) { |
778 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; | 779 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; |
779 | spinlock_t *lock = inet_ehash_lockp(hashinfo, i); | 780 | spinlock_t *lock = inet_ehash_lockp(hashinfo, i); |
780 | struct sock *sk; | 781 | struct sock *sk; |
@@ -797,10 +798,10 @@ skip_listen_ht: | |||
797 | goto next_normal; | 798 | goto next_normal; |
798 | if (!(r->idiag_states & (1 << sk->sk_state))) | 799 | if (!(r->idiag_states & (1 << sk->sk_state))) |
799 | goto next_normal; | 800 | goto next_normal; |
800 | if (r->id.idiag_sport != inet->sport && | 801 | if (r->id.idiag_sport != inet->inet_sport && |
801 | r->id.idiag_sport) | 802 | r->id.idiag_sport) |
802 | goto next_normal; | 803 | goto next_normal; |
803 | if (r->id.idiag_dport != inet->dport && | 804 | if (r->id.idiag_dport != inet->inet_dport && |
804 | r->id.idiag_dport) | 805 | r->id.idiag_dport) |
805 | goto next_normal; | 806 | goto next_normal; |
806 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { | 807 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { |