-
Notifications
You must be signed in to change notification settings - Fork 1
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
Failing test due to layer 3 device having all-zero MAC address #9
Comments
I added e9ca243 that addresses this, in one way or another. It removes If we encounter a loopback device in |
I'm curious if other "virtual" network interfaces such as docker networks show up with a Mac address of all zeros as well |
Interestingly, I got a MAC address from a Docker virtual network that was not all zeroes... I'm not sure why though; I don't know how docker manages it's virtual networks. |
* refactor!: remove is_loopback from MacAddress related: #9 * fix: inverted test 'get_first_no_loopback' was actually expecting the MAC address was a loopback (all zeroes). * chore: remove references to 'is_loopback' field chore: remove print message in linux if iterator * chore: remove unused struct * chore: update version
https://stackoverflow.com/questions/42946453/how-does-the-docker-assign-mac-addresses-to-containers Additionally, Docker's network interface is a bridge, whereas Tailscale's is a user-space TUN adapter:
Some additional info on the topic from the interwebs:
So it seems the answer to this is that network bridges (Docker) operate on Layer 2 - which is why they have MAC addresses - and Tailscale's TUN adapters operate on Layer 3. |
The
get_first_no_loopback
test looks like this:It calls the
getFirstNoLoopback
function to -- you guessed it -- get the first interface that is not a loopback device. What identifies a loopback device is theis_loopback
field in theMacAddress
struct (related: #8). However, I assumed that only a loopback interface would have a MAC address with all zeroes, but that's not the case.I use tailscale, which runs at layer 312. At this level, the
tailscale0
device cannot be assigned a MAC address. Therefore, thedata
field in theMacAddress
struct was all zeroes, which caused the test to fail.This has 2 implications:
is_loopback
field from theMacAddress
struct (again, see Removeis_loopback
field fromMacAddress
struct #8); otherwise, there will be no way to differentiate true loopback devices from devices on layer 3.An alternative to item 2 in the preceding list is to include the IP address in the
MacAddress
struct- that way127.0.0.1
can be the identifier for loopback devices.I'm not sure what I want to do here. I still want to have loopback device identification but I do not want to encode more information than necessary in the
MacAddress
struct -- I think even theis_loopback
field is too much. I want to keep the scope of this library relatively narrow.Footnotes
https://www.reddit.com/r/Tailscale/comments/v2renw/linux_mac_address_for_interface/ ↩
https://en.wikipedia.org/wiki/OSI_model#Layer_architecture ↩
The text was updated successfully, but these errors were encountered: