summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2011-11-15 13:06:23 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2011-11-15 13:41:44 +0100
commit38f52db2a1dc4d797f031b2167947018a1e94467 (patch)
treedf6ceee2e5aecd82c389f2254918605ebee201f9 /scripts
parenteda0a20c40387a7de352ef7bd8c58e3b738b84d5 (diff)
downloadconnman-38f52db2a1dc4d797f031b2167947018a1e94467.tar.gz
connman-38f52db2a1dc4d797f031b2167947018a1e94467.tar.bz2
connman-38f52db2a1dc4d797f031b2167947018a1e94467.zip
scripts: Report authentication error to connman
The ppp plugin now checks ppp authentication error and report it to correct connman plugin.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libppp-plugin.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/libppp-plugin.c b/scripts/libppp-plugin.c
index ba79db07..911551cf 100644
--- a/scripts/libppp-plugin.c
+++ b/scripts/libppp-plugin.c
@@ -45,6 +45,7 @@ static char *interface;
static char *path;
static DBusConnection *connection;
+static int prev_phase;
char pppd_version[] = VERSION;
@@ -238,11 +239,18 @@ static void ppp_phase_change(void *data, int arg)
{
const char *reason = "disconnect";
DBusMessage *msg;
+ int send_msg = 0;
if (connection == NULL)
return;
- if (arg == PHASE_DEAD || arg == PHASE_DISCONNECT) {
+ if (prev_phase == PHASE_AUTHENTICATE &&
+ arg == PHASE_TERMINATE) {
+ reason = "auth failed";
+ send_msg = 1;
+ }
+
+ if (send_msg > 0 || arg == PHASE_DEAD || arg == PHASE_DISCONNECT) {
msg = dbus_message_new_method_call(busname, path,
interface, "notify");
if (msg == NULL)
@@ -259,6 +267,8 @@ static void ppp_phase_change(void *data, int arg)
dbus_message_unref(msg);
}
+
+ prev_phase = arg;
}
int plugin_init(void)