Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2004-05-15 14:45:08 UTC

Modified files:
     ChangeLog doc/readme.features include/ircd_features.h
     include/ircd_osdep.h ircd/ircd_features.c ircd/listener.c
     ircd/os_bsd.c ircd/os_generic.c ircd/os_linux.c ircd/os_openbsd.c
     ircd/os_solaris.c ircd/s_bsd.c

Log message:

Forward port SOCKSENDBUF, SOCKRECVBUF features from 2.10.11.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.399 ircu2.10/ChangeLog:1.400
--- ircu2.10/ChangeLog:1.399    Sat May 15 07:01:45 2004
+++ ircu2.10/ChangeLog  Sat May 15 07:44:56 2004
@@ -1,5 +1,13 @@
 2004-05-15  Isomer <[EMAIL PROTECTED]>
 
+       [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 <[EMAIL PROTECTED]>
+
        [Original ChangeLog date: 2003-11-18 -MDP]
 
        * ircd/s_auth.c, ircd/res_libresolv.c, ircd/res_adns.c: Clean up
Index: ircu2.10/doc/readme.features
diff -u ircu2.10/doc/readme.features:1.9 ircu2.10/doc/readme.features:1.10
--- ircu2.10/doc/readme.features:1.9    Sat May 15 07:01:47 2004
+++ ircu2.10/doc/readme.features        Sat May 15 07:44:57 2004
@@ -1131,3 +1131,15 @@
 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.
Index: ircu2.10/include/ircd_features.h
diff -u ircu2.10/include/ircd_features.h:1.23 ircu2.10/include/ircd_features.h:1.24
--- ircu2.10/include/ircd_features.h:1.23       Sat May 15 07:01:48 2004
+++ ircu2.10/include/ircd_features.h    Sat May 15 07:44:57 2004
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: ircd_features.h,v 1.23 2004/05/15 14:01:48 entrope Exp $
+ * $Id: ircd_features.h,v 1.24 2004/05/15 14:44:57 entrope Exp $
  */
 
 struct Client;
@@ -68,6 +68,8 @@
   FEAT_CONNECTFREQUENCY,
   FEAT_DEFAULTMAXSENDQLENGTH,
   FEAT_GLINEMAXUSERCOUNT,
+  FEAT_SOCKSENDBUF,
+  FEAT_SOCKRECVBUF,
   FEAT_IPCHECK_CLONE_LIMIT,
   FEAT_IPCHECK_CLONE_PERIOD,
   FEAT_IPCHECK_CLONE_DELAY,
Index: ircu2.10/include/ircd_osdep.h
diff -u ircu2.10/include/ircd_osdep.h:1.4 ircu2.10/include/ircd_osdep.h:1.5
--- ircu2.10/include/ircd_osdep.h:1.4   Wed Jun  6 17:29:47 2001
+++ ircu2.10/include/ircd_osdep.h       Sat May 15 07:44:57 2004
@@ -1,7 +1,7 @@
 /*
  * ircd_osdep.h
  *
- * $Id: ircd_osdep.h,v 1.4 2001/06/07 00:29:47 kev Exp $
+ * $Id: ircd_osdep.h,v 1.5 2004/05/15 14:44:57 entrope Exp $
  */
 #ifndef INCLUDED_ircd_osdep_h
 #define INCLUDED_ircd_osdep_h
@@ -42,7 +42,7 @@
 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 */
Index: ircu2.10/ircd/ircd_features.c
diff -u ircu2.10/ircd/ircd_features.c:1.29 ircu2.10/ircd/ircd_features.c:1.30
--- ircu2.10/ircd/ircd_features.c:1.29  Sat May 15 07:01:49 2004
+++ ircu2.10/ircd/ircd_features.c       Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: ircd_features.c,v 1.29 2004/05/15 14:01:49 entrope Exp $
+ * $Id: ircd_features.c,v 1.30 2004/05/15 14:44:58 entrope Exp $
  */
 #include "config.h"
 
@@ -274,6 +274,8 @@
   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),
Index: ircu2.10/ircd/listener.c
diff -u ircu2.10/ircd/listener.c:1.20 ircu2.10/ircd/listener.c:1.21
--- ircu2.10/ircd/listener.c:1.20       Sat Jan 11 04:49:26 2003
+++ ircu2.10/ircd/listener.c    Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- *  $Id: listener.c,v 1.20 2003/01/11 12:49:26 bleepster Exp $
+ *  $Id: listener.c,v 1.21 2004/05/15 14:44:58 entrope Exp $
  */
 #include "config.h"
 
