* Re: /proc/net/* read drops data
[not found] ` <Pine.GSO.4.33.0308271935550.7750-100000@sweetums.bluetronic.net>
@ 2003-08-28 0:34 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-03 7:07 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-08-28 0:34 UTC (permalink / raw)
To: jfbeam; +Cc: linux-kernel, netdev
In article <Pine.GSO.4.33.0308271935550.7750-100000@sweetums.bluetronic.net> (at Wed, 27 Aug 2003 19:58:17 -0400 (EDT)), Ricky Beam <jfbeam@bluetronic.net> says:
> On Wed, 27 Aug 2003, Ricky Beam wrote:
> >This smells like a simple "off by one" bug, but I've been too busy to go
> >look at the code.
>
> Ah hah! it's a block size problem... netstat reads 1024 at a time.
>
> Using dd...
>
> [root:pts/5{9}]gir:~/[7:55pm]:dd if=/proc/net/udp bs=1024 | wc
> 2+1 records in
> 2+1 records out
> 18 216 2304
Good idea. I'll chase this bug.
--yoshfuji
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: /proc/net/* read drops data
[not found] ` <Pine.GSO.4.33.0308271935550.7750-100000@sweetums.bluetronic.net>
2003-08-28 0:34 ` /proc/net/* read drops data YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-03 7:07 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-04 7:46 ` David S. Miller
1 sibling, 1 reply; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-03 7:07 UTC (permalink / raw)
To: Ricky Beam, jfbeam; +Cc: linux-kernel, netdev, yoshfuji, davem
Hello.
In article <Pine.GSO.4.33.0308271935550.7750-100000@sweetums.bluetronic.net> (at Wed, 27 Aug 2003 19:58:17 -0400 (EDT)), Ricky Beam <jfbeam@bluetronic.net> says:
> On Wed, 27 Aug 2003, Ricky Beam wrote:
> >This smells like a simple "off by one" bug, but I've been too busy to go
> >look at the code.
>
> Ah hah! it's a block size problem... netstat reads 1024 at a time.
>
> Using dd...
>
> [root:pts/5{9}]gir:~/[7:55pm]:dd if=/proc/net/udp bs=1024 | wc
> 2+1 records in
> 2+1 records out
> 18 216 2304
> [root:pts/5{9}]gir:~/[7:56pm]:dd if=/proc/net/udp bs=2048 | wc
> 1+1 records in
> 1+1 records out
> 19 228 2432
:
Please try this patch.
D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data
Index: linux-2.6/net/ipv4/udp.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/udp.c,v
retrieving revision 1.38
diff -u -r1.38 udp.c
--- linux-2.6/net/ipv4/udp.c 14 Aug 2003 06:00:04 -0000 1.38
+++ linux-2.6/net/ipv4/udp.c 3 Sep 2003 05:30:52 -0000
@@ -1349,64 +1349,65 @@
/* ------------------------------------------------------------------------ */
#ifdef CONFIG_PROC_FS
-static __inline__ struct sock *udp_get_bucket(struct seq_file *seq, loff_t *pos)
+static struct sock *udp_get_first(struct seq_file *seq)
{
- int i;
struct sock *sk;
- struct hlist_node *node;
- loff_t l = *pos;
struct udp_iter_state *state = seq->private;
- for (; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
- i = 0;
+ for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
+ struct hlist_node *node;
sk_for_each(sk, node, &udp_hash[state->bucket]) {
- if (sk->sk_family != state->family) {
- ++i;
- continue;
- }
- if (l--) {
- ++i;
- continue;
- }
- *pos = i;
- goto out;
+ if (sk->sk_family == state->family)
+ goto found;
}
}
sk = NULL;
-out:
+found:
return sk;
}
+static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
+{
+ struct udp_iter_state *state = seq->private;
+
+ do {
+ sk = sk_next(sk);
+try_again:
+ ;
+ } while (sk && sk->sk_family != state->family);
+
+ if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
+ sk = sk_head(&udp_hash[state->bucket]);
+ goto try_again;
+ }
+ return sk;
+}
+
+static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
+{
+ struct sock *sk = udp_get_first(seq);
+
+ if (sk)
+ while(pos && (sk = udp_get_next(seq, sk)) != NULL)
+ --pos;
+ return pos ? NULL : sk;
+}
+
static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&udp_hash_lock);
- return *pos ? udp_get_bucket(seq, pos) : (void *)1;
+ return *pos ? udp_get_idx(seq, *pos-1) : (void *)1;
}
static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct sock *sk;
- struct hlist_node *node;
- struct udp_iter_state *state;
-
- if (v == (void *)1) {
- sk = udp_get_bucket(seq, pos);
- goto out;
- }
- state = seq->private;
+ if (v == (void *)1)
+ sk = udp_get_idx(seq, 0);
+ else
+ sk = udp_get_next(seq, v);
- sk = v;
- sk_for_each_continue(sk, node)
- if (sk->sk_family == state->family)
- goto out;
-
- if (++state->bucket >= UDP_HTABLE_SIZE)
- goto out;
-
- *pos = 0;
- sk = udp_get_bucket(seq, pos);
-out:
++*pos;
return sk;
}
--
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: /proc/net/* read drops data
2003-09-03 7:07 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-04 7:46 ` David S. Miller
2003-09-04 16:21 ` Ricky Beam
2003-09-04 16:25 ` Ricky Beam
0 siblings, 2 replies; 16+ messages in thread
From: David S. Miller @ 2003-09-04 7:46 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / _$B5HF#1QL@; +Cc: jfbeam, linux-kernel, netdev, yoshfuji
On Wed, 03 Sep 2003 16:07:33 +0900 (JST)
YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> wrote:
> D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data
This fix looks good to me. Applied.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: /proc/net/* read drops data
2003-09-04 7:46 ` David S. Miller
@ 2003-09-04 16:21 ` Ricky Beam
2003-09-04 16:25 ` Ricky Beam
1 sibling, 0 replies; 16+ messages in thread
From: Ricky Beam @ 2003-09-04 16:21 UTC (permalink / raw)
To: David S. Miller; +Cc: YOSHIFUJI Hideaki / _$B5HF#1QL@, linux-kernel, netdev
On Thu, 4 Sep 2003, David S. Miller wrote:
>> D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data
>
>This fix looks good to me. Applied.
That might fix udp, but that's not the only one to be fixed. I'll compile
a list. (tcp for sure.)
--Ricky
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: /proc/net/* read drops data
2003-09-04 7:46 ` David S. Miller
2003-09-04 16:21 ` Ricky Beam
@ 2003-09-04 16:25 ` Ricky Beam
2003-09-04 17:13 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 2 replies; 16+ messages in thread
From: Ricky Beam @ 2003-09-04 16:25 UTC (permalink / raw)
To: David S. Miller; +Cc: YOSHIFUJI Hideaki / _$B5HF#1QL@, linux-kernel, netdev
On Thu, 4 Sep 2003, David S. Miller wrote:
>> D: Fixing a bug that reading /proc/net/{udp,udp6} may drop some data
>
>This fix looks good to me. Applied.
The list:
(file) (bs=1) (bs=10000)
/proc/net/igmp 122 191
/proc/net/route 128 384
/proc/net/rt_acct 0 4096
/proc/net/rt_cache 384 512
/proc/net/tcp 1800 1950
/proc/net/udp 1024 1152
(I don't have ipv6 enabled)
--Ricky
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: /proc/net/* read drops data
2003-09-04 16:25 ` Ricky Beam
@ 2003-09-04 17:13 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-06 7:04 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-04 17:13 UTC (permalink / raw)
To: jfbeam; +Cc: davem, linux-kernel, netdev, yoshfuji
In article <Pine.GSO.4.33.0309041223430.13584-100000@sweetums.bluetronic.net> (at Thu, 4 Sep 2003 12:25:16 -0400 (EDT)), Ricky Beam <jfbeam@bluetronic.net> says:
> The list:
> (file) (bs=1) (bs=10000)
> /proc/net/igmp 122 191
> /proc/net/route 128 384
> /proc/net/rt_acct 0 4096
> /proc/net/rt_cache 384 512
> /proc/net/tcp 1800 1950
> /proc/net/udp 1024 1152
Okay, I'll seek the code.
--yoshfuji
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: /proc/net/* read drops data
2003-09-04 16:25 ` Ricky Beam
2003-09-04 17:13 ` YOSHIFUJI Hideaki / 吉藤英明
@ 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 / 吉藤英明
` (5 more replies)
1 sibling, 6 replies; 16+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-06 7:04 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
In article <Pine.GSO.4.33.0309041223430.13584-100000@sweetums.bluetronic.net> (at Thu, 4 Sep 2003 12:25:16 -0400 (EDT)), Ricky Beam <jfbeam@bluetronic.net> says:
> >This fix looks good to me. Applied.
>
> The list:
> (file) (bs=1) (bs=10000)
> /proc/net/igmp 122 191
> /proc/net/route 128 384
> /proc/net/rt_acct 0 4096
> /proc/net/rt_cache 384 512
> /proc/net/tcp 1800 1950
> /proc/net/udp 1024 1152
Well, I'm about to post 3 patches.
[1/3] /proc/net/{igmp,msfilter,raw,rt_cache,ip6_flowlabel,msfilter6,raw6} may drop some data
[2/3] /proc/net/if_inet6 may drop some data
[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.
Note 1: /proc/net/rt_acct does not use seq_file
Note 2: /proc/net/{route,tcp,tcp6} is not fixed by these
--
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 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
* [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
* 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
* Re: [RESEND 2/3] /proc/net/if_inet6 may drop some data
2003-09-10 2:53 ` [RESEND 2/3] /proc/net/if_inet6 " YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-11 23:33 ` David S. Miller
0 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2003-09-11 23:33 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / _$B5HF#1QL@; +Cc: netdev, yoshfuji
Applied, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RESEND 3/3] clean up /proc/net/{anycast6,igmp6}
2003-09-10 2:53 ` [RESEND 3/3] clean up /proc/net/{anycast6,igmp6} YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-11 23:34 ` David S. Miller
0 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2003-09-11 23:34 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / _$B5HF#1QL@; +Cc: netdev, yoshfuji
Applied, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2003-09-11 23:34 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.GSO.4.33.0308271658370.7750-100000@sweetums.bluetronic.net>
[not found] ` <Pine.GSO.4.33.0308271935550.7750-100000@sweetums.bluetronic.net>
2003-08-28 0:34 ` /proc/net/* read drops data YOSHIFUJI Hideaki / 吉藤英明
2003-09-03 7:07 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-04 7:46 ` David S. Miller
2003-09-04 16:21 ` Ricky Beam
2003-09-04 16:25 ` Ricky Beam
2003-09-04 17:13 ` YOSHIFUJI Hideaki / 吉藤英明
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 ` [PATCH 3/3] clean up /proc/net/{anycast6,igmp6} " 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 / 吉藤英明
2003-09-11 23:31 ` David S. Miller
2003-09-10 2:53 ` [RESEND 2/3] /proc/net/if_inet6 " 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 / 吉藤英明
2003-09-11 23:34 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).