rootless-containers / slirp4netns

User-mode networking for unprivileged network namespaces
GNU General Public License v2.0
729 stars 82 forks source link

Add the --macaddress option to specify the MAC address of the tap interface. #254

Closed bkoehm closed 3 years ago

bkoehm commented 3 years ago

Signed-off-by: Brian Koehmstedt bkoehm@gmail.com

bkoehm commented 3 years ago

@AkihiroSuda I've completed the changes you've requested. I moved the lone remaining function from hwaddr.c to main.c such that hwaddr.c and hwaddr.h are no longer needed and have been removed. I also did a force push to my branch so as to maintain only one rebased commit for this pull because I'm making the assumption you want only one commit for this instead of a bunch if the pull is merged.

AkihiroSuda commented 3 years ago

Thanks, the design looks good but CI is failing

bkoehm commented 3 years ago

@AkihiroSuda I can't tell from the github logs why it's failing in the cloud (it passes locally for me). All I see are things like this at the end of the log:

FAIL tests/test-slirp4netns-seccomp.sh (exit status: 1)
Error: Process completed with exit code 2.
AkihiroSuda commented 3 years ago

I see several "cannot set MAC address: Invalid argument" lines in https://github.com/rootless-containers/slirp4netns/pull/254/checks?check_run_id=1922683592

bkoehm commented 3 years ago

Thank you, that was helpful to point that out and got me thinking it was a memory initialization issue since the failures happened before the macaddress test even ran. Sure enough, I forgot to initialize vmacaddress_len. I added a single line to main.c, "cfg->vmacaddress_len = 0;", did a force push and now the tests seem to pass. Normally I would use valgrind to try and catch things like this but slirp4netns seems to make valgrind crash on my system at the point where setns() is called.