diff -u -r ../wu-ftpd-2.6.1/doc/ftpd.8 ./doc/ftpd.8 --- ../wu-ftpd-2.6.1/doc/ftpd.8 Sat Jul 1 13:49:09 2000 +++ ./doc/ftpd.8 Mon Jun 11 22:39:07 2001 @@ -40,6 +40,8 @@ ] [ .BR \-A ] [ +.BR \-b +] [ .BR \-L ] [ .BR \-i @@ -128,6 +130,12 @@ option is specified, use of the .IR ftpaccess (5) configuration file is disabled. This is the default. +.PP +If the +.B \-b +option is specified, data connections opened for anonymous users will +be marked for QBone Scavenger Service (QBSS). This should essentially +make them only eligible for bandwidth that's not otherwise used. .PP If the .B \-L diff -u -r ../wu-ftpd-2.6.1/src/ftpd.c ./src/ftpd.c --- ../wu-ftpd-2.6.1/src/ftpd.c Sat Jul 1 14:17:39 2000 +++ ./src/ftpd.c Mon Jun 11 23:40:49 2001 @@ -182,6 +182,10 @@ #define MAXHOSTNAMELEN 64 /* may be too big */ #endif +#ifndef IPTOS_QBSS +#define IPTOS_QBSS 0x20 +#endif + #ifndef TRUE #define TRUE 1 #endif @@ -305,6 +309,7 @@ off_t file_size; off_t byte_count; int TCPwindowsize = 0; /* 0 = use system default */ +int use_qbss = 0; /* Set to use QBSS on anon data connections. */ #ifdef TRANSFER_COUNT int data_count_total = 0; /* total number of data bytes */ @@ -647,9 +652,9 @@ #endif /* DAEMON */ #ifndef DAEMON - while ((c = getopt(argc, argv, ":aAvdlLiIoP:qQr:t:T:u:wVWX")) != -1) { + while ((c = getopt(argc, argv, ":aAbvdlLiIoP:qQr:t:T:u:wVWX")) != -1) { #else /* DAEMON */ - while ((c = getopt(argc, argv, ":aAvdlLiIop:P:qQr:sSt:T:u:VwWX")) != -1) { + while ((c = getopt(argc, argv, ":aAbvdlLiIop:P:qQr:sSt:T:u:VwWX")) != -1) { #endif /* DAEMON */ switch (c) { @@ -661,6 +666,10 @@ use_accessfile = 0; break; + case 'b': + use_qbss = 1; + break; + case 'v': debug = 1; break; @@ -4720,7 +4729,10 @@ enable_signaling(); /* we can allow signals once again: kinch */ #ifdef IPTOS_THROUGHPUT - on = IPTOS_THROUGHPUT; + /* + * If it was safe to set IPTOS_THROUGHPUT before, it should be + * safe to set IPTOS_QBSS now. */ + on = (use_qbss && anonymous)? IPTOS_QBSS: IPTOS_THROUGHPUT; if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *) &on, sizeof(int)) < 0) syslog(LOG_WARNING, "setsockopt (IP_TOS): %m"); #endif @@ -4821,10 +4833,14 @@ (void) close(pdata); pdata = s; #ifdef IPTOS_LOWDELAY - tos = IPTOS_LOWDELAY; - (void) setsockopt(s, IPPROTO_IP, IP_TOS, (char *) &tos, - sizeof(int)); - + /* + * I won't even begin to wonder why active connections get + * IPTOS_THROUGHPUT by default, while passive ones get + * IPTOS_LOWDELAY. In any case, where setting IP_TOS was done + * before, it should be safe to do now as well. */ + tos = (use_qbss && anonymous)? IPTOS_QBSS: IPTOS_LOWDELAY; + if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(int)) < 0) + syslog(LOG_WARNING, "setsockopt (IP_TOS): %m"); #endif (void) strncpy(dataaddr, inet_ntoa(from.sin_addr), sizeof(dataaddr)); if (!pasv_allowed(dataaddr))