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>
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);
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;