-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
When trying to use virtio-net-vpnkit, you receive the error:
Assertion failed: (sizeof("VERSION_SHA1") == sizeof(init_msg.commit) + 1), function vpnkit_connect, file /private/tmp/docker-machine-driver-xhyve-20161208-25683-18fih1b/gopath/src/github.com/zchee/docker-machine-driver-xhyve/vendor/github.com/zchee/libhyperkit/pci_virtio_net_vpnkit.c, line 303.
Looking at the mentioned line you find the offending code:
/* msg.commit is not NULL terminated */
assert(sizeof("VERSION_SHA1") == sizeof(init_msg.commit) + 1);
memcpy(&init_msg.commit, "VERSION_SHA1", sizeof(init_msg.commit));
VERSION_SHA1 should be unqouted and pointed to an actual commit sha1, so the sizeof assert validates.
The VERSION_SHA1 value is even being defined in xhyve.go but as go drops quotes when passing the option to the compiler (BUG), the C code breaks because VERSION_SHA1 does not resolve to a string, but to a weird identifier:
assert(sizeof(2db2b2c60799918dafb3d95368e935c3f620911d) == sizeof(init_msg.commit) + 1);
Instead of the expected:
assert(sizeof("2db2b2c60799918dafb3d95368e935c3f620911d") == sizeof(init_msg.commit) + 1);
In docker/hyperkit, that value gets passed from the Makefile but we do not have one available here to workaround the Go bug. Maybe one solution would be to hardcode it in pci_virtio_net_vpnkit.c (or even better, an include file somewhere else) while still allowing customization:
#ifndef VERSION_SHA1
#define VERSION_SHA1 "2db2b2c60799918dafb3d95368e935c3f620911d"
#endif