Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 56181
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: jthalacker [...] CloudShield.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: sysread problem
Date: Wed, 31 Mar 2010 13:51:41 -0700
To: "bug-Net-DNS [...] rt.cpan.org" <bug-Net-DNS [...] rt.cpan.org>
From: Jake Thalacker <jthalacker [...] CloudShield.com>
Hello, I believe I've come across a bug in Nameserver.pm in the function readfromtcp(). My test invloved sending a TCP segmented PDU query of three segments which was not getting received. I added a debug message and found that 'length $self->{"_tcp"}{$sock}{"inbuffer"}' was not incrementing but rather only reflecting the size of the last segment received. So I changed the sysread call to read into a temporary buffer $buf followed by doing a... $self->{"_tcp"}{$sock}{"inbuffer"} = $self->{"_tcp"}{$sock}{"inbuffer"} . $buf; And that fixed it, now I receive the whole re-assembled TCP PDU. So it seems either sysread is not concatenating correctly or the assumption that it should is incorrect. Thanks, Jake uname -a FreeBSD dns-test.cloudshield.com 9.0-CURRENT FreeBSD 9.0-CURRENT #1: Wed Oct 14 14:46:44 PDT 2009 root@dns-test.cloudshield.com:/usr/obj/usr/src/sys/DEVELP i386 perl -V Summary of my perl5 (revision 5 version 8 subversion 9) configuration: Platform: osname=freebsd, osvers=9.0-current, archname=i386-freebsd-64int uname='freebsd dns-test.cloudshield.com 9.0-current freebsd 9.0-current #2: mon oct 12 15:24:03 pdt 2009 root@dns-test.cloudshield.com:usrobjusrsrcsysgeneric i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.9/mach -Dprivlib=/usr/local/lib/perl5/5.8.9 -Dman3dir=/usr/local/lib/perl5/5.8.9/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.9/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.9 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.9/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -Doptimize=-O2 -pipe -fno-strict-aliasing -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O2 -pipe -fno-strict-aliasing', cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lm -lcrypt -lutil perllibs=-lm -lcrypt -lutil libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.9/mach/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MYMALLOC PERL_MALLOC_WRAP USE_64_BIT_INT USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO Locally applied patches: defined-or Built under freebsd Compiled at Oct 13 2009 15:23:06 @INC: /usr/local/lib/perl5/5.8.9/BSDPAN /usr/local/lib/perl5/site_perl/5.8.9/mach /usr/local/lib/perl5/site_perl/5.8.9 /usr/local/lib/perl5/5.8.9/mach /usr/local/lib/perl5/5.8.9 .
Hi Jake, You are correct, this is a bug. Your modification is applied, and a test script for the condition added: 16-tcp-collect-segments.t Regards, Willem On Wed Mar 31 16:55:55 2010, jthalacker@CloudShield.com wrote: Show quoted text
> Hello, > > I believe I've come across a bug in Nameserver.pm in the function > readfromtcp(). My test invloved sending a TCP segmented PDU query > of three segments which was not getting received. I added a debug > message and found that 'length $self->{"_tcp"}{$sock}{"inbuffer"}' > was not incrementing but rather only reflecting the size of the > last segment received. So I changed the sysread call to read into > a temporary buffer $buf followed by doing a... > > $self->{"_tcp"}{$sock}{"inbuffer"} = $self-
> >{"_tcp"}{$sock}{"inbuffer"} . $buf;
> > And that fixed it, now I receive the whole re-assembled TCP PDU. > > So it seems either sysread is not concatenating correctly or the > assumption that it should is incorrect. > > Thanks, > Jake > > > uname -a > FreeBSD dns-test.cloudshield.com 9.0-CURRENT FreeBSD 9.0-CURRENT #1: > Wed Oct 14 14:46:44 PDT 2009 root@dns- > test.cloudshield.com:/usr/obj/usr/src/sys/DEVELP i386 > > > perl -V > Summary of my perl5 (revision 5 version 8 subversion 9) configuration: > Platform: > osname=freebsd, osvers=9.0-current, archname=i386-freebsd-64int > uname='freebsd dns-test.cloudshield.com 9.0-current freebsd 9.0- > current #2: mon oct 12 15:24:03 pdt 2009 root@dns- > test.cloudshield.com:usrobjusrsrcsysgeneric i386 ' > config_args='-sde -Dprefix=/usr/local > -Darchlib=/usr/local/lib/perl5/5.8.9/mach > -Dprivlib=/usr/local/lib/perl5/5.8.9 > -Dman3dir=/usr/local/lib/perl5/5.8.9/perl/man/man3 > -Dman1dir=/usr/local/man/man1 > -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.9/mach > -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.9 > -Dscriptdir=/usr/local/bin > -Dsiteman3dir=/usr/local/lib/perl5/5.8.9/man/man3 > -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv > -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none > -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" > -Doptimize=-O2 -pipe -fno-strict-aliasing -Ud_dosuid -Ui_gdbm > -Dusethreads=n -Dusemymalloc=y -Duse64bitint' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef > usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=define use64bitall=undef uselongdouble=undef > usemymalloc=y, bincompat5005=undef > Compiler: > cc='cc', ccflags ='- > DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK > -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe > -I/usr/local/include', > optimize='-O2 -pipe -fno-strict-aliasing', > cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" > -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe > -I/usr/local/include' > ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', > gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 > d_longlong=define, longlongsize=8, d_longdbl=define, > longdblsize=12 > ivtype='long long', ivsize=8, nvtype='double', nvsize=8, > Off_t='off_t', lseeksize=8 > alignbytes=4, prototype=define > Linker and Libraries: > ld='cc', ldflags =' -Wl,-E -L/usr/local/lib' > libpth=/usr/lib /usr/local/lib > libs=-lm -lcrypt -lutil > perllibs=-lm -lcrypt -lutil > libc=, so=so, useshrplib=true, libperl=libperl.so > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' > -Wl,-R/usr/local/lib/perl5/5.8.9/mach/CORE' > cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' > > > Characteristics of this binary (from libperl): > Compile-time options: MYMALLOC PERL_MALLOC_WRAP USE_64_BIT_INT > USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO > Locally applied patches: > defined-or > Built under freebsd > Compiled at Oct 13 2009 15:23:06 > @INC: > /usr/local/lib/perl5/5.8.9/BSDPAN > /usr/local/lib/perl5/site_perl/5.8.9/mach > /usr/local/lib/perl5/site_perl/5.8.9 > /usr/local/lib/perl5/5.8.9/mach > /usr/local/lib/perl5/5.8.9 > .