aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-29 21:48:41 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-30 13:28:40 -0400
commit7fc4cfda757d5d8f31ba2ebb07b3fb31ae6986bc (patch)
treeba6f1e5cc21ced228cea2fbdae65d557eafc612a /net
parent89f534905ad6e7f18d89759efcbfc8225f254de1 (diff)
6lowpan: iphc: Fix issues with alignment matching open parenthesis
This patch fixes all the issues with alignment matching of open parenthesis found by checkpatch.pl and makes them follow the network coding style now. CHECK: Alignment should match open parenthesis +static int uncompress_addr(struct sk_buff *skb, + struct in6_addr *ipaddr, const u8 address_mode, CHECK: Alignment should match open parenthesis +static int uncompress_context_based_src_addr(struct sk_buff *skb, + struct in6_addr *ipaddr, CHECK: Alignment should match open parenthesis +static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, + struct net_device *dev, skb_delivery_cb deliver_skb) CHECK: Alignment should match open parenthesis + new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb), + GFP_ATOMIC); CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw skb data dump before receiving", + new->data, new->len); CHECK: Alignment should match open parenthesis +lowpan_uncompress_multicast_daddr(struct sk_buff *skb, + struct in6_addr *ipaddr, CHECK: Alignment should match open parenthesis + raw_dump_inline(NULL, "Reconstructed ipv6 multicast addr is", + ipaddr->s6_addr, 16); CHECK: Alignment should match open parenthesis +int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, + const u8 *saddr, const u8 saddr_type, const u8 saddr_len, CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw skb data dump uncompressed", + skb->data, skb->len); CHECK: Alignment should match open parenthesis + err = uncompress_addr(skb, &hdr.saddr, tmp, saddr, + saddr_type, saddr_len); CHECK: Alignment should match open parenthesis + err = uncompress_addr(skb, &hdr.daddr, tmp, daddr, + daddr_type, daddr_len); CHECK: Alignment should match open parenthesis + pr_debug("dest: stateless compression mode %d dest %pI6c\n", + tmp, &hdr.daddr); CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw UDP header dump", + (u8 *)&uh, sizeof(uh)); CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw header dump", (u8 *)&hdr, + sizeof(hdr)); CHECK: Alignment should match open parenthesis +int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, + unsigned short type, const void *_daddr, CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw skb network header dump", + skb_network_header(skb), sizeof(struct ipv6hdr)); CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, + "sending raw skb network uncompressed packet", CHECK: Alignment should match open parenthesis + if (((hdr->flow_lbl[0] & 0x0F) == 0) && + (hdr->flow_lbl[1] == 0) && (hdr->flow_lbl[2] == 0)) { WARNING: quoted string split across lines + pr_debug("dest address unicast link-local %pI6c " + "iphc1 0x%02x\n", &hdr->daddr, iphc1); CHECK: Alignment should match open parenthesis + raw_dump_table(__func__, "raw skb data dump compressed", + skb->data, skb->len); Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/6lowpan/iphc.c74
1 files changed, 35 insertions, 39 deletions
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 3069eb615ace..c718253a4e07 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -63,9 +63,9 @@
63 * address_mode is sam value or dam value. 63 * address_mode is sam value or dam value.
64 */ 64 */
65static int uncompress_addr(struct sk_buff *skb, 65static int uncompress_addr(struct sk_buff *skb,
66 struct in6_addr *ipaddr, const u8 address_mode, 66 struct in6_addr *ipaddr, const u8 address_mode,
67 const u8 *lladdr, const u8 addr_type, 67 const u8 *lladdr, const u8 addr_type,
68 const u8 addr_len) 68 const u8 addr_len)
69{ 69{
70 bool fail; 70 bool fail;
71 71
@@ -142,8 +142,8 @@ static int uncompress_addr(struct sk_buff *skb,
142 * based address(non-multicast). 142 * based address(non-multicast).
143 */ 143 */
144static int uncompress_context_based_src_addr(struct sk_buff *skb, 144static int uncompress_context_based_src_addr(struct sk_buff *skb,
145 struct in6_addr *ipaddr, 145 struct in6_addr *ipaddr,
146 const u8 sam) 146 const u8 sam)
147{ 147{
148 switch (sam) { 148 switch (sam) {
149 case LOWPAN_IPHC_ADDR_00: 149 case LOWPAN_IPHC_ADDR_00:
@@ -172,13 +172,13 @@ static int uncompress_context_based_src_addr(struct sk_buff *skb,
172} 172}
173 173
174static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, 174static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
175 struct net_device *dev, skb_delivery_cb deliver_skb) 175 struct net_device *dev, skb_delivery_cb deliver_skb)
176{ 176{
177 struct sk_buff *new; 177 struct sk_buff *new;
178 int stat; 178 int stat;
179 179
180 new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb), 180 new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
181 GFP_ATOMIC); 181 GFP_ATOMIC);
182 kfree_skb(skb); 182 kfree_skb(skb);
183 183
184 if (!new) 184 if (!new)
@@ -193,7 +193,7 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
193 new->dev = dev; 193 new->dev = dev;
194 194
195 raw_dump_table(__func__, "raw skb data dump before receiving", 195 raw_dump_table(__func__, "raw skb data dump before receiving",
196 new->data, new->len); 196 new->data, new->len);
197 197
198 stat = deliver_skb(new, dev); 198 stat = deliver_skb(new, dev);
199 199
@@ -205,10 +205,9 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
205/* Uncompress function for multicast destination address, 205/* Uncompress function for multicast destination address,
206 * when M bit is set. 206 * when M bit is set.
207 */ 207 */
208static int 208static int lowpan_uncompress_multicast_daddr(struct sk_buff *skb,
209lowpan_uncompress_multicast_daddr(struct sk_buff *skb, 209 struct in6_addr *ipaddr,
210 struct in6_addr *ipaddr, 210 const u8 dam)
211 const u8 dam)
212{ 211{
213 bool fail; 212 bool fail;
214 213
@@ -254,13 +253,12 @@ lowpan_uncompress_multicast_daddr(struct sk_buff *skb,
254 } 253 }
255 254
256 raw_dump_inline(NULL, "Reconstructed ipv6 multicast addr is", 255 raw_dump_inline(NULL, "Reconstructed ipv6 multicast addr is",
257 ipaddr->s6_addr, 16); 256 ipaddr->s6_addr, 16);
258 257
259 return 0; 258 return 0;
260} 259}
261 260
262static int 261static int uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
263uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
264{ 262{
265 bool fail; 263 bool fail;
266 u8 tmp = 0, val = 0; 264 u8 tmp = 0, val = 0;
@@ -336,16 +334,16 @@ err:
336static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 }; 334static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 };
337 335
338int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, 336int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
339 const u8 *saddr, const u8 saddr_type, const u8 saddr_len, 337 const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
340 const u8 *daddr, const u8 daddr_type, const u8 daddr_len, 338 const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
341 u8 iphc0, u8 iphc1, skb_delivery_cb deliver_skb) 339 u8 iphc0, u8 iphc1, skb_delivery_cb deliver_skb)
342{ 340{
343 struct ipv6hdr hdr = {}; 341 struct ipv6hdr hdr = {};
344 u8 tmp, num_context = 0; 342 u8 tmp, num_context = 0;
345 int err; 343 int err;
346 344
347 raw_dump_table(__func__, "raw skb data dump uncompressed", 345 raw_dump_table(__func__, "raw skb data dump uncompressed",
348 skb->data, skb->len); 346 skb->data, skb->len);
349 347
350 /* another if the CID flag is set */ 348 /* another if the CID flag is set */
351 if (iphc1 & LOWPAN_IPHC_CID) { 349 if (iphc1 & LOWPAN_IPHC_CID) {
@@ -424,13 +422,12 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
424 if (iphc1 & LOWPAN_IPHC_SAC) { 422 if (iphc1 & LOWPAN_IPHC_SAC) {
425 /* Source address context based uncompression */ 423 /* Source address context based uncompression */
426 pr_debug("SAC bit is set. Handle context based source address.\n"); 424 pr_debug("SAC bit is set. Handle context based source address.\n");
427 err = uncompress_context_based_src_addr( 425 err = uncompress_context_based_src_addr(skb, &hdr.saddr, tmp);
428 skb, &hdr.saddr, tmp);
429 } else { 426 } else {
430 /* Source address uncompression */ 427 /* Source address uncompression */
431 pr_debug("source address stateless compression\n"); 428 pr_debug("source address stateless compression\n");
432 err = uncompress_addr(skb, &hdr.saddr, tmp, saddr, 429 err = uncompress_addr(skb, &hdr.saddr, tmp, saddr,
433 saddr_type, saddr_len); 430 saddr_type, saddr_len);
434 } 431 }
435 432
436 /* Check on error of previous branch */ 433 /* Check on error of previous branch */
@@ -446,16 +443,17 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
446 pr_debug("dest: context-based mcast compression\n"); 443 pr_debug("dest: context-based mcast compression\n");
447 /* TODO: implement this */ 444 /* TODO: implement this */
448 } else { 445 } else {
449 err = lowpan_uncompress_multicast_daddr( 446 err = lowpan_uncompress_multicast_daddr(skb, &hdr.daddr,
450 skb, &hdr.daddr, tmp); 447 tmp);
448
451 if (err) 449 if (err)
452 goto drop; 450 goto drop;
453 } 451 }
454 } else { 452 } else {
455 err = uncompress_addr(skb, &hdr.daddr, tmp, daddr, 453 err = uncompress_addr(skb, &hdr.daddr, tmp, daddr,
456 daddr_type, daddr_len); 454 daddr_type, daddr_len);
457 pr_debug("dest: stateless compression mode %d dest %pI6c\n", 455 pr_debug("dest: stateless compression mode %d dest %pI6c\n",
458 tmp, &hdr.daddr); 456 tmp, &hdr.daddr);
459 if (err) 457 if (err)
460 goto drop; 458 goto drop;
461 } 459 }
@@ -484,7 +482,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
484 skb_copy_to_linear_data(skb, &uh, sizeof(struct udphdr)); 482 skb_copy_to_linear_data(skb, &uh, sizeof(struct udphdr));
485 483
486 raw_dump_table(__func__, "raw UDP header dump", 484 raw_dump_table(__func__, "raw UDP header dump",
487 (u8 *)&uh, sizeof(uh)); 485 (u8 *)&uh, sizeof(uh));
488 486
489 hdr.nexthdr = UIP_PROTO_UDP; 487 hdr.nexthdr = UIP_PROTO_UDP;
490 } 488 }
@@ -499,8 +497,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
499 hdr.version, ntohs(hdr.payload_len), hdr.nexthdr, 497 hdr.version, ntohs(hdr.payload_len), hdr.nexthdr,
500 hdr.hop_limit, &hdr.daddr); 498 hdr.hop_limit, &hdr.daddr);
501 499
502 raw_dump_table(__func__, "raw header dump", (u8 *)&hdr, 500 raw_dump_table(__func__, "raw header dump", (u8 *)&hdr, sizeof(hdr));
503 sizeof(hdr));
504 501
505 return skb_deliver(skb, &hdr, dev, deliver_skb); 502 return skb_deliver(skb, &hdr, dev, deliver_skb);
506 503
@@ -594,8 +591,8 @@ static void compress_udp_header(u8 **hc_ptr, struct sk_buff *skb)
594} 591}
595 592
596int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, 593int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
597 unsigned short type, const void *_daddr, 594 unsigned short type, const void *_daddr,
598 const void *_saddr, unsigned int len) 595 const void *_saddr, unsigned int len)
599{ 596{
600 u8 tmp, iphc0, iphc1, *hc_ptr; 597 u8 tmp, iphc0, iphc1, *hc_ptr;
601 struct ipv6hdr *hdr; 598 struct ipv6hdr *hdr;
@@ -610,11 +607,11 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
610 607
611 pr_debug("IPv6 header dump:\n\tversion = %d\n\tlength = %d\n" 608 pr_debug("IPv6 header dump:\n\tversion = %d\n\tlength = %d\n"
612 "\tnexthdr = 0x%02x\n\thop_lim = %d\n\tdest = %pI6c\n", 609 "\tnexthdr = 0x%02x\n\thop_lim = %d\n\tdest = %pI6c\n",
613 hdr->version, ntohs(hdr->payload_len), hdr->nexthdr, 610 hdr->version, ntohs(hdr->payload_len), hdr->nexthdr,
614 hdr->hop_limit, &hdr->daddr); 611 hdr->hop_limit, &hdr->daddr);
615 612
616 raw_dump_table(__func__, "raw skb network header dump", 613 raw_dump_table(__func__, "raw skb network header dump",
617 skb_network_header(skb), sizeof(struct ipv6hdr)); 614 skb_network_header(skb), sizeof(struct ipv6hdr));
618 615
619 /* As we copy some bit-length fields, in the IPHC encoding bytes, 616 /* As we copy some bit-length fields, in the IPHC encoding bytes,
620 * we sometimes use |= 617 * we sometimes use |=
@@ -631,9 +628,8 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
631 raw_dump_inline(__func__, "daddr", 628 raw_dump_inline(__func__, "daddr",
632 (unsigned char *)_daddr, IEEE802154_ADDR_LEN); 629 (unsigned char *)_daddr, IEEE802154_ADDR_LEN);
633 630
634 raw_dump_table(__func__, 631 raw_dump_table(__func__, "sending raw skb network uncompressed packet",
635 "sending raw skb network uncompressed packet", 632 skb->data, skb->len);
636 skb->data, skb->len);
637 633
638 /* Traffic class, flow label 634 /* Traffic class, flow label
639 * If flow label is 0, compress it. If traffic class is 0, compress it 635 * If flow label is 0, compress it. If traffic class is 0, compress it
@@ -763,7 +759,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
763 iphc1 |= lowpan_compress_addr_64(&hc_ptr, 759 iphc1 |= lowpan_compress_addr_64(&hc_ptr,
764 LOWPAN_IPHC_DAM_BIT, &hdr->daddr, _daddr); 760 LOWPAN_IPHC_DAM_BIT, &hdr->daddr, _daddr);
765 pr_debug("dest address unicast link-local %pI6c " 761 pr_debug("dest address unicast link-local %pI6c "
766 "iphc1 0x%02x\n", &hdr->daddr, iphc1); 762 "iphc1 0x%02x\n", &hdr->daddr, iphc1);
767 } else { 763 } else {
768 pr_debug("dest address unicast %pI6c\n", &hdr->daddr); 764 pr_debug("dest address unicast %pI6c\n", &hdr->daddr);
769 lowpan_push_hc_data(&hc_ptr, hdr->daddr.s6_addr, 16); 765 lowpan_push_hc_data(&hc_ptr, hdr->daddr.s6_addr, 16);
@@ -785,7 +781,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
785 pr_debug("header len %d skb %u\n", (int)(hc_ptr - head), skb->len); 781 pr_debug("header len %d skb %u\n", (int)(hc_ptr - head), skb->len);
786 782
787 raw_dump_table(__func__, "raw skb data dump compressed", 783 raw_dump_table(__func__, "raw skb data dump compressed",
788 skb->data, skb->len); 784 skb->data, skb->len);
789 return 0; 785 return 0;
790} 786}
791EXPORT_SYMBOL_GPL(lowpan_header_compress); 787EXPORT_SYMBOL_GPL(lowpan_header_compress);