From 229c1c50bea1a2ebb2c2bfaec17f6ae481fdac1b Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 3 Dec 2013 10:20:44 -0500 Subject: [PATCH] android: Fix the get_mac_address() function on Android. For some reason we cannot link against the ether_ntoa function. --- client/mac_address.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/mac_address.cpp b/client/mac_address.cpp index f7e6b59b9c..815b4b7690 100644 --- a/client/mac_address.cpp +++ b/client/mac_address.cpp @@ -261,9 +261,18 @@ int get_mac_address(char* address) { close(sck); return -1; } - hw_addr=(struct ether_addr *)&(item->lifr_lifru.lifru_enaddr); + hw_addr = (struct ether_addr *)&(item->lifr_lifru.lifru_enaddr); #endif +#ifdef _ANDROID + snprintf( + address, 18, "%02x:%02x:%02x:%02x:%02x:%02x", + hw_addr->ether_addr_octet[0], hw_addr->ether_addr_octet[1], + hw_addr->ether_addr_octet[2], hw_addr->ether_addr_octet[3], + hw_addr->ether_addr_octet[4], hw_addr->ether_addr_octet[5] + ); +#else strcpy(address, ether_ntoa(hw_addr)); +#endif if (strstr(item->ifr_ifrn.ifrn_name, "eth")) break; } close(sck);