Skip to content

Commit 84ca5e0

Browse files
alexaringholtmann
authored andcommitted
6lowpan: iphc: rename hc06_ptr pointer to hc_ptr
The hc06_ptr pointer variable stands for header compression draft-06. We are mostly rfc complaint. This patch rename the variable to normal hc_ptr. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 616d55b commit 84ca5e0

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

‎net/6lowpan/iphc.c‎

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,9 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
515515
}
516516
EXPORT_SYMBOL_GPL(lowpan_process_data);
517517

518-
static u8 lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift,
519-
const struct in6_addr *ipaddr,
520-
const unsigned char *lladdr)
518+
static u8 lowpan_compress_addr_64(u8 **hc_ptr, u8 shift,
519+
const struct in6_addr *ipaddr,
520+
const unsigned char *lladdr)
521521
{
522522
u8 val = 0;
523523

@@ -526,24 +526,24 @@ static u8 lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift,
526526
pr_debug("address compression 0 bits\n");
527527
} else if (lowpan_is_iid_16_bit_compressable(ipaddr)) {
528528
/* compress IID to 16 bits xxxx::XXXX */
529-
memcpy(*hc06_ptr, &ipaddr->s6_addr16[7], 2);
530-
*hc06_ptr += 2;
529+
memcpy(*hc_ptr, &ipaddr->s6_addr16[7], 2);
530+
*hc_ptr += 2;
531531
val = 2; /* 16-bits */
532532
raw_dump_inline(NULL, "Compressed ipv6 addr is (16 bits)",
533-
*hc06_ptr - 2, 2);
533+
*hc_ptr - 2, 2);
534534
} else {
535535
/* do not compress IID => xxxx::IID */
536-
memcpy(*hc06_ptr, &ipaddr->s6_addr16[4], 8);
537-
*hc06_ptr += 8;
536+
memcpy(*hc_ptr, &ipaddr->s6_addr16[4], 8);
537+
*hc_ptr += 8;
538538
val = 1; /* 64-bits */
539539
raw_dump_inline(NULL, "Compressed ipv6 addr is (64 bits)",
540-
*hc06_ptr - 8, 8);
540+
*hc_ptr - 8, 8);
541541
}
542542

543543
return rol8(val, shift);
544544
}
545545

546-
static void compress_udp_header(u8 **hc06_ptr, struct sk_buff *skb)
546+
static void compress_udp_header(u8 **hc_ptr, struct sk_buff *skb)
547547
{
548548
struct udphdr *uh = udp_hdr(skb);
549549
u8 tmp;
@@ -555,46 +555,46 @@ static void compress_udp_header(u8 **hc06_ptr, struct sk_buff *skb)
555555
pr_debug("UDP header: both ports compression to 4 bits\n");
556556
/* compression value */
557557
tmp = LOWPAN_NHC_UDP_CS_P_11;
558-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
558+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
559559
/* source and destination port */
560560
tmp = ntohs(uh->dest) - LOWPAN_NHC_UDP_4BIT_PORT +
561561
((ntohs(uh->source) - LOWPAN_NHC_UDP_4BIT_PORT) << 4);
562-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
562+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
563563
} else if ((ntohs(uh->dest) & LOWPAN_NHC_UDP_8BIT_MASK) ==
564564
LOWPAN_NHC_UDP_8BIT_PORT) {
565565
pr_debug("UDP header: remove 8 bits of dest\n");
566566
/* compression value */
567567
tmp = LOWPAN_NHC_UDP_CS_P_01;
568-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
568+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
569569
/* source port */
570-
lowpan_push_hc_data(hc06_ptr, &uh->source, sizeof(uh->source));
570+
lowpan_push_hc_data(hc_ptr, &uh->source, sizeof(uh->source));
571571
/* destination port */
572572
tmp = ntohs(uh->dest) - LOWPAN_NHC_UDP_8BIT_PORT;
573-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
573+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
574574
} else if ((ntohs(uh->source) & LOWPAN_NHC_UDP_8BIT_MASK) ==
575575
LOWPAN_NHC_UDP_8BIT_PORT) {
576576
pr_debug("UDP header: remove 8 bits of source\n");
577577
/* compression value */
578578
tmp = LOWPAN_NHC_UDP_CS_P_10;
579-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
579+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
580580
/* source port */
581581
tmp = ntohs(uh->source) - LOWPAN_NHC_UDP_8BIT_PORT;
582-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
582+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
583583
/* destination port */
584-
lowpan_push_hc_data(hc06_ptr, &uh->dest, sizeof(uh->dest));
584+
lowpan_push_hc_data(hc_ptr, &uh->dest, sizeof(uh->dest));
585585
} else {
586586
pr_debug("UDP header: can't compress\n");
587587
/* compression value */
588588
tmp = LOWPAN_NHC_UDP_CS_P_00;
589-
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
589+
lowpan_push_hc_data(hc_ptr, &tmp, sizeof(tmp));
590590
/* source port */
591-
lowpan_push_hc_data(hc06_ptr, &uh->source, sizeof(uh->source));
591+
lowpan_push_hc_data(hc_ptr, &uh->source, sizeof(uh->source));
592592
/* destination port */
593-
lowpan_push_hc_data(hc06_ptr, &uh->dest, sizeof(uh->dest));
593+
lowpan_push_hc_data(hc_ptr, &uh->dest, sizeof(uh->dest));
594594
}
595595

