Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use virtio-net-vpnkit #1

Open
juamedgod opened this issue Jan 24, 2017 · 0 comments
Open

Cannot use virtio-net-vpnkit #1

juamedgod opened this issue Jan 24, 2017 · 0 comments

Comments

@juamedgod
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant