mbuffer and network support

I am trying to use mbuffer (from ports) to send/receive over the network like this

receiver :
mbuffer -I 8000 -o /dev/null

sender :
mbuffer -i /dev/zero -O 192.168.137.117:8000


the sender always fails:
Code:
bruno@proliant6:~ $ mbuffer -i /dev/zero -O 192.168.137.117:8000
mbuffer: warning: error connecting to tcp/117.137.168.192:8000: Connection refused
mbuffer: error: unable to connect to 192.168.137.117:8000
mbuffer: fatal: no output left - nothing to do
I can nmap the receiver and it shows the port is closed
I can run this on the local ip 127.0.0.1, same error
Code:
mbuffer -V
mbuffer version R20240107
the error seems suspicious, why the inverted bytes in the IP address ?
There is no firewall on this machine.
If I use netcat on the same ports, it works.

Am doing something wrong, or is there a bug in mbuffer ? anyone uses it that way, or can test ?
 
you misunderstood me
If I use netcat piped into mbuffer, my transfers work.

If I use mbuffer's network feature on its own, no netcat, it does not work and I can not even nmap the port mbuffer is supposedly listening on.

I am trying to avoid using a pipe of netcat | mbuffer | zfs receive, by just using mbuffer | zfs receive, using mbuffer's use of network ports instead of stdio.
 
It's possible it's a bug in mbuffer itself, I mean the reversed IP address is pretty weird too. Looks like they've somehow mixed up network byte order and host byte order.
 
I'm not much of a programmer but this seems pretty silly when they simply could have used inet_ntoa(3):
Code:
	if (ai->ai_family == AF_INET) {
		if (ai->ai_addrlen == sizeof(struct sockaddr_in)) {
			struct sockaddr_in *a = (struct sockaddr_in *) ai->ai_addr;
			at += sprintf(at,"%u.%u.%u.%u:%hu"
					, (a->sin_addr.s_addr >> 24) & 0xff
					, (a->sin_addr.s_addr >> 16) & 0xff
					, (a->sin_addr.s_addr >> 8) & 0xff
					, (a->sin_addr.s_addr) & 0xff
					, ntohs(a->sin_port));
		} else {
			strcpy(at,"<ipv4 with unexpected addrlen>");
		}
 
IIRC the network socket feature of mbuffer was always broken (at least on FreeBSD?). I've been using mbuffer in zfs replication scripts for many years and always used netcat for the networking part because I also never got mbuffer working with network sockets...


I mostly removed it from my backup scripts nowadays, because there's no real benefit anymore with flash-based pools.
 
Back
Top