Time to further reveal my ignorance for all to see... hopefully some good will come out of this.
Netlink uses datagrams, and while I thought I understood them, it appears I really don't. I thought that datagrams were only unreliable over the network - once the OS made the bytes available on a recv*() call, they were secure. So I can do the following sequence w/ a 2k buffer : recvfrom(s, buf, 2048, MSG_PEEK) and get 1132 bytes back but since I used MSG_PEEK, the data is left to read again. Then a real read w/ a buffer smaller than available data recvfrom(s, buf, 1024, 0) and get 1024 bytes read. Since that was my buffer size, and I know that there were 1132 bytes there, I expect that I can do another recvfrom(MSG_PEEK) and get 1132-1024 = 108 bytes. I try that : recvfrom(s, buf, 2048, MSG_PEEK) and get 20 bytes back, not 108 as (1132-1024 should result in..) Why? I know I'm rusty, but I used to do a lot of network programming, and thought I groked this. Any ideas? geir Geir Magnusson Jr wrote: > I seem to have found a doozy :) > > In hysock.c / getNextNetlinkMsg() there's an assumption that anything > the kernel will ever send in a netlink request is less than 1k, so when > processing the receive buffer, if there still is data in the buffer and > it's not a complete message, it's considered an error. > > This is clearly wrong, and provable by simply doubling the buffer size. > This is suboptimal, of course, because there is no guarantee that 2k > will be enough one all systems either. > > I'm going to stare at this and attempt to rewrite it this weekend if I > find some time. > > Man, this would be easier w/ a debugger :) > > geir > > > George Harley wrote: >> Geir Magnusson Jr wrote: >>> I'm having 9 failures in and around this on ubuntu 6. I haven't looked >>> to confirm this is the issue, but either way, yes, the tests should be >>> accommodating. >>> >>> geir >>> >>> >> Hi Geir, >> >> I believe that I have fixed up the tests for Debian (and maybe RHEL). >> I'm happy to try and tackle any remaining issues but as I don't have >> access to an Ubuntu machine I would be really grateful if you could >> email details of the problems you are seeing. >> >> Thanks in advance, >> George >> >> >> >>> Mark Hindess wrote: >>> >>>> Tests failed for me (and the linux build machine) with: >>>> >>>> Incorrect host name returned: localhost.localdomain != localhost >>>> >>>> junit.framework.AssertionFailedError: Incorrect host name returned: >>>> localhost.localdomain != localhost >>>> at >>>> tests.api.java.net.InetAddressTest.test_getHostName(InetAddressTest.java:238) >>>> >>>> >>>> Because the standard Debian installation defines 127.0.0.1 to be >>>> localhost.localdomain. I think the tests need to be more accommodating >>>> people aren't going to want to have to mess about with these system >>>> configurations. >>>> >>>> -Mark. >>>> >>>> >>>> On 23 June 2006 at 13:14, "Andrew Zhang" <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>>> ------=_Part_22520_3761084.1151039694395 >>>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>>>> Content-Transfer-Encoding: 7bit >>>>> Content-Disposition: inline >>>>> >>>>> Hi Stepan, >>>>> >>>>> Maybe it needs configure /etc/hosts ? I'm not sure. >>>>> >>>>> I configured the host file on windows, the test passes. :) >>>>> >>>>> Thanks! >>>>> >>>>> >>>>> On 6/23/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: >>>>> >>>>>> Hi George, >>>>>> >>>>>> InetAddressTest and SocketPermissionTest still fails for me on Linux. >>>>>> For example, InetAddressTest.test_getAllByNameLjava_lang_String failed >>>>>> with: >>>>>> >>>>>> Incorrect number of aliases returned: 2 should be 1 >>>>>> junit.framework.AssertionFailedError: Incorrect number of aliases >>>>>> returned: >>>>>> 2 should be 1 at >>>>>> tests.api.java.net.InetAddressTest.test_getAllByNameLjava_lang_String >>>>>> ( >>>>>> InetAddressTest.java:165) at >>>>>> java.lang.reflect.AccessibleObject.invokeV( >>>>>> AccessibleObject.java:205) >>>>>> >>>>>> Thanks, >>>>>> Stepan. >>>>>> >>>>>> -----Original Message----- >>>>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >>>>>> Sent: Friday, June 23, 2006 4:36 AM >>>>>> To: [EMAIL PROTECTED] >>>>>> Subject: svn commit: r416477 - in >>>>>> /incubator/harmony/enhanced/classlib/trunk/modules/luni: ./ >>>>>> src/main/java/java/net/ src/test/java/tests/api/java/net/ >>>>>> >>>>>> >>>>>> >>>>>> Author: gharley >>>>>> >>>>>> Date: Thu Jun 22 14:36:24 2006 >>>>>> >>>>>> New Revision: 416477 >>>>>> >>>>>> >>>>>> >>>>>> URL: http://svn.apache.org/viewvc?rev=416477&view=rev >>>>>> >>>>>> Log: >>>>>> >>>>>> Liberate ServerSocketTest, InetAddressTest and SocketPermissionTest >>>>>> from >>>>>> the >>>>>> excludes list. Fix up a couple of bugs in InetAddressTest. Remove a >>>>>> couple >>>>>> of duplicate entries in tests.api.java.net.AllTests suite. >>>>>> >>>>>> >>>>>> >>>>>> Modified: >>>>>> >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml >>>>>> >>>>>> >>>>>> >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/n >>>>>> >>>>>> >>>>> et/ServerSocket.java >>>>> >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/ >>>>>> >>>>>> >>>>> api/java/net/AllTests.java >>>>> >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/ >>>>>> >>>>>> >>>>> api/java/net/InetAddressTest.java >>>>> >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/ >>>>>> >>>>>> >>>>> api/java/net/ServerSocketTest.java >>>>> >>>>>> Modified: >>>>>> incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml >>>>>> >>>>>> URL: >>>>>> >>>>>> http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modu >>>>>> >>>>>> >>>>> les/luni/build.xml?rev=416477&r1=416476&r2=416477&view=diff >>>>> >>>>>> =========================================================================== >>>>>> >>>>>> >>>>> === >>>>> >>>>>> <SNIP> >>>>>> >>>>>> -- >>>>>> Thanks, >>>>>> Stepan Mishura >>>>>> Intel Middleware Products Division >>>>>> >>>>>> ------------------------------------------------------ >>>>>> Terms of use : http://incubator.apache.org/harmony/mailing.html >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> Andrew Zhang >>>>> China Software Development Lab, IBM >>>>> >>>>> ------=_Part_22520_3761084.1151039694395-- >>>>> >>>> --------------------------------------------------------------------- >>>> Terms of use : http://incubator.apache.org/harmony/mailing.html >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>>> >>>> >>> --------------------------------------------------------------------- >>> Terms of use : http://incubator.apache.org/harmony/mailing.html >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> --------------------------------------------------------------------- >> Terms of use : http://incubator.apache.org/harmony/mailing.html >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]