diff options
Diffstat (limited to 'libtransport/includes/hicn/transport/utils/linux.h')
-rw-r--r-- | libtransport/includes/hicn/transport/utils/linux.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libtransport/includes/hicn/transport/utils/linux.h b/libtransport/includes/hicn/transport/utils/linux.h index 5820528e1..14ef179ac 100644 --- a/libtransport/includes/hicn/transport/utils/linux.h +++ b/libtransport/includes/hicn/transport/utils/linux.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -17,14 +17,13 @@ #ifdef __linux__ -#include <hicn/transport/portability/portability.h> -#include <hicn/transport/utils/log.h> - #include <arpa/inet.h> +#include <hicn/transport/portability/portability.h> #include <ifaddrs.h> #include <netdb.h> #include <stdio.h> #include <sys/socket.h> + #include <string> #define LINK_LOCAL_PREFIX 0xfe80 @@ -45,11 +44,10 @@ static TRANSPORT_ALWAYS_INLINE int retrieveInterfaceAddress( uint16_t prefix = 0; memcpy(&prefix, tmp->sin6_addr.s6_addr, sizeof(uint16_t)); - if (htons(LINK_LOCAL_PREFIX) != prefix) { + if (portability::host_to_net(LINK_LOCAL_PREFIX) != prefix) { *address = *(struct sockaddr_in6 *)ifa->ifa_addr; getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), addr, sizeof(addr), NULL, 0, NI_NUMERICHOST); - TRANSPORT_LOGI("Interface: %s\tAddress: %s", ifa->ifa_name, addr); } } } |