glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

MAC Address not displayed on screen for Apple computers #673

Closed Pigeo closed 1 month ago

Pigeo commented 1 month ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

In the Network ports section of a computer, the details shown on screen by networkport.form.php correctly display the MAC Addresses for PC computers (regardless of the manufacturer's brand), but not for Apple computers.

(however if you use the REST API, you can successfully retrieve the MAC adresses of Apple computers' network ports, proving that they are effectively stored in GLPI's database, but simply just not displayed on screen)

To reproduce

Install GLPI Agent on any Mac and try to find its network ports' MAC adresses from GLPI's web console.

Expected behavior

It should be possible to get the MAC addresses of every network ports of any Apple computer, right directly from GLPI's web console.

Operating system

MacOSX

GLPI Agent version

1.7.1

GLPI version

10.0.12

GLPIInventory plugin or other plugin version

GLPI Inventory v1.3.4

Additional context

Hint: could this be due to the GLPI Agent not specifying the instantiation_type of the network interface? (I see in the REST API that, for PC computers it's either "instantiation_type": "NetworkPortWifi" or "instantiation_type": "NetworkPortEthernet", but for Apple computers it's always "instantiation_type": null…)

g-bougard commented 1 month ago

Hi @Pigeo

you are indeed right. Maybe this is not correct to not display mac address even if it is set and port type is not known.

But I'm still preparing a fix to detect type as actually expected by glpi.

To be sure to not miss your cases, can you share the output of following command ?

/sbin/ifconfig -a
networksetup -listallhardwareports
AldarisPale commented 1 month ago

Not original poster, but here's mine (mac addresses obfuscated, but matching respectively between ifconfig and networksetup). Please note that I have Lenovo dock attached. Macbook M1 Pro, 2021. MacOS Sonoma 14.5

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
     options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
     inet 127.0.0.1 netmask 0xff000000
     inet6 ::1 prefixlen 128
     inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
     nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
anpi2: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:AA
     media: none
     status: inactive
anpi1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:AB
     media: none
     status: inactive
anpi0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:AC
     media: none
     status: inactive
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:AD
     nd6 options=201<PERFORMNUD,DAD>
     media: none
     status: inactive
en6: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:BA
     nd6 options=201<PERFORMNUD,DAD>
     media: none
     status: inactive
en7: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:BB
     nd6 options=201<PERFORMNUD,DAD>
     media: none
     status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST>
mtu 1500
     options=460<TSO4,TSO6,CHANNEL_IO>
     ether AA:AA:AA:AA:AA:BC
     media: autoselect <full-duplex>
     status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST>
mtu 1500
     options=460<TSO4,TSO6,CHANNEL_IO>
     ether AA:AA:AA:AA:AA:BD
     media: autoselect <full-duplex>
     status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST>
mtu 1500
     options=460<TSO4,TSO6,CHANNEL_IO>
     ether AA:AA:AA:AA:AA:CA
     media: autoselect <full-duplex>
     status: inactive
ap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
     ether AA:AA:AA:AA:AA:CB
     inet6 fe80::a:b:c:d%ap1 prefixlen 64 scopeid 0xe
     nd6 options=201<PERFORMNUD,DAD>
     media: autoselect (<unknown type>)
     status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
     ether AA:AA:AA:AA:AA:CC
     inet6 fe80::b:c:d:a%en0 prefixlen 64 secured scopeid 0xf
     inet BB.CC.DD.AA netmask 0xfffffe00 broadcast AA.BB.CC.DD
     nd6 options=201<PERFORMNUD,DAD>
     media: autoselect
     status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=63<RXCSUM,TXCSUM,TSO4,TSO6>
     ether AA:AA:AA:AA:AA:BC
     Configuration:
         id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
         maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
         root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
         ipfilter disabled flags 0x0
     member: en1 flags=3<LEARNING,DISCOVER>
             ifmaxaddr 0 port 10 priority 0 path cost 0
     member: en2 flags=3<LEARNING,DISCOVER>
             ifmaxaddr 0 port 11 priority 0 path cost 0
     member: en3 flags=3<LEARNING,DISCOVER>
             ifmaxaddr 0 port 12 priority 0 path cost 0
     nd6 options=201<PERFORMNUD,DAD>
     media: <unknown type>
     status: inactive
awdl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
     ether AA:AA:AA:AA:AA:CD
     inet6 fe80::a1:b1:c1:d2%awdl0 prefixlen 64 scopeid 0x11
     nd6 options=201<PERFORMNUD,DAD>
     media: autoselect
     status: active
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     options=400<CHANNEL_IO>
     ether AA:AA:AA:AA:AA:CD
     inet6 fe80::a2:b2:c2:d2%llw0 prefixlen 64 scopeid 0x12
     nd6 options=201<PERFORMNUD,DAD>
     media: autoselect
     status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
     inet6 fe80::a3:b3:c3:d4%utun0 prefixlen 64 scopeid 0x13
     nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
     inet6 fe80::a4:b4:c4:d4%utun1 prefixlen 64 scopeid 0x14
     nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
     inet6 fe80::a5:b5:c5:d5%utun2 prefixlen 64 scopeid 0x15
     nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
     inet6 fe80::a6:b6:c6:d6%utun3 prefixlen 64 scopeid 0x16
     nd6 options=201<PERFORMNUD,DAD>
en8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=6464<VLAN_MTU,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
     ether AA:AA:AA:AA:AA:DA
     nd6 options=201<PERFORMNUD,DAD>
     media: autoselect (none)
     status: inactive

Hardware Port: Ethernet Adapter (en5)
Device: en5
Ethernet Address: AA:AA:AA:AA:AA:AD

Hardware Port: ThinkPad Lan
Device: en8
Ethernet Address: AA:AA:AA:AA:AA:DA

Hardware Port: Ethernet Adapter (en6)
Device: en6
Ethernet Address: AA:AA:AA:AA:AA:BA

Hardware Port: Ethernet Adapter (en7)
Device: en7
Ethernet Address: AA:AA:AA:AA:AA:BB

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: AA:AA:AA:AA:AA:BC

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: AA:AA:AA:AA:AA:CC

Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: AA:AA:AA:AA:AA:BC

Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: AA:AA:AA:AA:AA:BD

Hardware Port: Thunderbolt 3
Device: en3
Ethernet Address: AA:AA:AA:AA:AA:CA

VLAN Configurations
===================
Pigeo commented 1 month ago

Hi @g-bougard, thank you for your responsive feedback! I agree with you that glpi should always display the MAC address (as long as there's one), even if the port type is unknown, but that's another story…

Here is the output from a MacBook Pro 16" Intel (2019) running Catalina (NB: MAC and IP addresses have been tampered for security reasons) :

> /sbin/ifconfig -a

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether ac:00:48:00:11:00 
    inet6 fe80::0000:00ff:ffff:0000%en5 prefixlen 64 scopeid 0x4 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (100baseTX <full-duplex>)
    status: active
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:00:1c:a5:00:00 
    media: autoselect <full-duplex>
    status: inactive
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:00:1c:a5:00:01 
    media: autoselect <full-duplex>
    status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:00:1c:a5:00:02 
    media: autoselect <full-duplex>
    status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:00:1c:a5:00:03 
    media: autoselect <full-duplex>
    status: inactive
ap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 56:00:ec:9f:00:02 
    media: autoselect
    status: active
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether f8:00:c2:05:00:01 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (<unknown type>)
    status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
    options=400<CHANNEL_IO>
    ether 0a:00:c2:05:00:03 
    media: autoselect
    status: inactive
awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    options=400<CHANNEL_IO>
    ether 92:00:06:db:00:01 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: inactive
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 92:00:06:db:00:02 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 82:00:1c:a5:00:03
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x0
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 7 priority 0 path cost 0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 8 priority 0 path cost 0
    member: en3 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 5 priority 0 path cost 0
    member: en4 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 6 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unknown type>
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::0000:ffff:1111:0000%utun0 prefixlen 64 scopeid 0x11 
    nd6 options=201<PERFORMNUD,DAD>
vnic0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 00:00:99:00:00:01 
    inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
    media: autoselect
    status: active
vnic1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 00:00:99:00:00:02 
    inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
    media: autoselect
    status: active
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::0000:ffff:1111:0000%utun1 prefixlen 64 scopeid 0x14 
    nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::0000:ffff:1111:0001%utun2 prefixlen 64 scopeid 0x1a 
    nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::0000:ffff:2222:0002%utun3 prefixlen 64 scopeid 0x1b 
    nd6 options=201<PERFORMNUD,DAD>
en37: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether d6:00:da:5b:00:05 
    media: autoselect <full-duplex>
    status: inactive
en40: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether d6:00:da:5b:00:06 
    inet6 fe80::0000:ffff:1111:0000%en40 prefixlen 64 secured scopeid 0x18 
    inet 169.254.176.43 netmask 0xffff0000 broadcast 169.254.255.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en41: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether f2:00:4a:fa:00:06 
    inet6 fe80::0000:ffff:1111:0004%en41 prefixlen 64 secured scopeid 0x19 
    inet 169.254.231.178 netmask 0xffff0000 broadcast 169.254.255.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en35: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=6407<RXCSUM,TXCSUM,VLAN_MTU,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
    ether 98:00:43:0f:00:03 
    inet6 fe80::0000:ffff:0000:0003%en35 prefixlen 64 secured scopeid 0x15 
    inet 192.168.0.205 netmask 0xffffff00 broadcast 192.168.0.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (1000baseT <full-duplex>)
    status: active
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether fa:00:c2:50:00:02 
    inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
    inet6 fe80::0000:ffff:0000:0001%bridge100 prefixlen 64 secured scopeid 0x16 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x0
    member: ap1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 9 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
utun4: flags=80d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1390
    inet 10.75.129.190 --> 10.75.129.190 netmask 0xffffff00 
    inet6 fe80::0000:00ff:ffff:0000%utun4 prefixlen 64 scopeid 0x1c 
    inet6 fe80::1111:2222:eeee:0000%utun4 prefixlen 128 scopeid 0x1c 
    nd6 options=201<PERFORMNUD,DAD>

and

> networksetup -listallhardwareports

Hardware Port: USB 10/100/1000 LAN
Device: en35
Ethernet Address: 98:00:43:0f:00:03

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: f8:00:c2:05:00:01

Hardware Port: iPhone USB
Device: en37
Ethernet Address: d6:00:da:5b:00:05

Hardware Port: Bluetooth PAN
Device: en6
Ethernet Address: f8:00:c2:17:00:06

Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: 82:00:1c:a5:00:02

Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: 82:00:1c:a5:00:03

Hardware Port: Thunderbolt 3
Device: en3
Ethernet Address: 82:00:1c:a5:00:00

Hardware Port: Thunderbolt 4
Device: en4
Ethernet Address: 82:00:1c:a5:00:01 

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: 82:00:1c:a5:00:03

VLAN Configurations
===================

Some explanations:

Note that renaming the network connection (in macOS System Preferences > Network > "rename the service") does not change the name that is displayed in the above outputs (I had renamed my docking station's RJ45 interface to "WD19" but it still displays it as "USB 10/100/1000 LAN" / "en35" in networksetup -listallhardwareports).

AldarisPale commented 1 month ago

I suspect it might be related to https://github.com/glpi-project/glpi-inventory-plugin/issues/380 as we're currently on 10.x branch and when new computers are being added, the MAC address is not just being shown.

The symptom is that while on computer page -> network ports, then mac address is being shown, but when one opens a port there's no field named "MAC". This is a case where the computers being added are in fact Windows computers, and using fusioninventory agent (we are trying to migrate to glpi-agent, but agent 1.8 is giving us trouble https://github.com/glpi-project/glpi-agent/issues/670 so waiting for 1.9 to be released currently)

Pigeo commented 1 month ago

Another output, from a MacBook Pro 16" Apple Silicon (Nov 2023), running Sonoma 14.4 :

> /sbin/ifconfig -a

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
anpi1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:00:06:96:00:0c
    media: none
    status: inactive
anpi0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:00:06:96:00:0b
    media: none
    status: inactive
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:00:06:96:00:70
    nd6 options=201<PERFORMNUD,DAD>
    media: none
    status: inactive
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:00:06:96:00:71
    nd6 options=201<PERFORMNUD,DAD>
    media: none
    status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 36:00:07:a1:00:00
    media: autoselect <full-duplex>
    status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 36:00:07:a1:00:04
    media: autoselect <full-duplex>
    status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 36:00:07:a1:00:08
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 36:00:07:a1:00:00
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x0
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 8 priority 0 path cost 0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 9 priority 0 path cost 0
    member: en3 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 10 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unknown type>
    status: inactive
ap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
    ether 62:00:0f:57:00:44
    inet6 fe80::0000:5555:7777:4444%ap1 prefixlen 64 scopeid 0xc 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (<unknown type>)
    status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
    ether 60:00:50:57:00:44
    inet6 fe80::4444:3333:0000:5555%en0 prefixlen 64 secured scopeid 0xd 
    inet 192.168.2.46 netmask 0xffffff00 broadcast 192.168.2.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
awdl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
    ether 1a:00:08:c2:00:80
    inet6 fe80::8888:ffff:2222:aeae%awdl0 prefixlen 64 scopeid 0xe 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 1a:00:08:c2:00:80
    inet6 fe80::8888:ffff:2222:aeae%llw0 prefixlen 64 scopeid 0xf 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
    inet6 fe80::6666:3333:2121:1010%utun0 prefixlen 64 scopeid 0x10 
    nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::3434:dada:0000:0000%utun1 prefixlen 64 scopeid 0x11 
    nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::cdcd:0000:8888:6666%utun2 prefixlen 64 scopeid 0x12 
    nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
    inet6 fe80::cece:bbbb:cccc:0000%utun3 prefixlen 64 scopeid 0x13 
    nd6 options=201<PERFORMNUD,DAD>

and

> networksetup -listallhardwareports

Hardware Port: Ethernet Adapter (en4)
Device: en4
Ethernet Address: 9e:00:06:96:00:70

Hardware Port: Ethernet Adapter (en5)
Device: en5
Ethernet Address: 9e:00:06:96:00:71

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: 36:00:07:a1:00:00

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 60:00:50:57:00:44

Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: 36:00:07:a1:00:00

Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: 36:00:07:a1:00:04

Hardware Port: Thunderbolt 3
Device: en3
Ethernet Address: 36:00:07:a1:00:08

VLAN Configurations
===================

Notes:

Pigeo commented 1 month ago

iMac 27" Intel (Retina 5K, 2019) running Mojave 10.14.6:

> /sbin/ifconfig -a

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
XHC20: flags=0<> mtu 0
XHC0: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
    ether 3c:36:00:60:88:11 
    inet6 fe80::8844:fade:b431:000a%en0 prefixlen 64 secured scopeid 0x6 
    inet 10.71.127.11 netmask 0xffffe000 broadcast 10.71.127.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (1000baseT <full-duplex,flow-control>)
    status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether aa:00:44:c1:dd:e0 
    media: autoselect <full-duplex>
    status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether aa:00:44:c1:dd:e1 
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether aa:00:44:c1:dd:e0 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 7 priority 0 path cost 0
    member: en3 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 8 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unknown type>
    status: inactive
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
    ether fa:cc:f2:56:77:6b 
    media: autoselect
    status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether f8:cc:f2:56:77:6b 
    inet6 fe80::1000:6100:00ea:0000%en1 prefixlen 64 secured scopeid 0xb 
    inet 192.168.1.107 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0a:cc:f2:56:77:6b 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    ether 86:33:72:94:77:aa 
    inet6 fe80::8484:00ff:fe00:00ca%awdl0 prefixlen 64 scopeid 0xd 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::0000:5555:cd42:000a%utun0 prefixlen 64 scopeid 0xe 
    nd6 options=201<PERFORMNUD,DAD>

and

> networksetup -listallhardwareports

Hardware Port: Ethernet
Device: en0
Ethernet Address: 3c:36:00:60:88:11

Hardware Port: Wi-Fi
Device: en1
Ethernet Address: f8:cc:f2:56:77:6b

Hardware Port: Bluetooth PAN
Device: en4
Ethernet Address: f8:cc:f2:59:8f:f6

Hardware Port: Thunderbolt 1
Device: en2
Ethernet Address: aa:00:44:c1:dd:e0

Hardware Port: Thunderbolt 2
Device: en3
Ethernet Address: aa:00:44:c1:dd:e1

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: aa:00:44:c1:dd:e0

VLAN Configurations
===================

Notes:

g-bougard commented 1 month ago

Thank you all, this should help me to cover most cases for port type detection.

g-bougard commented 1 month ago

Hi @Pigeo & @AldarisPale

please, can you try next nightly build and tell if the result is as expected in GLPI ?

Pigeo commented 1 month ago

Hi @g-bougard, I confirm the fix is working with the nightly build. Thank you very much!