Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338996

[PATCH 6/8] tty: n_gsm: add missing length field in control channel commands

From Andrej Krpic <ak77@tnode.com>
Newsgroups linux.kernel
Subject [PATCH 6/8] tty: n_gsm: add missing length field in control channel commands
Date 2016-02-21 22:50 +0100
Message-ID <r4K38-3NN-25@gated-at.bofh.it> (permalink)
References <r4K37-3NN-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Observing debug output while running initator and responder using n_gsm
shows all control channel commands sent by initiator are malformed
 - they don't include length field (3GPP TS 07.10 ver 7.2.0, 5.4.6.1).

Add length field to transmitted control channel commands in the
gsm_control_transmit) as it is done in gsm_control_reply and expected in
gsm_dlci_command.

Signed-off-by: Andrej Krpic <ak77@tnode.com>
---
 drivers/tty/n_gsm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 3c4c521..8aa90e0 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1320,12 +1320,13 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
 
 static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
 {
-	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
+	struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype);
 
 	if (msg == NULL)
 		return;
-	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;	/* command */
-	memcpy(msg->data + 1, ctrl->data, ctrl->len);
+	msg->data[0] = (ctrl->cmd << 1) | 2 | EA;   /* command */
+	msg->data[1] = ((ctrl->len) << 1) | EA;
+	memcpy(msg->data + 2, ctrl->data, ctrl->len);
 	gsm_data_queue(gsm->dlci[0], msg);
 }
 
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] tty: n_gsm: Make mux work as a responder station Andrej Krpic <ak77@tnode.com> - 2016-02-21 22:50 +0100
  [PATCH 6/8] tty: n_gsm: add missing length field in control channel commands Andrej Krpic <ak77@tnode.com> - 2016-02-21 22:50 +0100
  [PATCH 4/8] tty: n_gsm: send DM response when accessing an invalid channel Andrej Krpic <ak77@tnode.com> - 2016-02-21 22:50 +0100
  [PATCH 1/8] tty: n_gsm: fix formatting errors Andrej Krpic <ak77@tnode.com> - 2016-02-21 22:50 +0100
    Re: [PATCH 1/8] tty: n_gsm: fix formatting errors Joe Perches <joe@perches.com> - 2016-02-21 23:40 +0100
  Re: [PATCH 0/8] tty: n_gsm: Make mux work as a responder station One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-22 00:50 +0100

csiph-web