Jim, In the recv calls (recv, recvfrom, etc) the peeraddr is a specified as a buffer with a size. The buffer is an address to a range of memory, the size is the number of bytes which may be written to the buffer - can be anything really, as long as the value is large enough to hold the address of the peer.
However, in the send calls (send, sendto, etc), the address is specified as a pointer to an address AND the number of bytes in the address, not the number of bytes in the buffer holding the address. A sockaddr_storage is a very large address buffer, designed to be large enough to hold any possible address - I believe it's about 64 bytes. Basically, I believe the call to sendto is coded incorrectly - it shouldn't be passing the size of the address buffer as the final parameter, but really it should be passing a number of bytes in the address that's being passed - probably 16 (the number of bytes in an IPv4 address). A quick glance at the revision list for this file shows that Rev 1428 is where the affecting change took place - that was when the last maintainer merged the IPv6 branch into the trunk line. Prior to this change, the addrsize parameter was passed as sizeof(struct sockaddr_in), which is exactly what's being passed. That said, however, the real problem is that the SLPNetworkSendMessage function was never written correctly to begin with. The sendto function wants the number of address bytes being passed, not the size of the buffer, which means that another parameter should be added to the SLPNetworkSendMessage function to get it to work correctly in all cases. I'll tell you what - change the last parameter in the sendto call to sizeof(struct sockaddr_in) for a test. If it works, let me know, and I'll write the correct fix, and check it in. You can ping me on I/M if you want - I should be online all day. John jim marshall wrote: > I've been trying to figure out why the slptool 2.0.0 does not work on > Solaris. I have debugged through some code, and have come to > > SLPNetworkSendMessage (sockfd=7, socktype=1, buf=0x2a570, bufsz=49, > peeraddr=0xffbff3f0, timeout=0xffbff178) at > ../../common/slp_network.c:155 > > > 155 xferbytes = sendto(sockfd, (char *)cur, > 156 (int)(end - cur), flags, peeraddr, > 157 sizeof(struct sockaddr_storage)); > > This call returns -1 (errno==22, Invalid argument). Given this, I am > presuming the problem is the 'peeraddr' structure being invalid (since > "(int)(end - cur)" is 49, which does not overflow a size_t). Looking at > where the peeradr is set (in NetworkConnectToSlpd) everything looks fine: > > (gdb) print *(struct sockaddr_in *) addr > $95 = {sin_family = 2, sin_port = 427, sin_addr = {S_un = {S_un_b = { > s_b1 = 127 '\177', s_b2 = 0 '\0', s_b3 = 0 '\0', s_b4 = 1 '\001'}, > S_un_w = {s_w1 = 32512, s_w2 = 1}, S_addr = 2130706433}}, > sin_zero = "\000\000\000\000\000\000\000"} > > I'm not sure where else to look for this. > > Any thoughts? > > > Thanks > -Jim > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Openslp-users mailing list > Openslp-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openslp-users > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Openslp-users mailing list Openslp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openslp-users