From patchwork Sat Aug 8 07:44:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QW50dGkgU2VwcMOkbMOk?= X-Patchwork-Id: 505300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 84108140271 for ; Sat, 8 Aug 2015 17:46:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=0W6J0oqb; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id B745628BB82; Sat, 8 Aug 2015 09:44:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id F3A5C280874 for ; Sat, 8 Aug 2015 09:44:23 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sat, 8 Aug 2015 09:44:23 +0200 (CEST) Received: by labd1 with SMTP id d1so19197102lab.1 for ; Sat, 08 Aug 2015 00:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=9of534jKA6TH7P0iWmv8Mk5yOvbkTgVmf1SDkpCHwIs=; b=0W6J0oqba1ETbHLYNlgOzRK5Y9N0mOPWfvUCIcr95j187SqhjfhMZqREDF0rEh1ezH gXwyDYodCrFXi+OOrQ6kwoERT9REYASad4BtXB3xuFlVYbHSgWVkrGFTyjU3IC3dymkb DGDi1SVKy6yZ+OfxFef3Fw660TImFWifLX0NExH0zfai1HLBFJU4VI+G/4vergvK2dYI +FtgUKaHSPq+TcrpFxNHHpSbv2ZbXj8g0SHAVEDeGzptx93YCCMNbo2/mHxm60VdYJaX 2G0ZC4Cxon9cShiGx4qUGOJPSZDuegJU/Oh1GfR49aUi9ihCeAVTH0MCMVJaLhy5SYbh d67w== X-Received: by 10.112.72.8 with SMTP id z8mr11889014lbu.24.1439019902829; Sat, 08 Aug 2015 00:45:02 -0700 (PDT) Received: from raspberrypi.lan (a88-115-235-252.elisa-laajakaista.fi. [88.115.235.252]) by smtp.gmail.com with ESMTPSA id qm6sm2680457lbb.23.2015.08.08.00.45.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Aug 2015 00:45:02 -0700 (PDT) From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= To: openwrt-devel@lists.openwrt.org Date: Sat, 8 Aug 2015 07:44:37 +0000 Message-Id: <1439019879-9045-2-git-send-email-a.seppala@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439019879-9045-1-git-send-email-a.seppala@gmail.com> References: <1438973405-25757-1-git-send-email-a.seppala@gmail.com> <1439019879-9045-1-git-send-email-a.seppala@gmail.com> MIME-Version: 1.0 Cc: Matti Laakso Subject: [OpenWrt-Devel] [PATCH v2 1/2] uqmi: Add IP family selection command-line switch X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" 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 : Set ip-family for the connection (ipv4, ipv6, unspecified) Usage example for ipv6: uqmi -d /dev/cdc-wdm0 --set-client-id wds, --start-network --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, --start-network --ip-family ipv4 uqmi -d /dev/cdc-wdm0 --get-client-id wds uqmi -d /dev/cdc-wdm0 --set-client-id wds, --start-network --ip-family ipv6 Signed-off-by: Antti Seppälä Tested-by: Matti Laakso --- Notes: v2: No changes commands-wds.c | 28 ++++++++++++++++++++++++++++ commands-wds.h | 2 ++ 2 files changed, 30 insertions(+) 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 : Use network username\n" \ " --password : Use network password\n" \ + " --ip-family : Use ip-family for the connection (ipv4, ipv6, unspecified)\n" \ " --autoconnect: Enable automatic connect/reconnect\n" \ " --stop-network : Stop network connection (use with option below)\n" \ " --autoconnect: Disable automatic connect/reconnect\n" \