-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
Describe the bug
If there are no routes on the system, the getmac.get_mac_address() returns None even if there are network interfaces.
This can happen e.g. in testing environments such as virtual machines and or inside Linux network namespaces, but in general in systems not connected to larger networks.
To Reproduce
Tested on Ubuntu 20.04LTS (under root)
$ ip netns add getmac-test
$ ip netns exec getmac-test ip link set dev lo up
$ ip netns exec getmac-test python
>>> import getmac
>>> getmac.get_mac_address() is None
True
>>> exit()
$ ip netns exec getmac-test ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00Expected behavior
A mac address is returned even without routes set.
System info
(please complete the following information):
- OS name: Ubuntu 20.04LTS
- Python version: 3.8.10
Additional context
none
Reactions are currently unavailable