Commit 31fba77b authored by Tim Shepard's avatar Tim Shepard Committed by David S. Miller

[TCP]: Fix numbering of lines in /proc/net/tcp

parent 27890f3b
...@@ -2145,7 +2145,6 @@ static void *listening_get_first(struct seq_file *seq) ...@@ -2145,7 +2145,6 @@ static void *listening_get_first(struct seq_file *seq)
if (!sk) if (!sk)
continue; continue;
++st->num;
if (sk->sk_family == st->family) { if (sk->sk_family == st->family) {
rc = sk; rc = sk;
goto out; goto out;
...@@ -2159,7 +2158,7 @@ static void *listening_get_first(struct seq_file *seq) ...@@ -2159,7 +2158,7 @@ static void *listening_get_first(struct seq_file *seq)
for (st->sbucket = 0; st->sbucket < TCP_SYNQ_HSIZE; for (st->sbucket = 0; st->sbucket < TCP_SYNQ_HSIZE;
++st->sbucket) { ++st->sbucket) {
for (req = tp->listen_opt->syn_table[st->sbucket]; for (req = tp->listen_opt->syn_table[st->sbucket];
req; req = req->dl_next, ++st->num) { req; req = req->dl_next) {
if (req->class->family != st->family) if (req->class->family != st->family)
continue; continue;
rc = req; rc = req;
...@@ -2181,6 +2180,8 @@ static void *listening_get_next(struct seq_file *seq, void *cur) ...@@ -2181,6 +2180,8 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
struct sock *sk = cur; struct sock *sk = cur;
struct tcp_iter_state* st = seq->private; struct tcp_iter_state* st = seq->private;
++st->num;
if (st->state == TCP_SEQ_STATE_OPENREQ) { if (st->state == TCP_SEQ_STATE_OPENREQ) {
struct open_request *req = cur; struct open_request *req = cur;
...@@ -2188,7 +2189,6 @@ static void *listening_get_next(struct seq_file *seq, void *cur) ...@@ -2188,7 +2189,6 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
req = req->dl_next; req = req->dl_next;
while (1) { while (1) {
while (req) { while (req) {
++st->num;
if (req->class->family == st->family) { if (req->class->family == st->family) {
cur = req; cur = req;
goto out; goto out;
...@@ -2255,7 +2255,6 @@ static void *established_get_first(struct seq_file *seq) ...@@ -2255,7 +2255,6 @@ static void *established_get_first(struct seq_file *seq)
read_lock(&tcp_ehash[st->bucket].lock); read_lock(&tcp_ehash[st->bucket].lock);
sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) { sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) {
if (sk->sk_family != st->family) { if (sk->sk_family != st->family) {
++st->num;
continue; continue;
} }
rc = sk; rc = sk;
...@@ -2265,7 +2264,6 @@ static void *established_get_first(struct seq_file *seq) ...@@ -2265,7 +2264,6 @@ static void *established_get_first(struct seq_file *seq)
tw_for_each(tw, node, tw_for_each(tw, node,
&tcp_ehash[st->bucket + tcp_ehash_size].chain) { &tcp_ehash[st->bucket + tcp_ehash_size].chain) {
if (tw->tw_family != st->family) { if (tw->tw_family != st->family) {
++st->num;
continue; continue;
} }
rc = tw; rc = tw;
...@@ -2285,12 +2283,13 @@ static void *established_get_next(struct seq_file *seq, void *cur) ...@@ -2285,12 +2283,13 @@ static void *established_get_next(struct seq_file *seq, void *cur)
struct hlist_node *node; struct hlist_node *node;
struct tcp_iter_state* st = seq->private; struct tcp_iter_state* st = seq->private;
++st->num;
if (st->state == TCP_SEQ_STATE_TIME_WAIT) { if (st->state == TCP_SEQ_STATE_TIME_WAIT) {
tw = cur; tw = cur;
tw = tw_next(tw); tw = tw_next(tw);
get_tw: get_tw:
while (tw && tw->tw_family != st->family) { while (tw && tw->tw_family != st->family) {
++st->num;
tw = tw_next(tw); tw = tw_next(tw);
} }
if (tw) { if (tw) {
...@@ -2312,7 +2311,6 @@ static void *established_get_next(struct seq_file *seq, void *cur) ...@@ -2312,7 +2311,6 @@ static void *established_get_next(struct seq_file *seq, void *cur)
sk_for_each_from(sk, node) { sk_for_each_from(sk, node) {
if (sk->sk_family == st->family) if (sk->sk_family == st->family)
goto found; goto found;
++st->num;
} }
st->state = TCP_SEQ_STATE_TIME_WAIT; st->state = TCP_SEQ_STATE_TIME_WAIT;
...@@ -2356,6 +2354,8 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos) ...@@ -2356,6 +2354,8 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) static void *tcp_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct tcp_iter_state* st = seq->private;
st->num = 0;
return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment