dvtirol / pynetinstall

Module to perform Mikrotik Routerboard Netinstall via Etherboot
GNU General Public License v3.0
67 stars 9 forks source link

Can't bind to interface on OSX #10

Closed ilium007 closed 4 days ago

ilium007 commented 6 days ago

Getting error:

sudo python -m pynetinstall -c ./pynetinstall.ini -i en5 -v
usage: pynetinstall [-h] [-c CONFIG] [-i INTERFACE] [-l LOGGING] [-v] [-1]

pynetinstall: error: [Errno 6] Device not configured (en5)
ilium007 commented 6 days ago

Interface exists:

en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=6464<VLAN_MTU,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
    ether 5c:85:7e:39:c5:c1
    inet6 fe80::cd:f5df:ff89:91b9%en5 prefixlen 64 secured scopeid 0x19
    inet 192.168.88.254 netmask 0xffffff00 broadcast 192.168.88.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (1000baseT <full-duplex>)
    status: active
uedvt359 commented 4 days ago

it seems, osx does not support the SIOCGIFHWADDR ioctl. we use that to find the mac address of the specified interface here: https://github.com/dvtirol/pynetinstall/blob/1e37d9e30b5343b091ac24a9d3f5e39bcc8ef95c/pynetinstall/network.py#L82-L84

if you know of a way to do this for non-linux machines, please submit a patch (probably the BSDs also use mechanism similar/same to osx). as a quick fix you could hard-code the mac address in the source (note that it is stored not as a hex-ascii string but as the raw binary bytes).