Set default IP configuration method for services
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 30 Jun 2009 15:27:40 +0000 (08:27 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 30 Jun 2009 15:27:40 +0000 (08:27 -0700)
include/ipconfig.h
src/ipconfig.c
src/service.c

index 94dfe67..ec2a985 100644 (file)
@@ -51,6 +51,9 @@ struct connman_ipconfig *connman_ipconfig_create(void);
 struct connman_ipconfig *connman_ipconfig_ref(struct connman_ipconfig *ipconfig);
 void connman_ipconfig_unref(struct connman_ipconfig *ipconfig);
 
+int connman_ipconfig_set_method(struct connman_ipconfig *ipconfig,
+                                       enum connman_ipconfig_method method);
+
 #define CONNMAN_IPCONFIG_PRIORITY_LOW      -100
 #define CONNMAN_IPCONFIG_PRIORITY_DEFAULT     0
 #define CONNMAN_IPCONFIG_PRIORITY_HIGH      100
index 13e1d41..6e4927d 100644 (file)
@@ -80,6 +80,21 @@ void connman_ipconfig_unref(struct connman_ipconfig *ipconfig)
        }
 }
 
+/**
+ * connman_ipconfig_set_method:
+ * @ipconfig: ipconfig structure
+ * @method: configuration method
+ *
+ * Set the configuration method
+ */
+int connman_ipconfig_set_method(struct connman_ipconfig *ipconfig,
+                                       enum connman_ipconfig_method method)
+{
+       ipconfig->method = method;
+
+       return 0;
+}
+
 const char *__connman_ipconfig_method2string(enum connman_ipconfig_method method)
 {
        switch (method) {
index 5323768..1a0713a 100644 (file)
@@ -689,6 +689,9 @@ struct connman_service *connman_service_create(void)
                return NULL;
        }
 
+       connman_ipconfig_set_method(service->ipconfig,
+                                       CONNMAN_IPCONFIG_METHOD_DHCP);
+
        return service;
 }