Add GSM MUX IPv6 support
authorsamix.lebsir <samix.lebsir@intel.com>
Mon, 26 Dec 2011 10:45:38 +0000 (11:45 +0100)
committerbuildbot <buildbot@intel.com>
Tue, 27 Dec 2011 13:31:37 +0000 (05:31 -0800)
BZ: 14074

Create dynamic reading of incomming packet to retreive correct protocol, Change IOCTL checks

Change-Id: I33ed3166009afa1b6050450fc7c682fee47111cd
Signed-off-by: samix.lebsir <samix.lebsir@intel.com>
Reviewed-on: http://android.intel.com:8080/29960
Reviewed-by: Robert, Denis <denis.robert@intel.com>
Tested-by: Robert, Denis <denis.robert@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/tty/n_gsm.c

index d5f4ba6..6bca951 100644 (file)
@@ -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;