summaryrefslogtreecommitdiff
path: root/vpn/vpn-ipconfig.c
diff options
context:
space:
mode:
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 c3e61453..c096fa37 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)