* /proc/net/ip_conntrack problems
@ 2001-10-29 4:08 Taral
2001-10-29 4:27 ` Keith Owens
0 siblings, 1 reply; 5+ messages in thread
From: Taral @ 2001-10-29 4:08 UTC (permalink / raw)
To: linux-kernel
% dd if=/proc/net/ip_conntrack bs=128 | wc -l
0+0 records in
0+0 records out
0
% dd if=/proc/net/ip_conntrack bs=256 | wc -l
0+3 records in
0+3 records out
3
% dd if=/proc/net/ip_conntrack bs=512 | wc -l
0+2 records in
0+2 records out
5
Can anyone explain this? (2.4.13-ac3) It's wreaking havoc with my
program.
--
Taral <taral@taral.net>
This message is digitally signed. Please PGP encrypt mail to me.
"Any technology, no matter how primitive, is magic to those who don't
understand it." -- Florence Ambrose
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /proc/net/ip_conntrack problems
2001-10-29 4:08 /proc/net/ip_conntrack problems Taral
@ 2001-10-29 4:27 ` Keith Owens
2001-10-29 4:36 ` Taral
0 siblings, 1 reply; 5+ messages in thread
From: Keith Owens @ 2001-10-29 4:27 UTC (permalink / raw)
To: Taral; +Cc: linux-kernel
On Sun, 28 Oct 2001 22:08:54 -0600,
Taral <taral@taral.net> wrote:
>% dd if=/proc/net/ip_conntrack bs=128 | wc -l
>0+0 records in
>0+0 records out
> 0
>% dd if=/proc/net/ip_conntrack bs=256 | wc -l
>0+3 records in
>0+3 records out
> 3
>Can anyone explain this? (2.4.13-ac3) It's wreaking havoc with my
>program.
Some /proc output is blocked, it will only return complete lines. If
your buffer is not big enough to hold the next line then you don't get
anything at all. Try cat /proc/net/ip_conntrack | wc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /proc/net/ip_conntrack problems
2001-10-29 4:27 ` Keith Owens
@ 2001-10-29 4:36 ` Taral
2001-10-29 21:19 ` Mike Fedyk
0 siblings, 1 reply; 5+ messages in thread
From: Taral @ 2001-10-29 4:36 UTC (permalink / raw)
To: Keith Owens; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
On Mon, Oct 29, 2001 at 03:27:52PM +1100, Keith Owens wrote:
> Some /proc output is blocked, it will only return complete lines. If
> your buffer is not big enough to hold the next line then you don't get
> anything at all. Try cat /proc/net/ip_conntrack | wc.
So why are 2 lines missing when I change the blocking factor from 256 to
512? Even cat reads in 16k blocks... Also:
% dd if=/proc/net/ip_conntrack bs=512 | perl -ne 'print length()."\n"'
0+2 records in
0+2 records out
153
138
169
151
167
139
No line is longer than 256 chars, so why are 2 lines missing when I read
in 256 byte blocks?
--
Taral <taral@taral.net>
This message is digitally signed. Please PGP encrypt mail to me.
"Any technology, no matter how primitive, is magic to those who don't
understand it." -- Florence Ambrose
[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /proc/net/ip_conntrack problems
2001-10-29 4:36 ` Taral
@ 2001-10-29 21:19 ` Mike Fedyk
2001-10-29 22:24 ` Taral
0 siblings, 1 reply; 5+ messages in thread
From: Mike Fedyk @ 2001-10-29 21:19 UTC (permalink / raw)
To: Taral; +Cc: Keith Owens, linux-kernel
On Sun, Oct 28, 2001 at 10:36:51PM -0600, Taral wrote:
> On Mon, Oct 29, 2001 at 03:27:52PM +1100, Keith Owens wrote:
> > Some /proc output is blocked, it will only return complete lines. If
> > your buffer is not big enough to hold the next line then you don't get
> > anything at all. Try cat /proc/net/ip_conntrack | wc.
>
> So why are 2 lines missing when I change the blocking factor from 256 to
> 512? Even cat reads in 16k blocks... Also:
>
> % dd if=/proc/net/ip_conntrack bs=512 | perl -ne 'print length()."\n"'
> 0+2 records in
> 0+2 records out
> 153
> 138
> 169
> 151
> 167
> 139
>
> No line is longer than 256 chars, so why are 2 lines missing when I read
> in 256 byte blocks?
>
Because you would need the buffer size to hit the moving target of any of
the boundaries of the lines. So you would need (for the example above)
buffer sizes of:
153
291
460
611
778
778
16k blocks would hold all of those...
IIRC, proc files have trouble returning output larget than one page (4k)...
Mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /proc/net/ip_conntrack problems
2001-10-29 21:19 ` Mike Fedyk
@ 2001-10-29 22:24 ` Taral
0 siblings, 0 replies; 5+ messages in thread
From: Taral @ 2001-10-29 22:24 UTC (permalink / raw)
To: Keith Owens, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 668 bytes --]
On Mon, Oct 29, 2001 at 01:19:16PM -0800, Mike Fedyk wrote:
> Because you would need the buffer size to hit the moving target of any of
> the boundaries of the lines. So you would need (for the example above)
> buffer sizes of:
> 153
> 291
> 460
> 611
> 778
> 778
>
> 16k blocks would hold all of those...
Wrong again. /proc/net/ip_conntrack has code to support incrementally
reading the file. It's broken, I'm just not sure _how_ it's broken.
--
Taral <taral@taral.net>
This message is digitally signed. Please PGP encrypt mail to me.
"Any technology, no matter how primitive, is magic to those who don't
understand it." -- Florence Ambrose
[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-10-29 22:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-29 4:08 /proc/net/ip_conntrack problems Taral
2001-10-29 4:27 ` Keith Owens
2001-10-29 4:36 ` Taral
2001-10-29 21:19 ` Mike Fedyk
2001-10-29 22:24 ` Taral
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox