diff options
author | Raimo Niskanen <[email protected]> | 2011-11-25 11:39:10 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2011-11-29 09:41:37 +0100 |
commit | cc6a54d8f4467083fd2b450764a7178918667e96 (patch) | |
tree | 80b0cd727f2679e5c26a9cd60d3b3e72ce9c90b5 /erts/emulator/drivers/common/inet_drv.c | |
parent | 5643ef4f4203734cdc4f6c7fe9898d288d721fb8 (diff) | |
download | otp-cc6a54d8f4467083fd2b450764a7178918667e96.tar.gz otp-cc6a54d8f4467083fd2b450764a7178918667e96.tar.bz2 otp-cc6a54d8f4467083fd2b450764a7178918667e96.zip |
Cleanup - remove unnecesary bracket level and configure for ifreq.ifr_enaddr
Diffstat (limited to 'erts/emulator/drivers/common/inet_drv.c')
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 9dbe66170d..27868b0f73 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -4283,24 +4283,22 @@ static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len, case INET_IFOPT_HWADDR: { #ifdef HAVE_LIBDLPI_H - { - /* - ** OpenSolaris have SIGCGIFHWADDR, but no ifr_hwaddr member.. - ** The proper way to get the mac address would be to - ** use libdlpi... - */ - uchar_t addr[DLPI_PHYSADDR_MAX]; - size_t alen = sizeof(addr); - - if (hwaddr_libdlpi_lookup(ifreq.ifr_name, addr, &alen) == 0) { - buf_check(sptr, s_end, 1+2+alen); - *sptr++ = INET_IFOPT_HWADDR; - put_int16(alen, sptr); + /* + ** OpenSolaris have SIGCGIFHWADDR, but no ifr_hwaddr member.. + ** The proper way to get the mac address would be to + ** use libdlpi... + */ + uchar_t addr[DLPI_PHYSADDR_MAX]; + size_t alen = sizeof(addr); + + if (hwaddr_libdlpi_lookup(ifreq.ifr_name, addr, &alen) == 0) { + buf_check(sptr, s_end, 1+2+alen); + *sptr++ = INET_IFOPT_HWADDR; + put_int16(alen, sptr); sptr += 2; sys_memcpy(sptr, addr, alen); sptr += alen; - } - } + } #elif defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) if (ioctl(desc->s, SIOCGIFHWADDR, (char *)&ifreq) < 0) break; @@ -4310,7 +4308,7 @@ static int inet_ctl_ifget(inet_descriptor* desc, char* buf, int len, /* raw memcpy (fix include autoconf later) */ sys_memcpy(sptr, (char*)(&ifreq.ifr_hwaddr.sa_data), IFHWADDRLEN); sptr += IFHWADDRLEN; -#elif defined(SIOCGENADDR) +#elif defined(SIOCGENADDR) && defined(HAVE_STRUCT_IFREQ_IFR_ENADDR) if (ioctl(desc->s, SIOCGENADDR, (char *)&ifreq) < 0) break; buf_check(sptr, s_end, 1+2+sizeof(ifreq.ifr_enaddr)); |