connection: Prefer IPv4 peer over the regular address
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 3 Nov 2010 09:31:17 +0000 (10:31 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 3 Nov 2010 09:31:17 +0000 (10:31 +0100)
If the peer IPv4 address is set, this will be the gateway address.

src/connection.c

index 0e7a790..bac700f 100644 (file)
@@ -288,7 +288,13 @@ static int connection_probe(struct connman_element *element)
                        CONNMAN_PROPERTY_ID_IPV6_GATEWAY, &ipv6_gateway);
 
        connman_element_get_value(element,
-                       CONNMAN_PROPERTY_ID_IPV4_ADDRESS, &vpn_ip);
+                       CONNMAN_PROPERTY_ID_IPV4_PEER, &vpn_ip);
+
+       if (vpn_ip == NULL)
+               connman_element_get_value(element,
+                               CONNMAN_PROPERTY_ID_IPV4_ADDRESS, &vpn_ip);
+
+       DBG("vpn_ip %s", vpn_ip);
 
        connman_element_get_value(element,
                        CONNMAN_PROPERTY_ID_DOMAINNAME, &domainname);