summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorPhilip Paeps <philip@paeps.cx>2014-06-19 12:07:07 +0200
committerDenis Kenzior <denkenz@gmail.com>2014-06-21 12:02:51 -0500
commit8cbe061c3ba8c33b899c5bb72bd8c853b2391d4a (patch)
tree501549f4588082909a3ffaf8c540b3745ee91e2b /drivers/atmodem
parent3e13676766e05e80b7a1b95cb8ebd06f4a362350 (diff)
downloadofono-8cbe061c3ba8c33b899c5bb72bd8c853b2391d4a.tar.bz2
atmodem: set the PPP authentication method to use
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/gprs-context.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 2217097a..be44443b 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -59,6 +59,7 @@ enum state {
struct gprs_context_data {
GAtChat *chat;
unsigned int active_context;
+ GAtPPPAuthMethod auth_method;
char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
GAtPPP *ppp;
@@ -154,6 +155,7 @@ static gboolean setup_ppp(struct ofono_gprs_context *gc)
if (getenv("OFONO_PPP_DEBUG"))
g_at_ppp_set_debug(gcd->ppp, ppp_debug, "PPP");
+ g_at_ppp_set_auth_method(gcd->ppp, gcd->auth_method);
g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password);
/* set connect and disconnect callbacks */
@@ -243,6 +245,18 @@ static void at_gprs_activate_primary(struct ofono_gprs_context *gc,
memcpy(gcd->username, ctx->username, sizeof(ctx->username));
memcpy(gcd->password, ctx->password, sizeof(ctx->password));
+ /* We only support CHAP and PAP */
+ switch (ctx->auth_method) {
+ case OFONO_GPRS_AUTH_METHOD_CHAP:
+ gcd->auth_method = G_AT_PPP_AUTH_METHOD_CHAP;
+ break;
+ case OFONO_GPRS_AUTH_METHOD_PAP:
+ gcd->auth_method = G_AT_PPP_AUTH_METHOD_PAP;
+ break;
+ default:
+ goto error;
+ }
+
gcd->state = STATE_ENABLING;
if (gcd->vendor == OFONO_VENDOR_ZTE) {