@@ -210,7 +210,9 @@
    * 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;
Index: ircu2.10/ircd/os_bsd.c
diff -u ircu2.10/ircd/os_bsd.c:1.11 ircu2.10/ircd/os_bsd.c:1.12
--- ircu2.10/ircd/os_bsd.c:1.11 Mon Jul  9 09:33:37 2001
+++ ircu2.10/ircd/os_bsd.c      Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: os_bsd.c,v 1.11 2001/07/09 16:33:37 kev Exp $
+ * $Id: os_bsd.c,v 1.12 2004/05/15 14:44:58 entrope Exp $
  *
  */
 #include "config.h"
@@ -209,13 +209,14 @@
                           (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)
Index: ircu2.10/ircd/os_generic.c
diff -u ircu2.10/ircd/os_generic.c:1.9 ircu2.10/ircd/os_generic.c:1.10
--- ircu2.10/ircd/os_generic.c:1.9      Wed Jun  6 17:29:47 2001
+++ ircu2.10/ircd/os_generic.c  Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: os_generic.c,v 1.9 2001/06/07 00:29:47 kev Exp $
+ * $Id: os_generic.c,v 1.10 2004/05/15 14:44:58 entrope Exp $
  *
  */
 #include "config.h"
@@ -211,13 +211,14 @@
                           (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)
Index: ircu2.10/ircd/os_linux.c
diff -u ircu2.10/ircd/os_linux.c:1.9 ircu2.10/ircd/os_linux.c:1.10
--- ircu2.10/ircd/os_linux.c:1.9        Wed Jun  6 17:29:47 2001
+++ ircu2.10/ircd/os_linux.c    Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: os_linux.c,v 1.9 2001/06/07 00:29:47 kev Exp $
+ * $Id: os_linux.c,v 1.10 2004/05/15 14:44:58 entrope Exp $
  *
  */
 #include "config.h"
@@ -40,9 +40,7 @@
 #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
@@ -152,11 +150,14 @@
   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)
Index: ircu2.10/ircd/os_openbsd.c
diff -u ircu2.10/ircd/os_openbsd.c:1.4 ircu2.10/ircd/os_openbsd.c:1.5
--- ircu2.10/ircd/os_openbsd.c:1.4      Wed Jun  6 17:29:47 2001
+++ ircu2.10/ircd/os_openbsd.c  Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: os_openbsd.c,v 1.4 2001/06/07 00:29:47 kev Exp $
+ * $Id: os_openbsd.c,v 1.5 2004/05/15 14:44:58 entrope Exp $
  *
  */
 #include "config.h"
@@ -216,13 +216,14 @@
                           (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)
Index: ircu2.10/ircd/os_solaris.c
diff -u ircu2.10/ircd/os_solaris.c:1.9 ircu2.10/ircd/os_solaris.c:1.10
--- ircu2.10/ircd/os_solaris.c:1.9      Wed Jun  6 17:29:47 2001
+++ ircu2.10/ircd/os_solaris.c  Sat May 15 07:44:58 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: os_solaris.c,v 1.9 2001/06/07 00:29:47 kev Exp $
+ * $Id: os_solaris.c,v 1.10 2004/05/15 14:44:58 entrope Exp $
  *
  */
 #include "config.h"
@@ -125,13 +125,14 @@
                           (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)
Index: ircu2.10/ircd/s_bsd.c
diff -u ircu2.10/ircd/s_bsd.c:1.57 ircu2.10/ircd/s_bsd.c:1.58
--- ircu2.10/ircd/s_bsd.c:1.57  Sat Jan 11 04:49:27 2003
+++ ircu2.10/ircd/s_bsd.c       Sat May 15 07:44:58 2004
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: s_bsd.c,v 1.57 2003/01/11 12:49:27 bleepster Exp $
+ * $Id: s_bsd.c,v 1.58 2004/05/15 14:44:58 entrope Exp $
  */
 #include "config.h"
 
@@ -290,7 +290,7 @@
   /*
    * 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));
----------------------- End of diff -----------------------

Reply via email to