diff options
author | Martin Xu <martin.xu@intel.com> | 2010-03-25 11:36:49 +0800 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-25 15:07:42 +0100 |
commit | 5b32a078419ce912b4d7083102fa78310c4a2f01 (patch) | |
tree | b55a3b7307bbe7ffd44416a7346c5fbed8fd1b05 /src | |
parent | 1c7e42c140557bb9e0e0c7573f8112aa4e833e9f (diff) | |
download | connman-5b32a078419ce912b4d7083102fa78310c4a2f01.tar.gz connman-5b32a078419ce912b4d7083102fa78310c4a2f01.tar.bz2 connman-5b32a078419ce912b4d7083102fa78310c4a2f01.zip |
Add static gateway support
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.c | 5 | ||||
-rw-r--r-- | src/connman.h | 108 | ||||
-rw-r--r-- | src/ipconfig.c | 18 | ||||
-rw-r--r-- | src/network.c | 2 |
4 files changed, 78 insertions, 55 deletions
diff --git a/src/connection.c b/src/connection.c index a46c372d..6dfb6d92 100644 --- a/src/connection.c +++ b/src/connection.c @@ -249,8 +249,9 @@ static int connection_probe(struct connman_element *element) if (element->parent == NULL) return -ENODEV; - if (element->parent->type != CONNMAN_ELEMENT_TYPE_IPV4) - return -ENODEV; + /* FIXME: Remove temporarily for the static gateway support */ + /* if (element->parent->type != CONNMAN_ELEMENT_TYPE_IPV4) + return -ENODEV; */ connman_element_get_value(element, CONNMAN_PROPERTY_ID_IPV4_GATEWAY, &gateway); diff --git a/src/connman.h b/src/connman.h index f754a6b0..af53a683 100644 --- a/src/connman.h +++ b/src/connman.h @@ -108,59 +108,6 @@ void __connman_task_cleanup(void); int __connman_security_check_privilege(DBusMessage *message, enum connman_security_privilege privilege); -#include <connman/ipconfig.h> - -int __connman_ipconfig_init(void); -void __connman_ipconfig_cleanup(void); - -struct rtnl_link_stats; - -void __connman_ipconfig_newlink(int index, unsigned short type, - unsigned int flags, const char *address, - unsigned short mtu, - struct rtnl_link_stats *stats); -void __connman_ipconfig_dellink(int index, struct rtnl_link_stats *stats); -void __connman_ipconfig_newaddr(int index, const char *label, - unsigned char prefixlen, const char *address); -void __connman_ipconfig_deladdr(int index, const char *label, - unsigned char prefixlen, const char *address); -void __connman_ipconfig_newroute(int index, unsigned char scope, - const char *dst, const char *gateway); -void __connman_ipconfig_delroute(int index, unsigned char scope, - const char *dst, const char *gateway); - -void __connman_ipconfig_foreach(void (*function) (int index, void *user_data), - void *user_data); -unsigned short __connman_ipconfig_get_type(int index); -unsigned int __connman_ipconfig_get_flags(int index); -const char *__connman_ipconfig_get_gateway(int index); - -int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig); -int __connman_ipconfig_disable(struct connman_ipconfig *ipconfig); - -const char *__connman_ipconfig_method2string(enum connman_ipconfig_method method); -enum connman_ipconfig_method __connman_ipconfig_string2method(const char *method); - -void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter); -void __connman_ipconfig_append_ipv4config(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter); -int __connman_ipconfig_set_ipv4config(struct connman_ipconfig *ipconfig, - DBusMessageIter *value); -void __connman_ipconfig_append_proxy(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter); -void __connman_ipconfig_append_ethernet(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter); -enum connman_ipconfig_method __connman_ipconfig_get_method( - struct connman_ipconfig *ipconfig); -int __connman_ipconfig_set_address(struct connman_ipconfig *ipconfig); -int __connman_ipconfig_clear_address(struct connman_ipconfig *ipconfig); - -int __connman_ipconfig_load(struct connman_ipconfig *ipconfig, - GKeyFile *keyfile, const char *identifier, const char *prefix); -int __connman_ipconfig_save(struct connman_ipconfig *ipconfig, - GKeyFile *keyfile, const char *identifier, const char *prefix); - #include <connman/inet.h> enum connman_device_type __connman_inet_get_device_type(int index); @@ -242,6 +189,61 @@ int __connman_element_disable_technology(enum connman_service_type type); gboolean __connman_element_device_isfiltered(const char *devname); +#include <connman/ipconfig.h> + +int __connman_ipconfig_init(void); +void __connman_ipconfig_cleanup(void); + +struct rtnl_link_stats; + +void __connman_ipconfig_newlink(int index, unsigned short type, + unsigned int flags, const char *address, + unsigned short mtu, + struct rtnl_link_stats *stats); +void __connman_ipconfig_dellink(int index, struct rtnl_link_stats *stats); +void __connman_ipconfig_newaddr(int index, const char *label, + unsigned char prefixlen, const char *address); +void __connman_ipconfig_deladdr(int index, const char *label, + unsigned char prefixlen, const char *address); +void __connman_ipconfig_newroute(int index, unsigned char scope, + const char *dst, const char *gateway); +void __connman_ipconfig_delroute(int index, unsigned char scope, + const char *dst, const char *gateway); + +void __connman_ipconfig_foreach(void (*function) (int index, void *user_data), + void *user_data); +unsigned short __connman_ipconfig_get_type(int index); +unsigned int __connman_ipconfig_get_flags(int index); +const char *__connman_ipconfig_get_gateway(int index); + +int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig); +int __connman_ipconfig_disable(struct connman_ipconfig *ipconfig); + +const char *__connman_ipconfig_method2string(enum connman_ipconfig_method method); +enum connman_ipconfig_method __connman_ipconfig_string2method(const char *method); + +void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, + DBusMessageIter *iter); +void __connman_ipconfig_append_ipv4config(struct connman_ipconfig *ipconfig, + DBusMessageIter *iter); +int __connman_ipconfig_set_ipv4config(struct connman_ipconfig *ipconfig, + DBusMessageIter *value); +void __connman_ipconfig_append_proxy(struct connman_ipconfig *ipconfig, + DBusMessageIter *iter); +void __connman_ipconfig_append_ethernet(struct connman_ipconfig *ipconfig, + DBusMessageIter *iter); +enum connman_ipconfig_method __connman_ipconfig_get_method( + struct connman_ipconfig *ipconfig); +int __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, + struct connman_element *parent); +int __connman_ipconfig_set_address(struct connman_ipconfig *ipconfig); +int __connman_ipconfig_clear_address(struct connman_ipconfig *ipconfig); + +int __connman_ipconfig_load(struct connman_ipconfig *ipconfig, + GKeyFile *keyfile, const char *identifier, const char *prefix); +int __connman_ipconfig_save(struct connman_ipconfig *ipconfig, + GKeyFile *keyfile, const char *identifier, const char *prefix); + #include <connman/utsname.h> int __connman_utsname_set_hostname(const char *hostname); diff --git a/src/ipconfig.c b/src/ipconfig.c index 26380d89..9529846e 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -926,6 +926,24 @@ void connman_ipconfig_bind(struct connman_ipconfig *ipconfig, connman_inet_set_address(origin->index, origin->address); } +/* FIXME: The element soulution should be removed in the future */ +int __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, + struct connman_element *parent) +{ + struct connman_element *connection; + + connection = connman_element_create(NULL); + + connection->type = CONNMAN_ELEMENT_TYPE_CONNECTION; + connection->index = ipconfig->index; + connection->ipv4.gateway = ipconfig->address->gateway; + + if (connman_element_register(connection, parent) < 0) + connman_element_unref(connection); + + return 0; +} + int __connman_ipconfig_set_address(struct connman_ipconfig *ipconfig) { DBG(""); diff --git a/src/network.c b/src/network.c index 8fb0ea02..b99a8675 100644 --- a/src/network.c +++ b/src/network.c @@ -748,6 +748,8 @@ static void set_connected_manual(struct connman_network *network) return; } + __connman_ipconfig_set_gateway(ipconfig, &network->element); + network->connecting = FALSE; connman_network_set_associating(network, FALSE); |