Overview
Comment: | +[OFSystemInfo networkInterfaces]: MAC on Illumos |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a3db7833d6a55f4907e8e740563127b6 |
User & Date: | js on 2023-07-23 16:46:19 |
Other Links: | manifest | tags |
Context
2023-07-23
| ||
23:35 | OFZIPArchive: Initial support for split archives check-in: 630ea6bc5a user: js tags: trunk | |
16:46 | +[OFSystemInfo networkInterfaces]: MAC on Illumos check-in: a3db7833d6 user: js tags: trunk | |
16:15 | +[OFSystemInfo networkInterfaces]: IPv6 on Illumos check-in: 368e45f471 user: js tags: trunk | |
Changes
Modified src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m from [8e74d9825e] to [7be216f5ab].
︙ | ︙ | |||
471 472 473 474 475 476 477 | # endif } #endif static bool queryNetworkInterfaceHardwareAddress(OFMutableDictionary *ret) { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | # endif } #endif static bool queryNetworkInterfaceHardwareAddress(OFMutableDictionary *ret) { #if defined(HAVE_IOCTL) && defined(HAVE_NET_IF_H) && defined(SIOCGLIFHWADDR) OFStringEncoding encoding = [OFLocale encoding]; int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) return false; for (OFString *name in ret) { size_t nameLength = [name cStringLengthWithEncoding: encoding]; struct lifreq lifr; struct sockaddr_dl *sdl; OFData *hardwareAddress; if (nameLength > IFNAMSIZ) continue; memset(&lifr, 0, sizeof(lifr)); memcpy(&lifr.lifr_name, [name cStringWithEncoding: encoding], nameLength); if (ioctl(sock, SIOCGLIFHWADDR, &lifr) < 0) continue; if (lifr.lifr_addr.ss_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)(void *)&lifr.lifr_addr; hardwareAddress = [OFData dataWithItems: LLADDR(sdl) count: sdl->sdl_alen]; [[ret objectForKey: name] setObject: hardwareAddress forKey: OFNetworkInterfaceHardwareAddress]; } return true; #elif defined(HAVE_IOCTL) && defined(HAVE_NET_IF_H) && \ defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) OFStringEncoding encoding = [OFLocale encoding]; int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) return false; for (OFString *name in ret) { |
︙ | ︙ |