]> arthur.barton.de Git - netatalk.git/commitdiff
New afpd.conf options tcprcvbuf and tcpsndbuf
authorFrank Lahm <franklahm@googlemail.com>
Mon, 28 Mar 2011 20:03:23 +0000 (22:03 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 28 Mar 2011 20:03:23 +0000 (22:03 +0200)
NEWS
etc/afpd/afp_dsi.c
etc/afpd/afp_options.c
etc/afpd/globals.h

diff --git a/NEWS b/NEWS
index 196b1a4aea558994c03b8ed8cdca39d94e036ebb..fcec63817fe549fb4895f7babcd11753a8969525 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 Changes in 2.2beta4
 ===================
 
+* NEW: afpd: new afpd.conf optinos "tcprcvbuf" and "tcpsndbuf" to customize
+       the corresponding TCP socket options.
 * FIX: afpd: generate mersenne primes for DHX2 UAM once at startup,
        not for every login
 * FIX: Support for platforms that do not have the *at functions
index e522ea817d6178b39b8eb40bcb37c780f82038fa..d7cf01b39e695e3448bf6199337139b65121cf90 100644 (file)
@@ -457,6 +457,22 @@ void afp_over_dsi(AFPObj *obj)
     if (dircache_init(obj->options.dircachesize) != 0)
         afp_dsi_die(EXITERR_SYS);
 
+    /* set TCP snd/rcv buf */
+    if (setsockopt(dsi->socket,
+                   SOL_SOCKET,
+                   SO_RCVBUF,
+                   &obj->options.tcp_rcvbuf,
+                   sizeof(obj->options.tcp_rcvbuf)) != 0) {
+        LOG(log_error, logtype_dsi, "dsi_tcp_open: setsockopt(SO_RCVBUF): %s", strerror(errno));
+    }
+    if (setsockopt(dsi->socket,
+                   SOL_SOCKET,
+                   SO_SNDBUF,
+                   &obj->options.tcp_sndbuf,
+                   sizeof(obj->options.tcp_sndbuf)) != 0) {
+        LOG(log_error, logtype_dsi, "dsi_tcp_open: setsockopt(SO_SNDBUF): %s", strerror(errno));
+    }
+
     /* get stuck here until the end */
     while (1) {
         if (sigsetjmp(recon_jmp, 1) != 0)
index e513821789bac0dba5e197a8336be5182baf4464..0f6711853076524e9aaa21c4eb53bf764616f2dc 100644 (file)
@@ -186,6 +186,8 @@ void afp_options_init(struct afp_options *options)
     options->dircachesize = DEFAULT_MAX_DIRCACHE_SIZE;
     options->flags |= OPTION_ACL2MACCESS;
     options->flags |= OPTION_UUID;
+    options->tcp_sndbuf = 65535;
+    options->tcp_rcvbuf = 65535;
 }
 
 /* parse an afpd.conf line. i'm doing it this way because it's
@@ -463,6 +465,12 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     if ((c = getoption(buf, "-dircachesize")))
         options->dircachesize = atoi(c);
      
+    if ((c = getoption(buf, "-tcpsndbuf")))
+        options->tcp_sndbuf = atoi(c);
+
+    if ((c = getoption(buf, "-tcprcvbuf")))
+        options->tcp_rcvbuf = atoi(c);
+
     return 1;
 }
 
index 9b6465143a20facec691050e4a31bf9aa9580125..67fd4607eef1fd71a237e1061145f2a84207c3e8 100644 (file)
@@ -65,6 +65,7 @@ struct afp_options {
     int connections, transports, tickleval, timeout, server_notif, flags, dircachesize;
     int sleep;                  /* Maximum time allowed to sleep (in tickles) */
     int disconnected;           /* Maximum time in disconnected state (in tickles) */
+    unsigned int tcp_sndbuf, tcp_rcvbuf;
     unsigned char passwdbits, passwdminlen, loginmaxfail;
     u_int32_t server_quantum;
     char hostname[MAXHOSTNAMELEN + 1], *server, *ipaddr, *port, *configfile;