Skip to content

Cannot use virtio-net-vpnkit #1

Description

@juamedgod

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions