OS/2 codes: How to get MAC address of network interfaces

MAC address is an 48-bits unique hardware address of a network adapter. OS/2 provides socket calls to retrive MAC address from network adapters.

First way is to use os2_ioctl( SIOSTATIF42 ). It returns the informations about all network interfaces available on a machine into struct ifmib.

struct ifmib is based on an index of a network interface. That is, it does not provides canonical name of a network interface such as lan0. You should mangle a canonical name from a description field and an index field. For details, see the following ODIN sources.


Second is ioctl( SIOCGIFCONF ). It returns the information about all network interfaces available on a machine into struct ifconf.

On TCP/IP v4.21 or later, struct ifconf may contain AF_LINK address storage. In this case, strcut ifconf contains a canonical name of a network interface, its index and its MAC address.

Here is the implementation to retrive MAC address of a network interface using ioctl( SIOCGIFCONF ).

댓글

이 블로그의 인기 게시물

토렌트: < 왕좌의 게임 > 시즌 1 ~ 시즌 8 완결편 마그넷

토렌트: NGC < 코스모스 > 우리말 더빙 전편(1편~13편) 마그넷

토렌트: < 스타워즈 > Ep.1 ~ Ep.6 마그넷