The type of service (TOS) of all sockets is set to "interactive" now.

This commit is contained in:
Alexander Barton 2004-01-25 16:06:34 +00:00
parent e9b0ec9148
commit bb98fd8c85
3 changed files with 39 additions and 16 deletions

View File

@ -12,6 +12,7 @@
ngIRCd CVSHEAD ngIRCd CVSHEAD
- The type of service (TOS) of all sockets is set to "interactive" now.
- Added short command line option "-t" as alternative to "--configtest". - Added short command line option "-t" as alternative to "--configtest".
- Added optional support for "IDENT" lookups on incoming connections. You - Added optional support for "IDENT" lookups on incoming connections. You
have to enable this function with the ./configure switch "--with-ident". have to enable this function with the ./configure switch "--with-ident".
@ -492,4 +493,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: ChangeLog,v 1.221 2003/12/29 14:53:26 alex Exp $ $Id: ChangeLog,v 1.222 2004/01/25 16:06:35 alex Exp $

4
NEWS
View File

@ -12,6 +12,8 @@
ngIRCd CVSHEAD ngIRCd CVSHEAD
- The type of service (TOS) of all sockets is set to "interactive" now.
- Added short command line option "-t" as alternative to "--configtest".
- Added optional support for "IDENT" lookups on incoming connections. You - Added optional support for "IDENT" lookups on incoming connections. You
have to enable this function with the ./configure switch "--with-ident". have to enable this function with the ./configure switch "--with-ident".
The default is not to do IDENT lookups. The default is not to do IDENT lookups.
@ -180,4 +182,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: NEWS,v 1.61 2003/12/27 13:01:12 alex Exp $ $Id: NEWS,v 1.62 2004/01/25 16:06:34 alex Exp $

View File

@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) * Copyright (c)2001-2004 by Alexander Barton (alex@barton.de)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $"; static char UNUSED id[] = "$Id: conn.c,v 1.130 2004/01/25 16:06:35 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -33,18 +33,22 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $";
#include <time.h> #include <time.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#else #else
#define PF_INET AF_INET # define PF_INET AF_INET
#endif #endif
#ifdef HAVE_STDINT_H #ifdef HAVE_STDINT_H
#include <stdint.h> /* e.g. for Mac OS X */ # include <stdint.h> /* e.g. for Mac OS X */
#endif #endif
#ifdef TCPWRAP #ifdef TCPWRAP
#include <tcpd.h> /* for TCP Wrappers */ # include <tcpd.h> /* for TCP Wrappers */
#endif #endif
#include "defines.h" #include "defines.h"
@ -64,7 +68,7 @@ static char UNUSED id[] = "$Id: conn.c,v 1.129 2003/12/27 13:01:12 alex Exp $";
#include "tool.h" #include "tool.h"
#ifdef RENDEZVOUS #ifdef RENDEZVOUS
#include "rendezvous.h" # include "rendezvous.h"
#endif #endif
#include "exp.h" #include "exp.h"
@ -1549,24 +1553,40 @@ Init_Conn_Struct( CONN_ID Idx )
LOCAL BOOLEAN LOCAL BOOLEAN
Init_Socket( INT Sock ) Init_Socket( INT Sock )
{ {
/* Socket-Optionen setzen */ /* Initialize socket (set options) */
INT on = 1; INT value;
#ifdef O_NONBLOCK /* A/UX kennt das nicht? */ #ifdef O_NONBLOCK /* unknown on A/UX */
if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 ) if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 )
{ {
Log( LOG_CRIT, "Can't enable non-blocking mode: %s!", strerror( errno )); Log( LOG_CRIT, "Can't enable non-blocking mode for socket: %s!", strerror( errno ));
close( Sock ); close( Sock );
return FALSE; return FALSE;
} }
#endif #endif
if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &on, (socklen_t)sizeof( on )) != 0)
/* Don't block this port after socket shutdown */
value = 1;
if( setsockopt( Sock, SOL_SOCKET, SO_REUSEADDR, &value, (socklen_t)sizeof( value )) != 0 )
{ {
Log( LOG_ERR, "Can't set socket options: %s!", strerror( errno )); Log( LOG_ERR, "Can't set socket option SO_REUSEADDR: %s!", strerror( errno ));
/* dieser Fehler kann ignoriert werden. */ /* ignore this error */
} }
/* Set type of service (TOS) */
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
value = IPTOS_LOWDELAY;
#ifdef DEBUG
Log( LOG_DEBUG, "Setting option IP_TOS on socket %d to IPTOS_LOWDELAY (%d).", Sock, value );
#endif
if( setsockopt( Sock, SOL_IP, IP_TOS, &value, (socklen_t)sizeof( value )) != 0 )
{
Log( LOG_ERR, "Can't set socket option IP_TOS: %s!", strerror( errno ));
/* ignore this error */
}
#endif
return TRUE; return TRUE;
} /* Init_Socket */ } /* Init_Socket */