From 53147d01ec7e90e73c5574d4244ce9cc86c5973c Mon Sep 17 00:00:00 2001 From: "samix.lebsir" Date: Mon, 26 Dec 2011 11:45:38 +0100 Subject: [PATCH] Add GSM MUX IPv6 support BZ: 14074 Create dynamic reading of incomming packet to retreive correct protocol, Change IOCTL checks Change-Id: I33ed3166009afa1b6050450fc7c682fee47111cd Signed-off-by: samix.lebsir Reviewed-on: http://android.intel.com:8080/29960 Reviewed-by: Robert, Denis Tested-by: Robert, Denis Reviewed-by: buildbot Tested-by: buildbot --- drivers/tty/n_gsm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index d5f4ba6..6bca951 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2719,7 +2719,15 @@ static void gsm_mux_rx_netchar(struct gsm_dlci *dlci, memcpy(skb_put(skb, size), in_buf, size); skb->dev = net; - skb->protocol = __constant_htons(ETH_P_IP); + /* IP version bit 4 to 7 */ + switch ((*in_buf) >> 4) { + case 4: + skb->protocol = htons(ETH_P_IP); + break; + case 6: + skb->protocol = htons(ETH_P_IPV6); + break; + } /* Ship it off to the kernel */ netif_rx(skb); @@ -2796,8 +2804,11 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc) if (dlci->adaption > 2) return -EBUSY; - if (nc->protocol != htons(ETH_P_IP)) + if (nc->protocol != htons(ETH_P_IP) + && nc->protocol != htons(ETH_P_IPV6)) { + pr_err("only IPV4/V6 protocol supported"); return -EPROTONOSUPPORT; + } if (nc->adaption != 3 && nc->adaption != 4) return -EPROTONOSUPPORT; -- 2.7.4