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

Add option to print MAC address and exit #79

Merged
merged 1 commit into from Dec 27, 2015

Conversation

dalehamel
Copy link
Member

As the name suggests, this adds the -M command line flag that will tell Xhyve to print the MAC address and exit if using vmnet.

This only really has practical use if the -U flag is also supplied with a UUID, so that you can determine which MAC address the UUID will map to. This will allow you to determine the IP address of the guest by inspecting the DHCP leases on the host. The idea being you run xhyve first with the -M flag to figure out ahead of time the MAC and IP address it will get, and then run it for real without the -M flag.

A similar pattern is used by docker-machine-xhyve, and the nearly identical xhyve-ruby native extension that each take the approach of spinning up a network interface just to find out what it's MAC address will be.

The side effect of doing this outside of Xhyve is that the binary performing the lookup has the same 'sudo' problem as outlined in #60. So, if Xhyve were signed or xhyve had SetUID, it can more securely perform the lookup.

I tried to follow the existing style and idioms, and I'm open to any command line flag (-M seemed somewhat sensible). If there is another simpler or better way to achieve this, I'm open to it.

@mist64 for review

@AntonioMeireles
Copy link
Member

@dalehamel great work! 👍

AntonioMeireles pushed a commit to AntonioMeireles/xhyve that referenced this pull request Dec 23, 2015
- picked from machyve#79 and rebased

Signed-off-by: António Meireles <antonio.meireles@reformi.st>
mist64 added a commit that referenced this pull request Dec 27, 2015
Add option to print MAC address and exit
@mist64 mist64 merged commit 18d01d2 into machyve:master Dec 27, 2015
johanneswuerbach added a commit to johanneswuerbach/docker-machine-xhyve that referenced this pull request Dec 29, 2015
machyve/xhyve#79 allows to fetch the mac address
using xhyve instead of using vmnet directly
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

Successfully merging this pull request may close these issues.

None yet

3 participants