mirror of https://gitee.com/openkylin/linux.git
6lowpan: iphc: cleanup use of lowpan_fetch_skb
We introduced the lowpan_fetch_skb function in some previous patches for 6lowpan to have a generic fetch function. This patch drops the old function and use the generic lowpan_fetch_skb one. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
8ec1d9be32
commit
4ebc960f94
|
@ -357,7 +357,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
/* another if the CID flag is set */
|
/* another if the CID flag is set */
|
||||||
if (iphc1 & LOWPAN_IPHC_CID) {
|
if (iphc1 & LOWPAN_IPHC_CID) {
|
||||||
pr_debug("CID flag is set, increase header with one\n");
|
pr_debug("CID flag is set, increase header with one\n");
|
||||||
if (lowpan_fetch_skb_u8(skb, &num_context))
|
if (lowpan_fetch_skb(skb, &num_context, sizeof(num_context)))
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
* ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
|
* ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
|
||||||
*/
|
*/
|
||||||
case 0: /* 00b */
|
case 0: /* 00b */
|
||||||
if (lowpan_fetch_skb_u8(skb, &tmp))
|
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
memcpy(&hdr.flow_lbl, &skb->data[0], 3);
|
memcpy(&hdr.flow_lbl, &skb->data[0], 3);
|
||||||
|
@ -384,7 +384,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
* ECN + DSCP (1 byte), Flow Label is elided
|
* ECN + DSCP (1 byte), Flow Label is elided
|
||||||
*/
|
*/
|
||||||
case 2: /* 10b */
|
case 2: /* 10b */
|
||||||
if (lowpan_fetch_skb_u8(skb, &tmp))
|
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
hdr.priority = ((tmp >> 2) & 0x0f);
|
hdr.priority = ((tmp >> 2) & 0x0f);
|
||||||
|
@ -395,7 +395,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
* ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided
|
* ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided
|
||||||
*/
|
*/
|
||||||
case 1: /* 01b */
|
case 1: /* 01b */
|
||||||
if (lowpan_fetch_skb_u8(skb, &tmp))
|
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
hdr.flow_lbl[0] = (skb->data[0] & 0x0F) | ((tmp >> 2) & 0x30);
|
hdr.flow_lbl[0] = (skb->data[0] & 0x0F) | ((tmp >> 2) & 0x30);
|
||||||
|
@ -412,7 +412,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
/* Next Header */
|
/* Next Header */
|
||||||
if ((iphc0 & LOWPAN_IPHC_NH_C) == 0) {
|
if ((iphc0 & LOWPAN_IPHC_NH_C) == 0) {
|
||||||
/* Next header is carried inline */
|
/* Next header is carried inline */
|
||||||
if (lowpan_fetch_skb_u8(skb, &(hdr.nexthdr)))
|
if (lowpan_fetch_skb(skb, &hdr.nexthdr, sizeof(hdr.nexthdr)))
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
pr_debug("NH flag is set, next header carried inline: %02x\n",
|
pr_debug("NH flag is set, next header carried inline: %02x\n",
|
||||||
|
@ -423,7 +423,8 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
|
||||||
if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I)
|
if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I)
|
||||||
hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03];
|
hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03];
|
||||||
else {
|
else {
|
||||||
if (lowpan_fetch_skb_u8(skb, &(hdr.hop_limit)))
|
if (lowpan_fetch_skb(skb, &hdr.hop_limit,
|
||||||
|
sizeof(hdr.hop_limit)))
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue