rsync icon indicating copy to clipboard operation
rsync copied to clipboard

sockopts: support many more socket options, including strings

Open robbat2 opened this issue 1 year ago • 5 comments

Add support for many more socket options, including those that take string inputs, such as TCP_CONGESTION=bbr.

Options known to the code, but not present at build time will now emit an error that is distict from options unknown to the code (unknown vs not-available).

This patch greatly eases running specific rsync configurations, without relying on LD_PRELOAD to modify socket behaviors.

robbat2 avatar Aug 20 '23 05:08 robbat2

maintainer: It's not clear to me why the FreeBSD build cannot find the new symbol. The Linux build finds it correctly, even with as-needed.

./configure -C --enable-maintainer-mode CFLAGS="$CFLAGS -Wall -W -Wa,--noexecstack -Wl,--as-needed -O3 -ggdb3" && make clean && gmake -j && strace -e trace=setsockopt ./rsync --sockopts='SO_INCOMING_CPU=1,IP_FREEBIND,IPTOS_RELIABILITY,TCP_FASTOPEN,TCP_FASTOPEN_CONNECT'  localhost::

...
gcc -I./zlib  -Wall -W -Wa,--noexecstack -Wl,--as-needed -O3 -ggdb3 -DMAINTAINER_MODE -DHAVE_CONFIG_H -Wall -W  -o rsync flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util1.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o progress.o pipe.o sockopts.o  simd-checksum-x86_64.o  params.o loadparm.o clientserver.o access.o connection.o authenticate.o lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o  zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o  -lattr -lacl -lpopt -llz4 -lzstd -lxxhash -lcrypto 
setsockopt(3, SOL_SOCKET, SO_INCOMING_CPU, [1], 4) = 0
setsockopt(3, SOL_IP, IP_FREEBIND, [1], 4) = 0
setsockopt(3, SOL_IP, IP_TOS, [4], 4)   = 0
setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0
setsockopt(3, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0
rsync-test-module	
+++ exited with 0 +++

robbat2 avatar Aug 21 '23 00:08 robbat2

@WayneD this is ready for your review

robbat2 avatar Aug 21 '23 20:08 robbat2

@robbat2 needs a rebase

tridge avatar Apr 06 '24 23:04 tridge

@tridge rebased now; only conflict was in NEWS.md ; verified that the tests also still pass

robbat2 avatar Apr 08 '24 18:04 robbat2

@tridge rebased again if you could merge please?

robbat2 avatar Jul 08 '24 05:07 robbat2