RE: Fix for Solaris udp bug in iperf 1.6.5
> >To: dast --at-- nlanr.net
> >Subject: Fix for Solaris udp bug in iperf 1.6.5
> >From: Sam Horrocks <sam --at-- daemoninc.com>
> >Date: Mon, 10 Feb 2003 16:47:56 -0800
> >
> >Iperf 1.6.5 on solaris-8 dies in udp server mode as soon as the first
> packet is received:
> >
> > ./iperf -s -u -i 1
> > ------------------------------------------------------------
> > Server listening on UDP port 5001
> > Receiving 1470 byte datagrams
> > UDP buffer size: 8.00 KByte (default)
> > ------------------------------------------------------------
> > connect UDP failed: Invalid argument
> >
> >Apparently the third arg to connect is too large for solaris, and causing
> >it to return EINVAL. The fix is to pass in sizeof(struct sockaddr)
> >which is 16 bytes instead of sizeof(peer) which is 256 bytes.
> >
> >
> >*** src/Listener.cpp.orig Mon Feb 10 18:41:45 2003
> >--- src/Listener.cpp Mon Feb 10 18:43:13 2003
> >***************
> >*** 141,147 ****
> > int32_t datagramID = ntohl( mBuf_UDP->id );
> > if ( !exist && datagramID >= 0 ) {
> > int rc = connect( mSock, (struct sockaddr*) &peer
> >! ,sizeof(peer));
> > FAIL_errno( rc == SOCKET_ERROR, "connect UDP" );
> > #ifndef WIN32
> > (clients_mutex).Lock();
> >--- 141,147 ----
> > int32_t datagramID = ntohl( mBuf_UDP->id );
> > if ( !exist && datagramID >= 0 ) {
> > int rc = connect( mSock, (struct sockaddr*) &peer
> >! ,sizeof(struct sockaddr));
> > FAIL_errno( rc == SOCKET_ERROR, "connect UDP" );
> > #ifndef WIN32
> > (clients_mutex).Lock();
Thanks for the patch. It may not be very portable, and it may destroy IPv6
usage. I will get a fix in for the next release though. Thanks again.
Kevin