connection: Set proper gateway for ppp links
authorYu A Wang <yu.a.wang@intel.com>
Fri, 12 Aug 2011 06:42:16 +0000 (02:42 -0400)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 16 Aug 2011 18:32:14 +0000 (20:32 +0200)
The default gateway for ppp connection should be 0.0.0.0 for ipv4
and :: for ipv6. This issue fixed before but removed by the commit
84a739d0082b89efa8cfbf376abe17937e4bc843

src/connection.c

index 4f3b3f8..bd0a21e 100644 (file)
@@ -453,6 +453,17 @@ int __connman_connection_gateway_add(struct connman_service *service,
        DBG("service %p index %d gateway %s vpn ip %s type %d",
                service, index, gateway, peer, type);
 
+       /*
+        * If gateway is NULL, it's a point to point link and the default
+        * gateway for ipv4 is 0.0.0.0 and for ipv6 is ::, meaning the
+        * interface
+        */
+       if (gateway == NULL && type == CONNMAN_IPCONFIG_TYPE_IPV4)
+               gateway = "0.0.0.0";
+
+       if (gateway == NULL && type == CONNMAN_IPCONFIG_TYPE_IPV6)
+               gateway = "::";
+
        active_gateway = find_active_gateway();
        new_gateway = add_gateway(service, index, gateway, type);
        if (new_gateway == NULL)