Fix media_type detection on NetBSD

On NetBSD 7.0.1, ifconfig return this:
    $ ifconfig
    ne0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            ec_capabilities=1<VLAN_MTU>
            ec_enabled=0
            address: 00:20:91:45:00:78
            media: Ethernet 10baseT full-duplex
            inet 192.168.156.29 netmask 0xffffff00 broadcast 192.168.156.255

Which result into setup returning this:
    "media_type": "ull-duplex",

So we have to specialise that method, since FreeBSD ifconfig return
something like this:

    ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
        ether 00:20:91:a7:48:45
        inet 192.168.156.11 netmask 0xffffff00 broadcast 192.168.156.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
pull/18387/merge
Michael Scherer 8 years ago committed by Brian Coca
parent d393409fed
commit bc6c1afb1e

@ -2953,6 +2953,22 @@ class NetBSDNetwork(GenericBsdIfconfigNetwork):
"""
platform = 'NetBSD'
def parse_media_line(self, words, current_if, ips):
# example of line:
# $ ifconfig
# ne0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
# ec_capabilities=1<VLAN_MTU>
# ec_enabled=0
# address: 00:20:91:45:00:78
# media: Ethernet 10baseT full-duplex
# inet 192.168.156.29 netmask 0xffffff00 broadcast 192.168.156.255
current_if['media'] = words[1]
if len(words) > 2:
current_if['media_type'] = words[2]
if len(words) > 3:
current_if['media_options'] = words[3].split(',')
class SunOSNetwork(GenericBsdIfconfigNetwork):
"""
This is the SunOS Network Class.

Loading…
Cancel
Save