596596
/* checksum is always inline */
597-
lowpan_push_hc_data(hc06_ptr, &uh->check, sizeof(uh->check));
597+
lowpan_push_hc_data(hc_ptr, &uh->check, sizeof(uh->check));
598598

599599
/* skip the UDP header */
600600
skb_pull(skb, sizeof(struct udphdr));
@@ -604,15 +604,15 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
604604
unsigned short type, const void *_daddr,
605605
const void *_saddr, unsigned int len)
606606
{
607-
u8 tmp, iphc0, iphc1, *hc06_ptr;
607+
u8 tmp, iphc0, iphc1, *hc_ptr;
608608
struct ipv6hdr *hdr;
609609
u8 head[100] = {};
610610

611611
if (type != ETH_P_IPV6)
612612
return -EINVAL;
613613

614614
hdr = ipv6_hdr(skb);
615-
hc06_ptr = head + 2;
615+
hc_ptr = head + 2;
616616

617617
pr_debug("IPv6 header dump:\n\tversion = %d\n\tlength = %d\n"
618618
"\tnexthdr = 0x%02x\n\thop_lim = %d\n\tdest = %pI6c\n",
@@ -649,7 +649,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
649649
* class depends on the presence of version and flow label
650650
*/
651651

652-
/* hc06 format of TC is ECN | DSCP , original one is DSCP | ECN */
652+
/* hc format of TC is ECN | DSCP , original one is DSCP | ECN */
653653
tmp = (hdr->priority << 4) | (hdr->flow_lbl[0] >> 4);
654654
tmp = ((tmp & 0x03) << 6) | (tmp >> 2);
655655

@@ -663,24 +663,24 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
663663
iphc0 |= LOWPAN_IPHC_TC_C;
664664
} else {
665665
/* compress only the flow label */
666-
*hc06_ptr = tmp;
667-
hc06_ptr += 1;
666+
*hc_ptr = tmp;
667+
hc_ptr += 1;
668668
}
669669
} else {
670670
/* Flow label cannot be compressed */
671671
if ((hdr->priority == 0) &&
672672
((hdr->flow_lbl[0] & 0xF0) == 0)) {
673673
/* compress only traffic class */
674674
iphc0 |= LOWPAN_IPHC_TC_C;
675-
*hc06_ptr = (tmp & 0xc0) | (hdr->flow_lbl[0] & 0x0F);
676-
memcpy(hc06_ptr + 1, &hdr->flow_lbl[1], 2);
677-
hc06_ptr += 3;
675+
*hc_ptr = (tmp & 0xc0) | (hdr->flow_lbl[0] & 0x0F);
676+
memcpy(hc_ptr + 1, &hdr->flow_lbl[1], 2);
677+
hc_ptr += 3;
678678
} else {
679679
/* compress nothing */
680-
memcpy(hc06_ptr, hdr, 4);
680+
memcpy(hc_ptr, hdr, 4);
681681
/* replace the top byte with new ECN | DSCP format */
682-
*hc06_ptr = tmp;
683-
hc06_ptr += 4;
682+
*hc_ptr = tmp;
683+
hc_ptr += 4;
684684
}
685685
}
686686

@@ -691,8 +691,8 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
691691
iphc0 |= LOWPAN_IPHC_NH_C;
692692

693693
if ((iphc0 & LOWPAN_IPHC_NH_C) == 0) {
694-
*hc06_ptr = hdr->nexthdr;
695-
hc06_ptr += 1;
694+
*hc_ptr = hdr->nexthdr;
695+
hc_ptr += 1;
696696
}
697697

