+2004-05-15 Isomer <isomer@undernet.org>
+
+ [Original ChangeLog date: 2003-11-23 -MDP]
+
+ * ircd/os_*.c, ircd/ircd_features.c: Default changing window sizes
+ to off. if an admin is smart enough to understand these features
+ they can enable them manually.
+
2004-05-15 Isomer <isomer@undernet.org>
[Original ChangeLog date: 2003-11-18 -MDP]
they will never get throttled. This is so after a restart users on a
multiuser box can all connect to a server simultaniously without being
considered an attack.
+
+SOCKSENDBUF
+ * Type: integer
+ * Default: 0
+
+The send window size used for connections to other servers.
+
+SOCKRECVBUF
+ * Type: integer
+ * Default: 0
+
+The receive window size used for connections to other servers.
FEAT_CONNECTFREQUENCY,
FEAT_DEFAULTMAXSENDQLENGTH,
FEAT_GLINEMAXUSERCOUNT,
+ FEAT_SOCKSENDBUF,
+ FEAT_SOCKRECVBUF,
FEAT_IPCHECK_CLONE_LIMIT,
FEAT_IPCHECK_CLONE_PERIOD,
FEAT_IPCHECK_CLONE_DELAY,
extern int os_set_listen(int fd, int backlog);
extern int os_set_nonblocking(int fd);
extern int os_set_reuseaddr(int fd);
-extern int os_set_sockbufs(int fd, unsigned int size);
+extern int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize);
extern int os_set_tos(int fd,int tos);
#endif /* INCLUDED_ircd_osdep_h */
F_I(CONNECTFREQUENCY, 0, 600, init_class),
F_I(DEFAULTMAXSENDQLENGTH, 0, 40000, init_class),
F_I(GLINEMAXUSERCOUNT, 0, 20, 0),
+ F_I(SOCKSENDBUF, 0, 0, 0),
+ F_I(SOCKRECVBUF, 0, 0, 0),
F_I(IPCHECK_CLONE_LIMIT, 0, 4, 0),
F_I(IPCHECK_CLONE_PERIOD, 0, 40, 0),
F_I(IPCHECK_CLONE_DELAY, 0, 600, 0),
* else has no effect whatsoever on the connection.
* NOTE: this must be set before listen is called
*/
- if (!os_set_sockbufs(fd, (listener->server) ? SERVER_TCP_WINDOW : CLIENT_TCP_WINDOW)) {
+ if (!os_set_sockbufs(fd,
+ (listener->server) ? feature_int(FEAT_SOCKSENDBUF) : CLIENT_TCP_WINDOW,
+ (listener->server) ? feature_int(FEAT_SOCKRECVBUF) : CLIENT_TCP_WINDOW)) {
report_error(SETBUFS_ERROR_MSG, get_listener_name(listener), errno);
close(fd);
return 0;
(const char*) &opt, sizeof(opt)));
}
-int os_set_sockbufs(int fd, unsigned int size)
+int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize)
{
- unsigned int opt = size;
+ unsigned int sopt = ssize;
+ unsigned int ropt = rsize;
return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
- (const char*) &opt, sizeof(opt)) &&
+ (const char*) &ropt, sizeof(ropt)) &&
0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
- (const char*) &opt, sizeof(opt)));
+ (const char*) &sopt, sizeof(sopt)));
}
int os_set_tos(int fd,int tos)
(const char*) &opt, sizeof(opt)));
}
-int os_set_sockbufs(int fd, unsigned int size)
+int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize)
{
- unsigned int opt = size;
+ unsigned int sopt = ssize;
+ unsigned int ropt = rsize;
return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
- (const char*) &opt, sizeof(opt)) &&
+ (const char*) &ropt, sizeof(ropt)) &&
0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
- (const char*) &opt, sizeof(opt)));
+ (const char*) &sopt, sizeof(sopt)));
}
int os_set_tos(int fd,int tos)
#include <sys/times.h>
#include <sys/uio.h>
#include <sys/param.h>
-#if 0
#include <unistd.h>
-#endif
/*
* This is part of the STATS replies. There is no offical numeric for this
return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)));
}
-int os_set_sockbufs(int fd, unsigned int size)
+int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize)
{
- unsigned int opt = size;
- return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) &&
- 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)));
+ unsigned int sopt = ssize;
+ unsigned int ropt = rsize;
+ return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
+ (const char*) &ropt, sizeof(ropt)) &&
+ 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
+ (const char*) &sopt, sizeof(sopt)));
}
int os_set_tos(int fd,int tos)
(const char*) &opt, sizeof(opt)));
}
-int os_set_sockbufs(int fd, unsigned int size)
+int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize)
{
- unsigned int opt = size;
+ unsigned int sopt = ssize;
+ unsigned int ropt = rsize;
return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
- (const char*) &opt, sizeof(opt)) &&
+ (const char*) &ropt, sizeof(ropt)) &&
0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
- (const char*) &opt, sizeof(opt)));
+ (const char*) &sopt, sizeof(sopt)));
}
int os_set_tos(int fd,int tos)
(const char*) &opt, sizeof(opt)));
}
-int os_set_sockbufs(int fd, unsigned int size)
+int os_set_sockbufs(int fd, unsigned int ssize, unsigned int rsize)
{
- unsigned int opt = size;
+ unsigned int sopt = ssize;
+ unsigned int ropt = rsize;
return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
- (const char*) &opt, sizeof(opt)) &&
+ (const char*) &ropt, sizeof(ropt)) &&
0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
- (const char*) &opt, sizeof(opt)));
+ (const char*) &sopt, sizeof(sopt)));
}
int os_set_tos(int fd,int tos)
/*
* we want a big buffer for server connections
*/
- if (!os_set_sockbufs(cli_fd(cptr), SERVER_TCP_WINDOW)) {
+ if (!os_set_sockbufs(cli_fd(cptr), feature_int(FEAT_SOCKSENDBUF), feature_int(FEAT_SOCKRECVBUF))) {
cli_error(cptr) = errno;
report_error(SETBUFS_ERROR_MSG, cli_name(cptr), errno);
close(cli_fd(cptr));