summaryrefslogtreecommitdiffstats
path: root/libnetutils/ifc_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnetutils/ifc_utils.c')
-rw-r--r--libnetutils/ifc_utils.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 186b98c..eb33d06 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -75,9 +75,8 @@ in_addr_t prefixLengthToIpv4Netmask(int prefix_length)
int ipv4NetmaskToPrefixLength(in_addr_t mask)
{
- mask = ntohl(mask);
int prefixLength = 0;
- uint32_t m = (uint32_t)mask;
+ uint32_t m = (uint32_t)ntohl(mask);
while (m & 0x80000000) {
prefixLength++;
m = m << 1;
@@ -486,7 +485,7 @@ int ifc_get_info(const char *name, in_addr_t *addr, int *prefixLength, unsigned
if(ioctl(ifc_ctl_sock, SIOCGIFNETMASK, &ifr) < 0) {
*prefixLength = 0;
} else {
- *prefixLength = ipv4NetmaskToPrefixLength((int)
+ *prefixLength = ipv4NetmaskToPrefixLength(
((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr.s_addr);
}
}
@@ -600,10 +599,6 @@ int ifc_disable(const char *ifname)
return result;
}
-#define RESET_IPV4_ADDRESSES 0x01
-#define RESET_IPV6_ADDRESSES 0x02
-#define RESET_ALL_ADDRESSES (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
-
int ifc_reset_connections(const char *ifname, const int reset_mask)
{
#ifdef HAVE_ANDROID_OS