| | |
| | | // if_name_position = ifname_position(ifnames, ifa->ifa_name, if_num); |
| | | // interface name not seen en advance |
| | | OsAdapterInfo *currentAdapter; |
| | | // FIXME not working |
| | | if (adapterByName.find(if_name) == adapterByName.end()) { |
| | | OsAdapterInfo newAdapter; |
| | | memset(&newAdapter, 0, sizeof(OsAdapterInfo)); |
| | | strncpy(&newAdapter.description[0], ifa->ifa_name, LCC_ADAPTER_DESCRIPTION_LEN); |
| | | mstrlcpy(&newAdapter.description[0], ifa->ifa_name, LCC_ADAPTER_DESCRIPTION_LEN); |
| | | adapterByName[if_name] = newAdapter; |
| | | } |
| | | auto it = adapterByName.find(if_name); |
| | |
| | | family = ifa->ifa_addr->sa_family; |
| | | /* Display interface name and family (including symbolic |
| | | form of the latter for the common families) */ |
| | | #ifdef _DEBUG |
| | | #ifndef NDEBUG |
| | | printf("%-8s %s (%d)\n", ifa->ifa_name, |
| | | (family == AF_PACKET) ? "AF_PACKET" |
| | | : (family == AF_INET) ? "AF_INET" : (family == AF_INET6) ? "AF_INET6" : "???", |
| | |
| | | int i; |
| | | for (i = 0; i < 6; i++) { |
| | | currentAdapter->mac_address[i] = s1->sll_addr[i]; |
| | | #ifdef _DEBUG |
| | | #ifndef NDEBUG |
| | | printf("%02x:", s1->sll_addr[i]); |
| | | #endif |
| | | } |
| | | #ifdef _DEBUG |
| | | #ifndef NDEBUG |
| | | printf("\t %s\n", ifa->ifa_name); |
| | | #endif |
| | | } |