698698
/*
@@ -713,8 +713,8 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
713713
iphc0 |= LOWPAN_IPHC_TTL_255;
714714
break;
715715
default:
716-
*hc06_ptr = hdr->hop_limit;
717-
hc06_ptr += 1;
716+
*hc_ptr = hdr->hop_limit;
717+
hc_ptr += 1;
718718
break;
719719
}
720720

@@ -724,14 +724,14 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
724724
iphc1 |= LOWPAN_IPHC_SAC;
725725
/* TODO: context lookup */
726726
} else if (is_addr_link_local(&hdr->saddr)) {
727-
iphc1 |= lowpan_compress_addr_64(&hc06_ptr,
727+
iphc1 |= lowpan_compress_addr_64(&hc_ptr,
728728
LOWPAN_IPHC_SAM_BIT, &hdr->saddr, _saddr);
729729
pr_debug("source address unicast link-local %pI6c "
730730
"iphc1 0x%02x\n", &hdr->saddr, iphc1);
731731
} else {
732732
pr_debug("send the full source address\n");
733-
memcpy(hc06_ptr, &hdr->saddr.s6_addr16[0], 16);
734-
hc06_ptr += 16;
733+
memcpy(hc_ptr, &hdr->saddr.s6_addr16[0], 16);
734+
hc_ptr += 16;
735735
}
736736

737737
/* destination address compression */
@@ -742,55 +742,55 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
742742
pr_debug("compressed to 1 octet\n");
743743
iphc1 |= LOWPAN_IPHC_DAM_11;
744744
/* use last byte */
745-
*hc06_ptr = hdr->daddr.s6_addr[15];
746-
hc06_ptr += 1;
745+
*hc_ptr = hdr->daddr.s6_addr[15];
746+
hc_ptr += 1;
747747
} else if (lowpan_is_mcast_addr_compressable32(&hdr->daddr)) {
748748
pr_debug("compressed to 4 octets\n");
749749
iphc1 |= LOWPAN_IPHC_DAM_10;
750750
/* second byte + the last three */
751-
*hc06_ptr = hdr->daddr.s6_addr[1];
752-
memcpy(hc06_ptr + 1, &hdr->daddr.s6_addr[13], 3);
753-
hc06_ptr += 4;
751+
*hc_ptr = hdr->daddr.s6_addr[1];
752+
memcpy(hc_ptr + 1, &hdr->daddr.s6_addr[13], 3);
753+
hc_ptr += 4;
754754
} else if (lowpan_is_mcast_addr_compressable48(&hdr->daddr)) {
755755
pr_debug("compressed to 6 octets\n");
756756
iphc1 |= LOWPAN_IPHC_DAM_01;
757757
/* second byte + the last five */
758-
*hc06_ptr = hdr->daddr.s6_addr[1];
759-
memcpy(hc06_ptr + 1, &hdr->daddr.s6_addr[11], 5);
760-
hc06_ptr += 6;
758+
*hc_ptr = hdr->daddr.s6_addr[1];
759+
memcpy(hc_ptr + 1, &hdr->daddr.s6_addr[11], 5);
760+
hc_ptr += 6;
761761
} else {
762762
pr_debug("using full address\n");
763763
iphc1 |= LOWPAN_IPHC_DAM_00;
764-
memcpy(hc06_ptr, &hdr->daddr.s6_addr[0], 16);
765-
hc06_ptr += 16;
764+
memcpy(hc_ptr, &hdr->daddr.s6_addr[0], 16);
765+
hc_ptr += 16;
766766
}
767767
} else {
768768
/* TODO: context lookup */
769769
if (is_addr_link_local(&hdr->daddr)) {
770-
iphc1 |= lowpan_compress_addr_64(&hc06_ptr,
770+
iphc1 |= lowpan_compress_addr_64(&hc_ptr,
771771
LOWPAN_IPHC_DAM_BIT, &hdr->daddr, _daddr);
772772
pr_debug("dest address unicast link-local %pI6c "
773773
"iphc1 0x%02x\n", &hdr->daddr, iphc1);
774774
} else {
775775
pr_debug("dest address unicast %pI6c\n", &hdr->daddr);
776-
memcpy(hc06_ptr, &hdr->daddr.s6_addr16[0], 16);
777-
hc06_ptr += 16;
776+
memcpy(hc_ptr, &hdr->daddr.s6_addr16[0], 16);
777+
hc_ptr += 16;
778778
}
779779
}
780780

781781
/* UDP header compression */
782782
if (hdr->nexthdr == UIP_PROTO_UDP)
783-
compress_udp_header(&hc06_ptr, skb);
783+
compress_udp_header(&hc_ptr, skb);
784784

785785
head[0] = iphc0;
786786
head[1] = iphc1;
787787

788788
skb_pull(skb, sizeof(struct ipv6hdr));
789789
skb_reset_transport_header(skb);
790-
memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head);
790+
memcpy(skb_push(skb, hc_ptr - head), head, hc_ptr - head);
791791
skb_reset_network_header(skb);
792792

793-
pr_debug("header len %d skb %u\n", (int)(hc06_ptr - head), skb->len);
793+
pr_debug("header len %d skb %u\n", (int)(hc_ptr - head), skb->len);
794794

795795
raw_dump_table(__func__, "raw skb data dump compressed",
796796
skb->data, skb->len);

0 commit comments

Comments
 (0)