summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti Seppälä <a.seppala@gmail.com>2015-08-08 07:44:37 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-08-13 08:56:23 +0200
commit4dc4ca968008f4bdf614e8e9941e9935114d54be (patch)
tree3c6d7e1fe662c9d46fab17e10d6dd0fcec3a3253
parentae8c4b22b905136967b89438e958526ac5a37604 (diff)
uqmi: Add IP family selection command-line switch
This patch adds support for (optionally) specifying ip family via a command- line switch. The switch sends respective "Set IP Family" WDS message to qmi-device before actually connecting. Using this switch allows connecting to ipv6 enabled networks or networks with dual-stack support with the appropriate hardware (dongle and FW with ipv6 support) and configuration (AT+CGDCONT reporting ipv6 or ipv4v6 capability). Help text: --ip-family <family>: Set ip-family for the connection (ipv4, ipv6, unspecified) Usage example for ipv6: uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid> --start-network <apn> --ip-family ipv6 Dual-stack usage example: uqmi -d /dev/cdc-wdm0 --get-client-id wds uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid-1> --start-network <apn> --ip-family ipv4 uqmi -d /dev/cdc-wdm0 --get-client-id wds uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid-2> --start-network <apn> --ip-family ipv6 Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Tested-by: Matti Laakso <malaakso@elisanet.fi>
-rw-r--r--commands-wds.c28
-rw-r--r--commands-wds.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/commands-wds.c b/commands-wds.c
index aa57d03..fdf9003 100644
--- a/commands-wds.c
+++ b/commands-wds.c
@@ -170,3 +170,31 @@ cmd_wds_reset_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_m
qmi_set_wds_reset_request(msg);
return QMI_CMD_REQUEST;
}
+
+#define cmd_wds_set_ip_family_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_ip_family_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_wds_set_ip_family_request ipf_req;
+ const struct ip_modes {
+ const char *name;
+ const QmiWdsIpFamily mode;
+ } modes[] = {
+ { "ipv4", QMI_WDS_IP_FAMILY_IPV4 },
+ { "ipv6", QMI_WDS_IP_FAMILY_IPV6 },
+ { "unspecified", QMI_WDS_IP_FAMILY_UNSPECIFIED },
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(modes); i++) {
+ if (strcasecmp(modes[i].name, arg) != 0)
+ continue;
+
+ qmi_set(&ipf_req, preference, modes[i].mode);
+ qmi_set_wds_set_ip_family_request(msg, &ipf_req);
+ return QMI_CMD_REQUEST;
+ }
+
+ uqmi_add_error("Invalid value (valid: ipv4, ipv6, unspecified)");
+ return QMI_CMD_EXIT;
+}
diff --git a/commands-wds.h b/commands-wds.h
index 19e6406..8ddfb1e 100644
--- a/commands-wds.h
+++ b/commands-wds.h
@@ -24,6 +24,7 @@
__uqmi_command(wds_set_auth, auth-type, required, CMD_TYPE_OPTION), \
__uqmi_command(wds_set_username, username, required, CMD_TYPE_OPTION), \
__uqmi_command(wds_set_password, password, required, CMD_TYPE_OPTION), \
+ __uqmi_command(wds_set_ip_family, ip-family, required, CMD_TYPE_OPTION), \
__uqmi_command(wds_set_autoconnect, autoconnect, no, CMD_TYPE_OPTION), \
__uqmi_command(wds_stop_network, stop-network, required, QMI_SERVICE_WDS), \
__uqmi_command(wds_get_packet_service_status, get-data-status, no, QMI_SERVICE_WDS), \
@@ -36,6 +37,7 @@
" --auth-type pap|chap|both|none: Use network authentication type\n" \
" --username <name>: Use network username\n" \
" --password <password>: Use network password\n" \
+ " --ip-family <family>: Use ip-family for the connection (ipv4, ipv6, unspecified)\n" \
" --autoconnect: Enable automatic connect/reconnect\n" \
" --stop-network <pdh>: Stop network connection (use with option below)\n" \
" --autoconnect: Disable automatic connect/reconnect\n" \