Re: want opinions on possible glitch in 2.4 network error reporting

Gerold Jury (gjury@hal.grips.com)
Thu, 7 Feb 2002 17:33:31 +0100


--------------Boundary-00=_VN86YFZ5HZBJ55BIQMI6
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is off topic but close.
UDP packets are not dropped when the UDP socket is shutdown(socket,0); for
receive at least on 2.4.17.
attached is a small proof.
Anyone with a hint or a fix ?

Thanks
Gerold

On Thursday 07 February 2002 14:44, Richard B. Johnson wrote:
>
> ENOBUFS
> The output queue for a network interface was full.
> This generally indicates that the interface has
> stopped sending, but may be caused by transient
> congestion. (This cannot occur in Linux, packets
> are just silently dropped when a device queue over­
> flows.)
>
>
> Linux Man Page July 1999 1
>

--------------Boundary-00=_VN86YFZ5HZBJ55BIQMI6
Content-Type: text/x-c++;
charset="iso-8859-1";
name="udpshutdown.c"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="udpshutdown.c"

#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

char hello[] = "hello socket";
char buf[2048];

int main( int argc, char *argv[] )
{
int iFd, ret;
socklen_t fromlen;
short port = 15678;
struct sockaddr_in addr, from;

if((iFd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("create socket");
exit( 0 );
}
addr.sin_family = AF_INET;
addr.sin_port = htons( port );
addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
if (bind( iFd, (struct sockaddr *)&addr, sizeof( addr ) ) < 0) {
fprintf(stderr,"bind to %d failed %s\n",port,strerror(errno));
exit( 0 );
}
shutdown( iFd, 0 ); // shutdown receive
// addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
if( sendto( iFd, hello, sizeof( hello ), 0, (struct sockaddr *)&addr, sizeof( addr ) ) < 0 ) {
perror("sendto");
exit( 0 );
}
ret = recvfrom( iFd, buf, sizeof( buf ), 0, (struct sockaddr *)&from, &fromlen );
if( ret < 0 ) {
perror("recvfrom");
exit( 0 );
}
printf( "received %d bytes [%s]\n", ret, buf );

shutdown( iFd, 1 ); // shutdown send
if( sendto( iFd, hello, sizeof( hello ), 0, (struct sockaddr *)&addr, sizeof( addr ) ) < 0 ) {
perror("sendto");
exit( 0 );
}
return 0;
}

--------------Boundary-00=_VN86YFZ5HZBJ55BIQMI6--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/