aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2013-08-16 15:59:54 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-20 16:23:11 -0400
commit84ce1ddfefc3d5a8af5ede6fe16546c143117616 (patch)
tree98b9d4802551ab24abe7805ad9eabf28b879fac2 /net/ieee802154
parent4cffa13d2d6c746bcbe460facaa6a9f22e9cda1f (diff)
6lowpan: init ipv6hdr buffer to zero
This patch simplify the handling to set fields inside of struct ipv6hdr to zero. Instead of setting some memory regions with memset to zero we initialize the whole ipv6hdr to zero. This is a simplification for parsing the 6lowpan header for the upcomming patches. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Reviewed-by: Werner Almesberger <werner@almesberger.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 3b9d5f20bd1c..92429db0b237 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -223,10 +223,6 @@ lowpan_uncompress_addr(struct sk_buff *skb, struct in6_addr *ipaddr,
223 if (prefcount > 0) 223 if (prefcount > 0)
224 memcpy(ipaddr, prefix, prefcount); 224 memcpy(ipaddr, prefix, prefcount);
225 225
226 if (prefcount + postcount < 16)
227 memset(&ipaddr->s6_addr[prefcount], 0,
228 16 - (prefcount + postcount));
229
230 if (postcount > 0) { 226 if (postcount > 0) {
231 memcpy(&ipaddr->s6_addr[16 - postcount], skb->data, postcount); 227 memcpy(&ipaddr->s6_addr[16 - postcount], skb->data, postcount);
232 skb_pull(skb, postcount); 228 skb_pull(skb, postcount);
@@ -723,7 +719,7 @@ frame_err:
723static int 719static int
724lowpan_process_data(struct sk_buff *skb) 720lowpan_process_data(struct sk_buff *skb)
725{ 721{
726 struct ipv6hdr hdr; 722 struct ipv6hdr hdr = {};
727 u8 tmp, iphc0, iphc1, num_context = 0; 723 u8 tmp, iphc0, iphc1, num_context = 0;
728 u8 *_saddr, *_daddr; 724 u8 *_saddr, *_daddr;
729 int err; 725 int err;
@@ -868,8 +864,6 @@ lowpan_process_data(struct sk_buff *skb)
868 864
869 hdr.priority = ((tmp >> 2) & 0x0f); 865 hdr.priority = ((tmp >> 2) & 0x0f);
870 hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30); 866 hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30);
871 hdr.flow_lbl[1] = 0;
872 hdr.flow_lbl[2] = 0;
873 break; 867 break;
874 /* 868 /*
875 * Flow Label carried in-line 869 * Flow Label carried in-line
@@ -885,10 +879,6 @@ lowpan_process_data(struct sk_buff *skb)
885 break; 879 break;
886 /* Traffic Class and Flow Label are elided */ 880 /* Traffic Class and Flow Label are elided */
887 case 3: /* 11b */ 881 case 3: /* 11b */
888 hdr.priority = 0;
889 hdr.flow_lbl[0] = 0;
890 hdr.flow_lbl[1] = 0;
891 hdr.flow_lbl[2] = 0;
892 break; 882 break;
893 default: 883 default:
894 break; 884 break;