aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2006-10-31 03:43:44 -0500
committerDavid S. Miller <davem@davemloft.net>2006-10-31 03:43:44 -0500
commit1b7c2dbc07bf0663a41e3dc838992930019f08fd (patch)
tree66da0b902159e6f03c8131a21ce8ab1ea7f87097 /net
parentc6817e4c32d8c4118405d2dec30ac1c264349085 (diff)
[IPV6]: fix flowlabel seqfile handling
There's a bug in the seqfile show operation for flowlabel objects, where each hash chain is traversed cumulatively for each element. The following function is called for each element of each chain: static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl) { while(fl) { seq_printf... fl = fl->next; } } Thus, objects can appear mutliple times when reading /proc/net/ip6_flowlabel, as the above is called for each element in the chain. The solution is to remove the while() loop from the above, and traverse each chain exactly once, per the patch below. This also removes the ip6fl_fl_seq_show() function, which does nothing else. Signed-off-by: James Morris <jmorris@namei.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ip6_flowlabel.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 2b45f2d657c2..6d4533b58dca 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -627,9 +627,13 @@ static void ip6fl_seq_stop(struct seq_file *seq, void *v)
627 read_unlock_bh(&ip6_fl_lock); 627 read_unlock_bh(&ip6_fl_lock);
628} 628}
629 629
630static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl) 630static int ip6fl_seq_show(struct seq_file *seq, void *v)
631{ 631{
632 while(fl) { 632 if (v == SEQ_START_TOKEN)
633 seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-32s %s\n",
634 "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt");
635 else {
636 struct ip6_flowlabel *fl = v;
633 seq_printf(seq, 637 seq_printf(seq,
634 "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n", 638 "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n",
635 (unsigned)ntohl(fl->label), 639 (unsigned)ntohl(fl->label),
@@ -640,17 +644,7 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl)
640 (long)(fl->expires - jiffies)/HZ, 644 (long)(fl->expires - jiffies)/HZ,
641 NIP6(fl->dst), 645 NIP6(fl->dst),
642 fl->opt ? fl->opt->opt_nflen : 0); 646 fl->opt ? fl->opt->opt_nflen : 0);
643 fl = fl->next;
644 } 647 }
645}
646
647static int ip6fl_seq_show(struct seq_file *seq, void *v)
648{
649 if (v == SEQ_START_TOKEN)
650 seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-32s %s\n",
651 "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt");
652 else
653 ip6fl_fl_seq_show(seq, v);
654 return 0; 648 return 0;
655} 649}
656 650