* [PATCH 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data (Re: /proc/net/* read drops data)
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-06 7:10 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:10 ` [PATCH 2/3] /proc/net/if_inet6 " YOSHIFUJI Hideaki / 吉藤英明
` (4 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-06 7:10 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
[1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data
Index: linux-2.6/net/ipv4/igmp.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/igmp.c,v
retrieving revision 1.34
diff -u -r1.34 igmp.c
--- linux-2.6/net/ipv4/igmp.c 1 Sep 2003 05:52:50 -0000 1.34
+++ linux-2.6/net/ipv4/igmp.c 6 Sep 2003 04:23:07 -0000
@@ -2162,7 +2162,7 @@
static void *igmp_mc_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp_mc_get_idx(seq, *pos) : (void *)1;
+ return *pos ? igmp_mc_get_idx(seq, *pos - 1) : (void *)1;
}
static void *igmp_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -2337,7 +2337,7 @@
static void *igmp_mcf_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp_mcf_get_idx(seq, *pos) : (void *)1;
+ return *pos ? igmp_mcf_get_idx(seq, *pos - 1) : (void *)1;
}
static void *igmp_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv4/raw.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/raw.c,v
retrieving revision 1.35
diff -u -r1.35 raw.c
--- linux-2.6/net/ipv4/raw.c 11 Jul 2003 04:06:16 -0000 1.35
+++ linux-2.6/net/ipv4/raw.c 6 Sep 2003 04:23:07 -0000
@@ -736,7 +736,7 @@
static void *raw_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&raw_v4_lock);
- return *pos ? raw_get_idx(seq, *pos) : (void *)1;
+ return *pos ? raw_get_idx(seq, *pos - 1) : (void *)1;
}
static void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv4/route.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/route.c,v
retrieving revision 1.58
diff -u -r1.58 route.c
--- linux-2.6/net/ipv4/route.c 1 Sep 2003 05:52:50 -0000 1.58
+++ linux-2.6/net/ipv4/route.c 6 Sep 2003 04:23:07 -0000
@@ -259,7 +259,7 @@
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
{
- return *pos ? rt_cache_get_idx(seq, *pos) : (void *)1;
+ return *pos ? rt_cache_get_idx(seq, *pos - 1) : (void *)1;
}
static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/ip6_flowlabel.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/ip6_flowlabel.c,v
retrieving revision 1.8
diff -u -r1.8 ip6_flowlabel.c
--- linux-2.6/net/ipv6/ip6_flowlabel.c 2 Sep 2003 14:48:07 -0000 1.8
+++ linux-2.6/net/ipv6/ip6_flowlabel.c 6 Sep 2003 04:23:07 -0000
@@ -603,7 +603,7 @@
static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock_bh(&ip6_fl_lock);
- return *pos ? ip6fl_get_idx(seq, *pos) : (void *)1;
+ return *pos ? ip6fl_get_idx(seq, *pos - 1) : (void *)1;
}
static void *ip6fl_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/mcast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v
retrieving revision 1.31
diff -u -r1.31 mcast.c
--- linux-2.6/net/ipv6/mcast.c 1 Sep 2003 05:52:50 -0000 1.31
+++ linux-2.6/net/ipv6/mcast.c 6 Sep 2003 04:23:07 -0000
@@ -2278,7 +2278,7 @@
static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp6_mcf_get_idx(seq, *pos) : (void *)1;
+ return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : (void *)1;
}
static void *igmp6_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/raw.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/raw.c,v
retrieving revision 1.37
diff -u -r1.37 raw.c
--- linux-2.6/net/ipv6/raw.c 18 Aug 2003 10:14:52 -0000 1.37
+++ linux-2.6/net/ipv6/raw.c 6 Sep 2003 04:23:07 -0000
@@ -961,7 +961,7 @@
static void *raw6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&raw_v6_lock);
- return *pos ? raw6_get_idx(seq, *pos) : (void *)1;
+ return *pos ? raw6_get_idx(seq, *pos - 1) : (void *)1;
}
static void *raw6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 2/3] /proc/net/if_inet6 may drop some data (Re: /proc/net/* read drops data)
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:10 ` [PATCH 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data (Re: /proc/net/* read drops data) YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-06 7:10 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:10 ` [PATCH 3/3] clean up /proc/net/{anycast6,igmp6} " YOSHIFUJI Hideaki / 吉藤英明
` (3 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-06 7:10 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
[2/3] /proc/net/if_inet6 may drop some data
Index: linux-2.6/net/ipv6/addrconf.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/addrconf.c,v
retrieving revision 1.52
diff -u -r1.52 addrconf.c
--- linux-2.6/net/ipv6/addrconf.c 4 Sep 2003 15:47:07 -0000 1.52
+++ linux-2.6/net/ipv6/addrconf.c 6 Sep 2003 04:23:07 -0000
@@ -2149,59 +2149,65 @@
int bucket;
};
-static inline struct inet6_ifaddr *if6_get_bucket(struct seq_file *seq, loff_t *pos)
+static struct inet6_ifaddr *if6_get_first(struct seq_file *seq)
{
- int i;
struct inet6_ifaddr *ifa = NULL;
- loff_t l = *pos;
struct if6_iter_state *state = seq->private;
- for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket)
- for (i = 0, ifa = inet6_addr_lst[state->bucket]; ifa; ++i, ifa=ifa->lst_next) {
- if (l--)
- continue;
- *pos = i;
- goto out;
- }
-out:
+ for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) {
+ ifa = inet6_addr_lst[state->bucket];
+ if (ifa)
+ break;
+ }
+ return ifa;
+}
+
+static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa)
+{
+ struct if6_iter_state *state = seq->private;
+
+ ifa = ifa->lst_next;
+try_again:
+ if (!ifa && ++state->bucket < IN6_ADDR_HSIZE) {
+ ifa = inet6_addr_lst[state->bucket];
+ goto try_again;
+ }
return ifa;
}
+static struct inet6_ifaddr *if6_get_idx(struct seq_file *seq, loff_t pos)
+{
+ struct inet6_ifaddr *ifa = if6_get_first(seq);
+
+ if (ifa)
+ while(pos && (ifa = if6_get_next(seq, ifa)) != NULL)
+ --pos;
+ return pos ? NULL : ifa;
+}
+
static void *if6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock_bh(&addrconf_hash_lock);
- return *pos ? if6_get_bucket(seq, pos) : (void *)1;
+ return if6_get_idx(seq, *pos);
}
static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct inet6_ifaddr *ifa;
- struct if6_iter_state *state;
-
- if (v == (void *)1) {
- ifa = if6_get_bucket(seq, pos);
- goto out;
- }
-
- state = seq->private;
-
- ifa = v;
- ifa = ifa->lst_next;
- if (ifa)
- goto out;
-
- if (++state->bucket >= IN6_ADDR_HSIZE)
- goto out;
- *pos = 0;
- ifa = if6_get_bucket(seq, pos);
-out:
+ ifa = if6_get_next(seq, v);
++*pos;
return ifa;
}
-static inline void if6_iface_seq_show(struct seq_file *seq, struct inet6_ifaddr *ifp)
+static void if6_seq_stop(struct seq_file *seq, void *v)
+{
+ read_unlock_bh(&addrconf_hash_lock);
+}
+
+static int if6_seq_show(struct seq_file *seq, void *v)
{
+ struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
seq_printf(seq,
"%04x%04x%04x%04x%04x%04x%04x%04x %02x %02x %02x %02x %8s\n",
NIP6(ifp->addr),
@@ -2210,20 +2216,7 @@
ifp->scope,
ifp->flags,
ifp->idev->dev->name);
-}
-
-static int if6_seq_show(struct seq_file *seq, void *v)
-{
- if (v == (void *)1)
- return 0;
- else
- if6_iface_seq_show(seq, v);
return 0;
-}
-
-static void if6_seq_stop(struct seq_file *seq, void *v)
-{
- read_unlock_bh(&addrconf_hash_lock);
}
static struct seq_operations if6_seq_ops = {
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 3/3] clean up /proc/net/{anycast6,igmp6} (Re: /proc/net/* read drops data)
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:10 ` [PATCH 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data (Re: /proc/net/* read drops data) YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:10 ` [PATCH 2/3] /proc/net/if_inet6 " YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-06 7:10 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-10 2:53 ` [RESEND 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data YOSHIFUJI Hideaki / 吉藤英明
` (2 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-06 7:10 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
[3/3] clean up /proc/net/{anycast6,igmp6}
Index: linux-2.6/net/ipv6/anycast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/anycast.c,v
retrieving revision 1.7
diff -u -r1.7 anycast.c
--- linux-2.6/net/ipv6/anycast.c 25 Jul 2003 17:11:54 -0000 1.7
+++ linux-2.6/net/ipv6/anycast.c 6 Sep 2003 04:23:07 -0000
@@ -505,7 +505,7 @@
static void *ac6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? ac6_get_idx(seq, *pos) : ac6_get_first(seq);
+ return ac6_get_idx(seq, *pos);
}
static void *ac6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/mcast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v
retrieving revision 1.31
diff -u -r1.31 mcast.c
--- linux-2.6/net/ipv6/mcast.c 1 Sep 2003 05:52:50 -0000 1.31
+++ linux-2.6/net/ipv6/mcast.c 6 Sep 2003 04:23:07 -0000
@@ -2119,7 +2119,7 @@
static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp6_mc_get_idx(seq, *pos) : igmp6_mc_get_first(seq);
+ return igmp6_mc_get_idx(seq, *pos);
}
static void *igmp6_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread* [RESEND 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
` (2 preceding siblings ...)
2003-09-06 7:10 ` [PATCH 3/3] clean up /proc/net/{anycast6,igmp6} " YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-10 2:53 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-11 23:31 ` David S. Miller
2003-09-10 2:53 ` [RESEND 2/3] /proc/net/if_inet6 " YOSHIFUJI Hideaki / 吉藤英明
2003-09-10 2:53 ` [RESEND 3/3] clean up /proc/net/{anycast6,igmp6} YOSHIFUJI Hideaki / 吉藤英明
5 siblings, 1 reply; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-10 2:53 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
Hello.
In article <20030906.160458.39800982.yoshfuji@linux-ipv6.org> (at Sat, 06 Sep 2003 16:04:58 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:
> [1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data
:
> Note 0: These confilct with SEQ_START_TOKEN patches;
> I'll regenerate if SEQ_START_TOKEN accepted.
Index: linux-2.6/net/ipv4/igmp.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/igmp.c,v
retrieving revision 1.35
diff -u -r1.35 igmp.c
--- linux-2.6/net/ipv4/igmp.c 9 Sep 2003 23:24:51 -0000 1.35
+++ linux-2.6/net/ipv4/igmp.c 10 Sep 2003 01:00:49 -0000
@@ -2162,7 +2162,7 @@
static void *igmp_mc_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp_mc_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? igmp_mc_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *igmp_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -2337,7 +2337,7 @@
static void *igmp_mcf_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp_mcf_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? igmp_mcf_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *igmp_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv4/raw.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/raw.c,v
retrieving revision 1.36
diff -u -r1.36 raw.c
--- linux-2.6/net/ipv4/raw.c 9 Sep 2003 23:24:51 -0000 1.36
+++ linux-2.6/net/ipv4/raw.c 10 Sep 2003 01:00:49 -0000
@@ -736,7 +736,7 @@
static void *raw_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&raw_v4_lock);
- return *pos ? raw_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? raw_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv4/route.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/route.c,v
retrieving revision 1.59
diff -u -r1.59 route.c
--- linux-2.6/net/ipv4/route.c 9 Sep 2003 23:24:51 -0000 1.59
+++ linux-2.6/net/ipv4/route.c 10 Sep 2003 01:00:49 -0000
@@ -259,7 +259,7 @@
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
{
- return *pos ? rt_cache_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? rt_cache_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/ip6_flowlabel.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/ip6_flowlabel.c,v
retrieving revision 1.9
diff -u -r1.9 ip6_flowlabel.c
--- linux-2.6/net/ipv6/ip6_flowlabel.c 9 Sep 2003 23:24:51 -0000 1.9
+++ linux-2.6/net/ipv6/ip6_flowlabel.c 10 Sep 2003 01:00:49 -0000
@@ -603,7 +603,7 @@
static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock_bh(&ip6_fl_lock);
- return *pos ? ip6fl_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? ip6fl_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *ip6fl_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/mcast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v
retrieving revision 1.32
diff -u -r1.32 mcast.c
--- linux-2.6/net/ipv6/mcast.c 9 Sep 2003 23:24:51 -0000 1.32
+++ linux-2.6/net/ipv6/mcast.c 10 Sep 2003 01:00:49 -0000
@@ -2278,7 +2278,7 @@
static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp6_mcf_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *igmp6_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/raw.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/raw.c,v
retrieving revision 1.38
diff -u -r1.38 raw.c
--- linux-2.6/net/ipv6/raw.c 9 Sep 2003 23:24:51 -0000 1.38
+++ linux-2.6/net/ipv6/raw.c 10 Sep 2003 01:00:49 -0000
@@ -961,7 +961,7 @@
static void *raw6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&raw_v6_lock);
- return *pos ? raw6_get_idx(seq, *pos) : SEQ_START_TOKEN;
+ return *pos ? raw6_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *raw6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [RESEND 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data
2003-09-10 2:53 ` [RESEND 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-11 23:31 ` David S. Miller
0 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2003-09-11 23:31 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / _$B5HF#1QL@; +Cc: netdev, yoshfuji
Applied, thank you Yoshfuji.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RESEND 2/3] /proc/net/if_inet6 may drop some data
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
` (3 preceding siblings ...)
2003-09-10 2:53 ` [RESEND 1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-10 2:53 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-11 23:33 ` David S. Miller
2003-09-10 2:53 ` [RESEND 3/3] clean up /proc/net/{anycast6,igmp6} YOSHIFUJI Hideaki / 吉藤英明
5 siblings, 1 reply; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-10 2:53 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
Hello.
In article <20030906.160458.39800982.yoshfuji@linux-ipv6.org> (at Sat, 06 Sep 2003 16:04:58 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:
> [2/3] /proc/net/if_inet6 may drop some data
:
> Note 0: These confilct with SEQ_START_TOKEN patches;
> I'll regenerate if SEQ_START_TOKEN accepted.
Index: linux-2.6/net/ipv6/addrconf.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/addrconf.c,v
retrieving revision 1.53
diff -u -r1.53 addrconf.c
--- linux-2.6/net/ipv6/addrconf.c 9 Sep 2003 23:24:51 -0000 1.53
+++ linux-2.6/net/ipv6/addrconf.c 10 Sep 2003 01:00:49 -0000
@@ -2149,59 +2149,65 @@
int bucket;
};
-static inline struct inet6_ifaddr *if6_get_bucket(struct seq_file *seq, loff_t *pos)
+static struct inet6_ifaddr *if6_get_first(struct seq_file *seq)
{
- int i;
struct inet6_ifaddr *ifa = NULL;
- loff_t l = *pos;
struct if6_iter_state *state = seq->private;
- for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket)
- for (i = 0, ifa = inet6_addr_lst[state->bucket]; ifa; ++i, ifa=ifa->lst_next) {
- if (l--)
- continue;
- *pos = i;
- goto out;
- }
-out:
+ for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) {
+ ifa = inet6_addr_lst[state->bucket];
+ if (ifa)
+ break;
+ }
+ return ifa;
+}
+
+static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa)
+{
+ struct if6_iter_state *state = seq->private;
+
+ ifa = ifa->lst_next;
+try_again:
+ if (!ifa && ++state->bucket < IN6_ADDR_HSIZE) {
+ ifa = inet6_addr_lst[state->bucket];
+ goto try_again;
+ }
return ifa;
}
+static struct inet6_ifaddr *if6_get_idx(struct seq_file *seq, loff_t pos)
+{
+ struct inet6_ifaddr *ifa = if6_get_first(seq);
+
+ if (ifa)
+ while(pos && (ifa = if6_get_next(seq, ifa)) != NULL)
+ --pos;
+ return pos ? NULL : ifa;
+}
+
static void *if6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock_bh(&addrconf_hash_lock);
- return *pos ? if6_get_bucket(seq, pos) : SEQ_START_TOKEN;
+ return if6_get_idx(seq, *pos);
}
static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct inet6_ifaddr *ifa;
- struct if6_iter_state *state;
-
- if (v == SEQ_START_TOKEN) {
- ifa = if6_get_bucket(seq, pos);
- goto out;
- }
-
- state = seq->private;
-
- ifa = v;
- ifa = ifa->lst_next;
- if (ifa)
- goto out;
-
- if (++state->bucket >= IN6_ADDR_HSIZE)
- goto out;
- *pos = 0;
- ifa = if6_get_bucket(seq, pos);
-out:
+ ifa = if6_get_next(seq, v);
++*pos;
return ifa;
}
-static inline void if6_iface_seq_show(struct seq_file *seq, struct inet6_ifaddr *ifp)
+static void if6_seq_stop(struct seq_file *seq, void *v)
+{
+ read_unlock_bh(&addrconf_hash_lock);
+}
+
+static int if6_seq_show(struct seq_file *seq, void *v)
{
+ struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
seq_printf(seq,
"%04x%04x%04x%04x%04x%04x%04x%04x %02x %02x %02x %02x %8s\n",
NIP6(ifp->addr),
@@ -2210,20 +2216,7 @@
ifp->scope,
ifp->flags,
ifp->idev->dev->name);
-}
-
-static int if6_seq_show(struct seq_file *seq, void *v)
-{
- if (v == SEQ_START_TOKEN)
- return 0;
- else
- if6_iface_seq_show(seq, v);
return 0;
-}
-
-static void if6_seq_stop(struct seq_file *seq, void *v)
-{
- read_unlock_bh(&addrconf_hash_lock);
}
static struct seq_operations if6_seq_ops = {
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread* [RESEND 3/3] clean up /proc/net/{anycast6,igmp6}
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
` (4 preceding siblings ...)
2003-09-10 2:53 ` [RESEND 2/3] /proc/net/if_inet6 " YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-10 2:53 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-11 23:34 ` David S. Miller
5 siblings, 1 reply; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-10 2:53 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
Hello.
In article <20030906.160458.39800982.yoshfuji@linux-ipv6.org> (at Sat, 06 Sep 2003 16:04:58 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> says:
> In article <Pine.GSO.4.33.0309041223430.13584-100000@sweetums.bluetronic.net> (at Thu, 4 Sep 2003 12:25:16 -0400 (EDT))
> [3/3] clean up /proc/net/{anycast6,igmp6}
:
> Note 0: These confilct with SEQ_START_TOKEN patches;
> I'll regenerate if SEQ_START_TOKEN accepted.
Index: linux-2.6/net/ipv6/anycast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/anycast.c,v
retrieving revision 1.7
diff -u -r1.7 anycast.c
--- linux-2.6/net/ipv6/anycast.c 25 Jul 2003 17:11:54 -0000 1.7
+++ linux-2.6/net/ipv6/anycast.c 10 Sep 2003 01:00:49 -0000
@@ -505,7 +505,7 @@
static void *ac6_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? ac6_get_idx(seq, *pos) : ac6_get_first(seq);
+ return ac6_get_idx(seq, *pos);
}
static void *ac6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
Index: linux-2.6/net/ipv6/mcast.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/mcast.c,v
retrieving revision 1.32
diff -u -r1.32 mcast.c
--- linux-2.6/net/ipv6/mcast.c 9 Sep 2003 23:24:51 -0000 1.32
+++ linux-2.6/net/ipv6/mcast.c 10 Sep 2003 01:00:49 -0000
@@ -2119,7 +2119,7 @@
static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&dev_base_lock);
- return *pos ? igmp6_mc_get_idx(seq, *pos) : igmp6_mc_get_first(seq);
+ return igmp6_mc_get_idx(seq, *pos);
}
static void *igmp6_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 16+ messages in thread