View | Details | Raw Unified | Return to bug 240827 | Differences between
and this patch

Collapse All | Expand All

(-)contrib/tnftp/src/cmds.c (-2 / +6 lines)
Lines 2653-2662 Link Here
2653
		goto usage;
2653
		goto usage;
2654
	}
2654
	}
2655
2655
2656
	if (dir & RATE_PUT)
2656
	if (dir & RATE_PUT) {
2657
		sndbuf_size = size;
2657
		sndbuf_size = size;
2658
	if (dir & RATE_GET)
2658
		auto_sndbuf = 0;
2659
	}
2660
	if (dir & RATE_GET) {
2659
		rcvbuf_size = size;
2661
		rcvbuf_size = size;
2662
		auto_rcvbuf = 0;
2663
	}
2660
	fprintf(ttyout, "Socket buffer sizes: send %d, receive %d.\n",
2664
	fprintf(ttyout, "Socket buffer sizes: send %d, receive %d.\n",
2661
	    sndbuf_size, rcvbuf_size);
2665
	    sndbuf_size, rcvbuf_size);
2662
	code = 0;
2666
	code = 0;
(-)contrib/tnftp/src/ftp_var.h (+2 lines)
Lines 298-303 Link Here
298
298
299
GLOBAL	int	sndbuf_size;	/* socket send buffer size */
299
GLOBAL	int	sndbuf_size;	/* socket send buffer size */
300
GLOBAL	int	rcvbuf_size;	/* socket receive buffer size */
300
GLOBAL	int	rcvbuf_size;	/* socket receive buffer size */
301
GLOBAL	int	auto_sndbuf;	/* flag: if != 0 then use auto sndbuf size */
302
GLOBAL	int	auto_rcvbuf;	/* flag: if != 0 then use auto rcvbuf size */
301
303
302
GLOBAL	int	macnum;		/* number of defined macros */
304
GLOBAL	int	macnum;		/* number of defined macros */
303
GLOBAL	struct macel macros[16];
305
GLOBAL	struct macel macros[16];
(-)contrib/tnftp/src/main.c (+10 lines)
Lines 127-132 Link Here
127
#include <locale.h>
127
#include <locale.h>
128
128
129
#endif	/* tnftp */
129
#endif	/* tnftp */
130
#ifdef __FreeBSD__
131
#include <sys/sysctl.h>
132
#endif
130
133
131
#define	GLOBAL		/* force GLOBAL decls in ftp_var.h to be declared */
134
#define	GLOBAL		/* force GLOBAL decls in ftp_var.h to be declared */
132
#include "ftp_var.h"
135
#include "ftp_var.h"
Lines 510-515 Link Here
510
	(void)xsignal(SIGUSR2, crankrate);
513
	(void)xsignal(SIGUSR2, crankrate);
511
	(void)xsignal(SIGWINCH, setttywidth);
514
	(void)xsignal(SIGWINCH, setttywidth);
512
515
516
	auto_rcvbuf = ((sysctlbyname("net.inet.tcp.recvbuf_auto",
517
	    &auto_rcvbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) &&
518
	    auto_rcvbuf == 1);
519
	auto_sndbuf = ((sysctlbyname("net.inet.tcp.sendbuf_auto",
520
	    &auto_sndbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) &&
521
	    auto_sndbuf == 1);
522
513
	if (argc > 0) {
523
	if (argc > 0) {
514
		if (isupload) {
524
		if (isupload) {
515
			rval = auto_put(argc, argv, upload_path);
525
			rval = auto_put(argc, argv, upload_path);
(-)contrib/tnftp/src/util.c (+8 lines)
Lines 1087-1096 Link Here
1087
		    sndbuf_size);
1087
		    sndbuf_size);
1088
	}
1088
	}
1089
1089
1090
#ifdef __FreeBSD__
1091
	DPRINTF("auto_rcvbuf = %d\n", auto_rcvbuf);
1092
	if (auto_sndbuf == 0)
1093
#endif
1090
	if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
1094
	if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
1091
	    (void *)&sndbuf_size, sizeof(sndbuf_size)) == -1)
1095
	    (void *)&sndbuf_size, sizeof(sndbuf_size)) == -1)
1092
		warn("Unable to set sndbuf size %d", sndbuf_size);
1096
		warn("Unable to set sndbuf size %d", sndbuf_size);
1093
1097
1098
#ifdef __FreeBSD__
1099
	DPRINTF("auto_sndbuf = %d\n", auto_sndbuf);
1100
	if (auto_rcvbuf == 0)
1101
#endif
1094
	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
1102
	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
1095
	    (void *)&rcvbuf_size, sizeof(rcvbuf_size)) == -1)
1103
	    (void *)&rcvbuf_size, sizeof(rcvbuf_size)) == -1)
1096
		warn("Unable to set rcvbuf size %d", rcvbuf_size);
1104
		warn("Unable to set rcvbuf size %d", rcvbuf_size);

Return to bug 240827