summaryrefslogtreecommitdiff
path: root/vpn/vpn-ipconfig.c
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-10-29 03:03:47 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-10-29 03:03:47 (GMT)
commitbcae74da8fa2958b3fec9153fc33e41f0e0317bf (patch)
tree06a00f6457307467fee4f6580dce4a1a857751c1 /vpn/vpn-ipconfig.c
parent1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (diff)
downloadconnman-bcae74da8fa2958b3fec9153fc33e41f0e0317bf.zip
connman-bcae74da8fa2958b3fec9153fc33e41f0e0317bf.tar.gz
connman-bcae74da8fa2958b3fec9153fc33e41f0e0317bf.tar.bz2
Imported Upstream version 1.26upstream/1.26
Diffstat (limited to 'vpn/vpn-ipconfig.c')
-rw-r--r--vpn/vpn-ipconfig.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/vpn/vpn-ipconfig.c b/vpn/vpn-ipconfig.c
index c3e6145..c096fa3 100644
--- a/vpn/vpn-ipconfig.c
+++ b/vpn/vpn-ipconfig.c
@@ -69,27 +69,13 @@ struct vpn_ipdevice {
static GHashTable *ipdevice_hash = NULL;
-unsigned char __vpn_ipconfig_netmask_prefix_len(const char *netmask)
+struct connman_ipaddress *
+__vpn_ipconfig_get_address(struct vpn_ipconfig *ipconfig)
{
- unsigned char bits;
- in_addr_t mask;
- in_addr_t host;
-
- if (!netmask)
- return 32;
-
- mask = inet_network(netmask);
- host = ~mask;
-
- /* a valid netmask must be 2^n - 1 */
- if ((host & (host + 1)) != 0)
- return -1;
-
- bits = 0;
- for (; mask; mask <<= 1)
- ++bits;
+ if (!ipconfig)
+ return NULL;
- return bits;
+ return ipconfig->address;
}
const char *__vpn_ipconfig_get_peer(struct vpn_ipconfig *ipconfig)