=net-misc/balance-3.40 has an issue with IPv6 that i cannot seem to work around. When running 3.40, this message is returned: setsockopt(IPV6_V6ONLY=0): Protocol not available Oddly, IPv6 is implemented in the kernel I am using (2.6.31-gentoo-r6). Here's a full debug output from the program: # balance -d -f -b 192.168.0.157 30321 192.168.1.35:3389 argv[0]=balance bindhost=192.168.0.157 source port 30321 file /var/run/balance/balance.30321.192.168.0.157 already exists setsockopt(IPV6_V6ONLY=0): Protocol not available It seems other distros have had this issue, and have reported that it is resolved in 3.48. Here is an example: https://bugs.launchpad.net/ubuntu/+source/balance/+bug/476437 As it seems that this issue is limited to 3.40 as that is when IPv6 was added I think, 3.35 does work for what I need so I'll drop back to that. Reproducible: Always Steps to Reproduce: 1. emerge -1qv =net-misc/balance-3.40 2. balance 1234 1.2.3.4:80 Actual Results: setsockopt(IPV6_V6ONLY=0): Protocol not available Expected Results: A working port proxy # emerge --info Portage 2.1.7.16 (default/linux/x86/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31-gentoo-r6 i686) ================================================================= System uname: Linux-2.6.31-gentoo-r6-i686-Intel-R-_Celeron-R-_CPU_2.53GHz-with-gentoo-1.12.13 Timestamp of tree: Sat, 06 Feb 2010 05:30:01 +0000 app-shells/bash: 4.0_p35 dev-lang/python: 2.6.4 dev-util/cmake: 2.6.4-r3 sys-apps/baselayout: 1.12.13 sys-apps/sandbox: 1.6-r2 sys-devel/autoconf: 2.63-r1 sys-devel/automake: 1.9.6-r2, 1.10.2 sys-devel/binutils: 2.18-r3 sys-devel/gcc: 4.3.4 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6b virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="* -@EULA" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=i686 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-O2 -march=i686 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y" FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch" GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo" LDFLAGS="-Wl,-O1" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://140.211.166.165/gentoo-portage" USE="acl apache2 bash-completion berkdb bzip2 cli cracklib crypt ctype cups curl cxx dri fortran gcj gd gdbm gif gpm iconv imagemagick ipv6 jpeg modules mudflap ncurses nls nptl nptlonly openmp pam pcre pdf perl png pppd python readline reflection samba session simplexml snmp sockets spl ssl sysfs tcpd threads tiff unicode vim-syntax x86 xml xorg zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo" Unset: CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
In CVS. Thanks for reporting.
(In reply to comment #1) > In CVS. Thanks for reporting. > I rebuilt today and it is unfortunately not working. No longer the same bug, but rather it is silently exiting. Here is one of the commands I am running: # balance -b 192.168.0.157 30321 192.168.1.35:3389 This exists silently (though it is supposed to fork, so that's not surprising). If I turn on debugging, I get this: # balance -d -b 192.168.0.157 30321 192.168.1.35:3389 argv[0]=balance bindhost=192.168.0.157 source port 30321 file /var/run/balance/balance.30321.192.168.0.157 already exists The last line is just a warning. If I call balance and tell it not to daemonize, I get this: # balance -f -d -b 192.168.0.157 30321 192.168.1.35:3389 argv[0]=balance bindhost=192.168.0.157 source port 30321 file /var/run/balance/balance.30321.192.168.0.157 created shmget: Invalid argument I'm not sure what is going on here.
Here is the output of strace: # strace balance -f -d -b 192.168.0.157 30321 192.168.1.35:3389 execve("/usr/sbin/balance", ["balance", "-f", "-d", "-b", "192.168.0.157", "30321", "192.168.1.35:3389"], [/* 33 vars */]) = 0 brk(0) = 0x82df000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=28725, ...}) = 0 mmap2(NULL, 28725, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7772000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300k\1\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1335580, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7771000 mmap2(NULL, 1341736, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7629000 mmap2(0xb776b000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x142) = 0xb776b000 mmap2(0xb776e000, 10536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb776e000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7628000 set_thread_area({entry_number:-1 -> 6, base_addr:0xb76286c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 mprotect(0xb776b000, 8192, PROT_READ) = 0 mprotect(0x804f000, 4096, PROT_READ) = 0 mprotect(0xb7797000, 4096, PROT_READ) = 0 munmap(0xb7772000, 28725) = 0 brk(0) = 0x82df000 brk(0x8300000) = 0x8300000 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7779000 write(1, "argv[0]=balance\n", 16argv[0]=balance ) = 16 write(1, "bindhost=192.168.0.157\n", 23bindhost=192.168.0.157 ) = 23 rt_sigaction(SIGUSR1, {0x8049460, [], SA_RESTART}, NULL, 8) = 0 rt_sigaction(SIGCHLD, {0x8049b00, [], SA_RESTART}, NULL, 8) = 0 getrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM_INFINITY}) = 0 setrlimit(RLIMIT_CORE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 open("/etc/nsswitch.conf", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=508, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7778000 read(3, "# /etc/nsswitch.conf:\n# $Header:"..., 4096) = 508 read(3, "", 4096) = 0 close(3) = 0 munmap(0xb7778000, 4096) = 0 open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=28725, ...}) = 0 mmap2(NULL, 28725, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7620000 close(3) = 0 open("/lib/tls/i686/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/tls/i686/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/i686", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/tls/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/tls/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/i686/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/i686/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/i686", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/lib/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/usr/lib/tls/i686/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/i686/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/i686", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/i686/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/i686", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/sse2/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/sse2", 0xbfea16d8) = -1 ENOENT (No such file or directory) open("/usr/lib/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=28672, ...}) = 0 munmap(0xb7620000, 28725) = 0 open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=28725, ...}) = 0 mmap2(NULL, 28725, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7620000 close(3) = 0 open("/lib/libnss_files.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\32\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=42432, ...}) = 0 mmap2(NULL, 45772, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7614000 mmap2(0xb761e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9) = 0xb761e000 close(3) = 0 mprotect(0xb761e000, 4096, PROT_READ) = 0 munmap(0xb7620000, 28725) = 0 open("/etc/services", O_RDONLY|O_CLOEXEC) = 3 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC) fstat64(3, {st_mode=S_IFREG|0644, st_size=36007, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7778000 read(3, "# /etc/services\n#\n# Network serv"..., 4096) = 4096 read(3, " private\t77/tcp\t\t\t\t# any private"..., 4096) = 4096 read(3, "e\nemfis-cntl\t141/udp\nimap\t\t143/t"..., 4096) = 4096 read(3, "dialog\t360/tcp\t\t\t\t# scoi2odialog"..., 4096) = 4096 read(3, "\t\tdqs313_intercell\ncryptoadmin\t6"..., 4096) = 4096 read(3, "# Citrix ICA Client\nica\t\t1494/ud"..., 4096) = 4096 read(3, "05/udp\nlstp\t\t2559/tcp\t\t\t# \nlstp\t"..., 4096) = 4096 read(3, "t-pmp\t\t5351/udp\ndns-llq\t\t5352/tc"..., 4096) = 4096 read(3, " over SSL\nrets-ssl\t12109/udp\ncaw"..., 4096) = 3239 read(3, "", 4096) = 0 close(3) = 0 munmap(0xb7778000, 4096) = 0 write(2, "source port 30321\n", 18source port 30321 ) = 18 stat64("/var/run/balance/", {st_mode=S_IFDIR|S_ISVTX|0755, st_size=4096, ...}) = 0 stat64("/var/run/balance/balance.30321.192.168.0.157", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 write(2, "file /var/run/balance/balance.30"..., 65file /var/run/balance/balance.30321.192.168.0.157 already exists ) = 65 socket(PF_NETLINK, SOCK_RAW, 0) = 3 bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0 getsockname(3, {sa_family=AF_NETLINK, pid=30673, groups=00000000}, [12]) = 0 time(NULL) = 1265670529 sendto(3, "\24\0\0\0\26\0\1\3\201\231pK\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"8\0\0\0\24\0\2\0\201\231pK\321w\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 116 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0\201\231pK\321w\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 128 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\201\231pK\321w\0\0\0\0\0\0\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 20 close(3) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [0], 4) = -1 ENOPROTOOPT (Protocol not available) time(NULL) = 1265670529 open("/etc/localtime", O_RDONLY) = 4 fstat64(4, {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0 fstat64(4, {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7778000 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\0"..., 4096) = 2819 _llseek(4, -24, [2795], SEEK_CUR) = 0 read(4, "\nPST8PDT,M3.2.0,M11.1.0\n", 4096) = 24 close(4) = 0 munmap(0xb7778000, 4096) = 0 getpid() = 30673 socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4 connect(4, {sa_family=AF_FILE, path="/dev/log"}, 110) = -1 EPROTOTYPE (Protocol wrong type for socket) close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 4 connect(4, {sa_family=AF_FILE, path="/dev/log"}, 110) = 0 send(4, "<28>Feb 8 15:08:49 Balance[3067"..., 69, MSG_NOSIGNAL) = 69 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(30321), sin_addr=inet_addr("192.168.0.157")}, 16) = 0 listen(3, 128) = 0 setsockopt(3, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0 setsockopt(3, SOL_SOCKET, SO_RCVBUF, [32768], 4) = 0 open("/var/run/balance/balance.30321.192.168.0.157", O_RDWR) = 5 fcntl64(5, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0 stat64("/var/run/balance/balance.30321.192.168.0.157", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 shmget(0x78020001, 41164, IPC_CREAT|0644) = -1 EINVAL (Invalid argument) write(2, "shmget: Invalid argument\n", 25shmget: Invalid argument ) = 25 exit_group(71) = ?
Seems there may be a work around by using the -M option: M Use memory mapping for IPC instead of shared memory Using -M allows balance to work as expected. I guess there is an issue with shared memory in general, or maybe I'm doing something wrong with shared memory on my server? All I know about shm is what fstab has: shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
Hi, I'm the new maintainer for this package, please update to version 3.54 and report if the problem persists. Thank you, Michael
I built 3.54 on the host (.0.157) and and started by testing the following: balance -b 192.168.0.157 -f -d 3080 192.168.1.35:80 For the life of me, I couldn't get it to work. I tried to use -B and -M to no avail. It would always give me a timeout error. I tried different services as well, such as SSH instead of HTTP, but there was no change. On a different workstation, I ssh'd into the host (0.157, like above) and did the exact same command, parameters and all. This time it worked, with no timeout issues at all. I basically had two shells on the same server, one working with balance and the other not working. I chalked it up to something weird in the environment on the non-working shell (this is also the shell that built balance in the first place) and killed all my server sessions on that workstation. Upon re-logging into the host everything started working. In the working shell, I tested with and without the -B, -b and -M parameters. Everything looks solid.
Additional note: in the syslog, every time I load balance, I see this log line: Balance[17774]: setsockopt(IPV6_V6ONLY=0) failed