aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKumar Sanghvi <kumar.sanghvi@stericsson.com>2011-01-07 01:57:08 +0000
committerJonas ABERG <jonas.aberg@stericsson.com>2011-01-17 13:41:29 +0100
commitd5d97e0a0c107f4324c68ed7ed24597ec2eff655 (patch)
treed497d3ecbdfc875c40976e27d8939c77d4af2332 /net
parent023016627ba84eee0b3e93a4dfdc71d11677c398 (diff)
CAIF: Fix IPv6 support in receive path for GPRS/3G
Checks version field of IP in the receive path for GPRS/3G data and appropriately sets the value of skb->protocol. Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I8babafdbefa9c92fff261723ac72de908f3c4605 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/12587 Reviewed-by: Kumar A SANGHVI <kumar.sanghvi@stericsson.com> Tested-by: Kumar A SANGHVI <kumar.sanghvi@stericsson.com> Reviewed-by: QATOOLS Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'net')
-rw-r--r--net/caif/chnl_net.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 84a422c9894..fa9dab372b6 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -76,6 +76,8 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
struct chnl_net *priv = container_of(layr, struct chnl_net, chnl);
int pktlen;
int err = 0;
+ const u8 *ip_version;
+ u8 buf;
priv = container_of(layr, struct chnl_net, chnl);
@@ -90,7 +92,21 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
* send the packet to the net stack.
*/
skb->dev = priv->netdev;
- skb->protocol = htons(ETH_P_IP);
+
+ /* check the version of IP */
+ ip_version = skb_header_pointer(skb, 0, 1, &buf);
+ if (!ip_version)
+ return -EINVAL;
+ switch (*ip_version >> 4) {
+ case 4:
+ skb->protocol = htons(ETH_P_IP);
+ break;
+ case 6:
+ skb->protocol = htons(ETH_P_IPV6);
+ break;
+ default:
+ return -EINVAL;
+ }
/* If we change the header in loop mode, the checksum is corrupted. */
if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP)