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)
if (!sk)
continue;
++st->num;
if (sk->sk_family == st->family) {
rc = sk;
goto out;
......@@ -2159,7 +2158,7 @@ static void *listening_get_first(struct seq_file *seq)
for (st->sbucket = 0; st->sbucket < TCP_SYNQ_HSIZE;
++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)
continue;
rc = req;
......@@ -2181,6 +2180,8 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
struct sock *sk = cur;
struct tcp_iter_state* st = seq->private;
++st->num;
if (st->state == TCP_SEQ_STATE_OPENREQ) {
struct open_request *req = cur;
......@@ -2188,7 +2189,6 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
req = req->dl_next;
while (1) {
while (req) {
++st->num;
if (req->class->family == st->family) {
cur = req;
goto out;
......@@ -2255,7 +2255,6 @@ static void *established_get_first(struct seq_file *seq)
read_lock(&tcp_ehash[st->bucket].lock);
sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) {
if (sk->sk_family != st->family) {
++st->num;
continue;
}
rc = sk;
......@@ -2265,7 +2264,6 @@ static void *established_get_first(struct seq_file *seq)
tw_for_each(tw, node,
&tcp_ehash[st->bucket + tcp_ehash_size].chain) {
if (tw->tw_family != st->family) {
++st->num;
continue;
}
rc = tw;
......@@ -2285,12 +2283,13 @@ static void *established_get_next(struct seq_file *seq, void *cur)
struct hlist_node *node;
struct tcp_iter_state* st = seq->private;
++st->num;
if (st->state == TCP_SEQ_STATE_TIME_WAIT) {
tw = cur;
tw = tw_next(tw);
get_tw:
while (tw && tw->tw_family != st->family) {
++st->num;
tw = tw_next(tw);
}
if (tw) {
......@@ -2312,7 +2311,6 @@ static void *established_get_next(struct seq_file *seq, void *cur)
sk_for_each_from(sk, node) {
if (sk->sk_family == st->family)
goto found;
++st->num;
}
st->state = TCP_SEQ_STATE_TIME_WAIT;
......@@ -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)
{
struct tcp_iter_state* st = seq->private;
st->num = 0;
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