summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-05-16 08:52:48 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-05-16 08:52:48 -0700
commit6e84765a8dda6c0cb5f13fbaf7bdecf9016c8de4 (patch)
tree10a7bc5e171a0579ad7eb509e9f3a11e373f03eb /src
parent9172bc5e82d912c889d159d0d1573d4586020cc2 (diff)
downloadconnman-6e84765a8dda6c0cb5f13fbaf7bdecf9016c8de4.tar.gz
connman-6e84765a8dda6c0cb5f13fbaf7bdecf9016c8de4.tar.bz2
connman-6e84765a8dda6c0cb5f13fbaf7bdecf9016c8de4.zip
Add support for default route notifications
Diffstat (limited to 'src')
-rw-r--r--src/connection.c19
-rw-r--r--src/connman.h1
-rw-r--r--src/service.c7
3 files changed, 23 insertions, 4 deletions
diff --git a/src/connection.c b/src/connection.c
index b0039a69..3b67b921 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -114,7 +114,8 @@ static int set_route(struct connman_element *element, const char *gateway)
err = ioctl(sk, SIOCADDRT, &rt);
if (err < 0)
- DBG("default route setting failed (%s)", strerror(errno));
+ connman_error("Setting default route failed (%s)",
+ strerror(errno));
close(sk);
@@ -161,7 +162,8 @@ static int del_route(struct connman_element *element, const char *gateway)
err = ioctl(sk, SIOCDELRT, &rt);
if (err < 0)
- DBG("default route removal failed (%s)", strerror(errno));
+ connman_error("Removing default route failed (%s)",
+ strerror(errno));
close(sk);
@@ -228,6 +230,7 @@ static void del_default(struct connman_element *element, gpointer user_data)
static void new_default(struct connman_element *element, gpointer user_data)
{
+ struct connman_service *service;
const char *gateway;
DBG("element %p name %s", element, element->name);
@@ -243,7 +246,11 @@ static void new_default(struct connman_element *element, gpointer user_data)
if (gateway == NULL)
return;
- set_route(element, gateway);
+ if (set_route(element, gateway) < 0)
+ return;
+
+ service = __connman_element_get_service(element);
+ __connman_service_indicate_default(service);
connman_element_set_enabled(element, TRUE);
emit_default_signal(element);
@@ -503,9 +510,13 @@ static int connection_probe(struct connman_element *element)
return 0;
}
- set_route(element, gateway);
+ if (set_route(element, gateway) < 0)
+ return 0;
done:
+ service = __connman_element_get_service(element);
+ __connman_service_indicate_default(service);
+
connman_element_set_enabled(element, TRUE);
emit_default_signal(element);
diff --git a/src/connman.h b/src/connman.h
index f0fde967..3078631a 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -242,6 +242,7 @@ int __connman_service_set_carrier(struct connman_service *service,
connman_bool_t carrier);
int __connman_service_indicate_state(struct connman_service *service,
enum connman_service_state state);
+int __connman_service_indicate_default(struct connman_service *service);
#include <connman/notifier.h>
diff --git a/src/service.c b/src/service.c
index 605b9ef1..4d8c0d61 100644
--- a/src/service.c
+++ b/src/service.c
@@ -818,6 +818,13 @@ int __connman_service_indicate_state(struct connman_service *service,
return 0;
}
+int __connman_service_indicate_default(struct connman_service *service)
+{
+ DBG("service %p", service);
+
+ return 0;
+}
+
/**
* __connman_service_lookup:
* @identifier: service identifier