summaryrefslogtreecommitdiffstats
path: root/src/providers/data_provider_be.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-06-27 21:22:11 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-07-09 11:44:07 -0400
commit90acbcf20b5f896ca8f631923afe946c90d90de7 (patch)
treea4942121f0c624d1ea6f16bf093924fade010b88 /src/providers/data_provider_be.c
parent801fcc63a9ec83d76d8d027758f9a0357b34890f (diff)
downloadsssd-90acbcf20b5f896ca8f631923afe946c90d90de7.tar.gz
sssd-90acbcf20b5f896ca8f631923afe946c90d90de7.tar.xz
sssd-90acbcf20b5f896ca8f631923afe946c90d90de7.zip
Use netlink to detect going online
Integrates libnl to detect adding routes. When a route is added, the offline status of all back ends is reset. This patch adds no heuristics to detect whether back end went offline. Fixes: #456
Diffstat (limited to 'src/providers/data_provider_be.c')
-rw-r--r--src/providers/data_provider_be.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index 059a0514e..004ee0973 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -55,11 +55,14 @@ static int data_provider_res_init(DBusMessage *message,
struct sbus_connection *conn);
static int data_provider_go_offline(DBusMessage *message,
struct sbus_connection *conn);
+static int data_provider_reset_offline(DBusMessage *message,
+ struct sbus_connection *conn);
struct sbus_method monitor_be_methods[] = {
{ MON_CLI_METHOD_PING, monitor_common_pong },
{ MON_CLI_METHOD_RES_INIT, data_provider_res_init },
{ MON_CLI_METHOD_OFFLINE, data_provider_go_offline },
+ { MON_CLI_METHOD_RESET_OFFLINE, data_provider_reset_offline },
{ MON_CLI_METHOD_ROTATE, monitor_common_rotate_logs },
{ NULL, NULL }
};
@@ -170,6 +173,14 @@ void be_mark_offline(struct be_ctx *ctx)
be_run_offline_cb(ctx);
}
+void be_reset_offline(struct be_ctx *ctx)
+{
+ DEBUG(8, ("Going back online!\n"));
+
+ ctx->offstat.offline = false;
+ be_run_online_cb(ctx);
+}
+
static int be_check_online(DBusMessage *message, struct sbus_connection *conn)
{
struct be_client *becli;
@@ -1229,3 +1240,12 @@ static int data_provider_go_offline(DBusMessage *message,
be_mark_offline(be_ctx);
return monitor_common_pong(message, conn);
}
+
+static int data_provider_reset_offline(DBusMessage *message,
+ struct sbus_connection *conn)
+{
+ struct be_ctx *be_ctx;
+ be_ctx = talloc_get_type(sbus_conn_get_private_data(conn), struct be_ctx);
+ be_reset_offline(be_ctx);
+ return monitor_common_pong(message, conn);
+}