Closed hxw closed 2 years ago
What's the assertion you are getting? It should be probably hitting errno_assert() after a failing setsockopt() call.
errno_assert (rc == 0);
Enabling ZMQ_HAVE_OPENBSD just bypass it all over.
This is the abort message when I use the pkg (i.e. brefore I enabled the OpenBSD flag)
Operation not supported (src/ip.cpp:141)
SIGABRT: abort
PC=0x801281c7c m=9 sigcode=0
```
Here is the result of a simple test program that I tried to replicate the situation to remiove the possibility of Go runtime being involved. The test is ok on FreeBSD but fais on DraginFly.
FreeBSD:
2: socket fd: 3 rc: -1 errno: 22
28: socket fd: 3 rc: 0 errno: 0
DragonFly
2: socket fd: 3 rc: -1 errno: 22
28: socket fd: 3 rc: -1 errno: 45
% grep 45 /usr/include/errno.h
#define EOPNOTSUPP 45 /* Operation not supported */
This is the test
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#define SizeOfArray(a) (sizeof(a) / sizeof((a)[0]))
const int dom[] = {
AF_INET,
AF_INET6,
};
int main(int argc, char *argv[]) {
for (size_t i = 0; i < SizeOfArray(dom); ++i) {
int d = dom[i];
const int s = socket(d, SOCK_STREAM, 0);
printf("%3d: socket fd: %2d ", d, s);
int flag = 0;
errno = 0;
int rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag));
printf("rc: %3d errno: %d\n", rc, errno);
close(s);
}
return 1;
}
The fix in https://github.com/DragonFlyBSD/DeltaPorts/commit/2b99cb7d0634d5dc77ed6e45f68dce14bcf603c6 should do the trick too, can you please check and report back?
yes, this can work. Do you want me to file upstream bug with libzmq for this?
Yeah, it could be upstreamed I guess.
When using IPv6 socket with libzmq4 an assert is triggered in
ip.cpp
function:It is trying to perform the following:
Update the patch to configure to add the OpenBSD flag which appear to allow the code to run
libzmq.diff.txt