From: Piotr Haber <gluedig@gmail.com>
To: ofono@ofono.org
Subject: [PATCH] qmimodem: send authentication credentials
Date: Thu, 26 Jan 2017 08:49:05 +0100 [thread overview]
Message-ID: <20170126074905.24644-1-gluedig@gmail.com> (raw)
In-Reply-To: <84af9113-4e2c-7b1a-557f-340749cffe2e@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2290 bytes --]
Pass authentication method, user and password
to QMI WDS service.
---
drivers/qmimodem/gprs-context.c | 24 ++++++++++++++++++++++++
drivers/qmimodem/wds.h | 7 +++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index a39db5e8..2250eef9 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -151,6 +151,7 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, user_data);
struct qmi_param *param;
uint8_t ip_family;
+ uint8_t auth;
DBG("cid %u", ctx->cid);
@@ -178,6 +179,29 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc,
qmi_param_append_uint8(param, QMI_WDS_PARAM_IP_FAMILY, ip_family);
+ switch (ctx->auth_method) {
+ case OFONO_GPRS_AUTH_METHOD_CHAP:
+ auth = QMI_WDS_AUTHENTICATION_CHAP;
+ break;
+ case OFONO_GPRS_AUTH_METHOD_PAP:
+ auth = QMI_WDS_AUTHENTICATION_PAP;
+ break;
+ default:
+ auth = QMI_WDS_AUTHENTICATION_NONE;
+ break;
+ }
+ qmi_param_append_uint8(param, QMI_WDS_PARAM_AUTHENTICATION_PREFERENCE,
+ auth);
+
+ if (ctx->username && strlen(ctx->username)) {
+ qmi_param_append(param, QMI_WDS_PARAM_USERNAME,
+ strlen(ctx->username), ctx->username);
+ }
+
+ if (ctx->password && strlen(ctx->password))
+ qmi_param_append(param, QMI_WDS_PARAM_PASSWORD,
+ strlen(ctx->password), ctx->password);
+
if (qmi_service_send(data->wds, QMI_WDS_START_NET, param,
start_net_cb, cbd, NULL) > 0)
return;
diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h
index 0da34ab9..4843f925 100644
--- a/drivers/qmimodem/wds.h
+++ b/drivers/qmimodem/wds.h
@@ -30,6 +30,13 @@
/* Start WDS network interface */
#define QMI_WDS_PARAM_APN 0x14 /* string */
#define QMI_WDS_PARAM_IP_FAMILY 0x19 /* uint8 */
+#define QMI_WDS_PARAM_USERNAME 0x17 /* string */
+#define QMI_WDS_PARAM_PASSWORD 0x18 /* string */
+#define QMI_WDS_PARAM_AUTHENTICATION_PREFERENCE 0x16 /* uint8 */
+
+#define QMI_WDS_AUTHENTICATION_NONE 0x0
+#define QMI_WDS_AUTHENTICATION_PAP 0x1
+#define QMI_WDS_AUTHENTICATION_CHAP 0x2
#define QMI_WDS_RESULT_PKT_HANDLE 0x01 /* uint32 */
--
2.11.0
next prev parent reply other threads:[~2017-01-26 7:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 11:19 [PATCH] qmimodem: send authentication credentials Piotr Haber
2017-01-25 16:10 ` Denis Kenzior
2017-01-26 7:49 ` Piotr Haber [this message]
2017-01-26 7:57 ` [PATCH v2] " Piotr Haber
2017-01-26 15:21 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170126074905.24644-1-gluedig@gmail.com \
--to=gluedig@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox