Lines Matching refs:ipv6

268 static uint8_t *compress_tfl(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr,  in compress_tfl()  argument
273 tcl = ((ipv6->vtc & 0x0F) << 4) | ((ipv6->tcflow & 0xF0) >> 4); in compress_tfl()
276 if (((ipv6->tcflow & 0x0F) == 0U) && (ipv6->flow == 0U)) { in compress_tfl()
277 if (((ipv6->vtc & 0x0F) == 0U) && ((ipv6->tcflow & 0xF0) == 0U)) { in compress_tfl()
292 if (((ipv6->vtc & 0x0F) == 0U) && (ipv6->tcflow & 0x30)) { in compress_tfl()
298 inline_ptr -= sizeof(ipv6->flow); in compress_tfl()
299 memmove(inline_ptr, &ipv6->flow, sizeof(ipv6->flow)); in compress_tfl()
302 *inline_ptr = (tcl & 0xC0) | (ipv6->tcflow & 0x0F); in compress_tfl()
309 inline_ptr -= sizeof(ipv6->flow); in compress_tfl()
310 memmove(inline_ptr, &ipv6->flow, sizeof(ipv6->flow)); in compress_tfl()
313 *inline_ptr = ipv6->tcflow & 0x0F; in compress_tfl()
323 static uint8_t *compress_hoplimit(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in compress_hoplimit() argument
327 switch (ipv6->hop_limit) { in compress_hoplimit()
341 inline_ptr -= sizeof(ipv6->hop_limit); in compress_hoplimit()
342 *inline_ptr = ipv6->hop_limit; in compress_hoplimit()
350 static uint8_t *compress_nh(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in compress_nh() argument
354 if (ipv6->nexthdr == IPPROTO_UDP) { in compress_nh()
357 inline_ptr -= sizeof(ipv6->nexthdr); in compress_nh()
358 *inline_ptr = ipv6->nexthdr; in compress_nh()
365 static uint8_t *compress_sa(struct net_ipv6_hdr *ipv6, struct net_pkt *pkt, in compress_sa() argument
371 if (net_ipv6_addr_based_on_ll((struct in6_addr *)ipv6->src, in compress_sa()
380 if (net_6lo_addr_16_bit_compressible((struct in6_addr *)ipv6->src)) { in compress_sa()
385 memmove(inline_ptr, &ipv6->src[14], sizeof(uint16_t)); in compress_sa()
395 memmove(inline_ptr, &ipv6->src[8], 8U); in compress_sa()
400 static uint8_t *set_sa_inline(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in set_sa_inline() argument
405 memmove(inline_ptr, &ipv6->src[0], 16U); in set_sa_inline()
410 static uint8_t *compress_sa_ctx(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in compress_sa_ctx() argument
419 if (net_ipv6_addr_based_on_ll((struct in6_addr *)ipv6->src, in compress_sa_ctx()
429 if (net_6lo_addr_16_bit_compressible((struct in6_addr *)ipv6->src)) { in compress_sa_ctx()
435 memmove(inline_ptr, &ipv6->src[14], sizeof(uint16_t)); in compress_sa_ctx()
445 memmove(inline_ptr, &ipv6->src[8], 8U); in compress_sa_ctx()
452 static uint8_t *compress_da_mcast(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in compress_da_mcast() argument
459 if (net_6lo_maddr_8_bit_compressible((struct in6_addr *)ipv6->dst)) { in compress_da_mcast()
466 memmove(inline_ptr, &ipv6->dst[15], sizeof(uint8_t)); in compress_da_mcast()
471 if (net_6lo_maddr_32_bit_compressible((struct in6_addr *)ipv6->dst)) { in compress_da_mcast()
478 memmove(inline_ptr, &ipv6->dst[13], 3U); in compress_da_mcast()
481 memmove(inline_ptr, &ipv6->dst[1], sizeof(uint8_t)); in compress_da_mcast()
486 if (net_6lo_maddr_48_bit_compressible((struct in6_addr *)ipv6->dst)) { in compress_da_mcast()
493 memmove(inline_ptr, &ipv6->dst[11], 5U); in compress_da_mcast()
496 memmove(inline_ptr, &ipv6->dst[1], sizeof(uint8_t)); in compress_da_mcast()
505 memmove(inline_ptr, &ipv6->dst[0], 16U); in compress_da_mcast()
510 static uint8_t *compress_da(struct net_ipv6_hdr *ipv6, struct net_pkt *pkt, in compress_da() argument
516 if (net_ipv6_addr_based_on_ll((struct in6_addr *)ipv6->dst, in compress_da()
525 if (net_6lo_addr_16_bit_compressible((struct in6_addr *)ipv6->dst)) { in compress_da()
531 memmove(inline_ptr, &ipv6->dst[14], sizeof(uint16_t)); in compress_da()
541 memmove(inline_ptr, &ipv6->dst[8], 8U); in compress_da()
546 static uint8_t *set_da_inline(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in set_da_inline() argument
551 memmove(inline_ptr, &ipv6->dst[0], 16U); in set_da_inline()
556 static uint8_t *compress_da_ctx(struct net_ipv6_hdr *ipv6, uint8_t *inline_ptr, in compress_da_ctx() argument
562 if (net_ipv6_addr_based_on_ll((struct in6_addr *)ipv6->dst, in compress_da_ctx()
571 if (net_6lo_addr_16_bit_compressible((struct in6_addr *)ipv6->dst)) { in compress_da_ctx()
576 memmove(inline_ptr, &ipv6->dst[14], sizeof(uint16_t)); in compress_da_ctx()
586 memmove(inline_ptr, &ipv6->dst[8], 8U); in compress_da_ctx()
690 struct net_ipv6_hdr *ipv6) in get_src_addr_ctx() argument
696 (struct in6_addr *)ipv6->src); in get_src_addr_ctx()
705 struct net_ipv6_hdr *ipv6) in get_dst_addr_ctx() argument
711 (struct in6_addr *)ipv6->dst); in get_dst_addr_ctx()
736 struct net_ipv6_hdr *ipv6 = NET_IPV6_HDR(pkt); in compress_IPHC_header() local
746 if (ipv6->nexthdr == IPPROTO_UDP && in compress_IPHC_header()
755 if (ipv6->nexthdr == IPPROTO_UDP) { in compress_IPHC_header()
762 if (net_6lo_ll_prefix_padded_with_zeros((struct in6_addr *)ipv6->dst)) { in compress_IPHC_header()
763 inline_pos = compress_da(ipv6, pkt, inline_pos, &iphc); in compress_IPHC_header()
767 if (net_ipv6_is_addr_mcast((struct in6_addr *)ipv6->dst)) { in compress_IPHC_header()
768 inline_pos = compress_da_mcast(ipv6, inline_pos, &iphc); in compress_IPHC_header()
773 dst_ctx = get_dst_addr_ctx(pkt, ipv6); in compress_IPHC_header()
776 inline_pos = compress_da_ctx(ipv6, inline_pos, pkt, &iphc, in compress_IPHC_header()
781 inline_pos = set_da_inline(ipv6, inline_pos, &iphc); in compress_IPHC_header()
784 if (net_6lo_ll_prefix_padded_with_zeros((struct in6_addr *)ipv6->src)) { in compress_IPHC_header()
785 inline_pos = compress_sa(ipv6, pkt, inline_pos, &iphc); in compress_IPHC_header()
789 if (net_ipv6_is_addr_unspecified((struct in6_addr *)ipv6->src)) { in compress_IPHC_header()
799 src_ctx = get_src_addr_ctx(pkt, ipv6); in compress_IPHC_header()
801 inline_pos = compress_sa_ctx(ipv6, inline_pos, pkt, &iphc, in compress_IPHC_header()
807 inline_pos = set_sa_inline(ipv6, inline_pos, &iphc); in compress_IPHC_header()
810 inline_pos = compress_hoplimit(ipv6, inline_pos, &iphc); in compress_IPHC_header()
811 inline_pos = compress_nh(ipv6, inline_pos, &iphc); in compress_IPHC_header()
812 inline_pos = compress_tfl(ipv6, inline_pos, &iphc); in compress_IPHC_header()
844 struct net_ipv6_hdr *ipv6) in uncompress_tfl() argument
857 ipv6->vtc |= ((tcl & 0xF0) >> 4); in uncompress_tfl()
858 ipv6->tcflow = ((tcl & 0x0F) << 4) | (*cursor & 0x0F); in uncompress_tfl()
861 memmove(&ipv6->flow, cursor, sizeof(ipv6->flow)); in uncompress_tfl()
862 cursor += sizeof(ipv6->flow); in uncompress_tfl()
868 ipv6->tcflow = ((tcl & 0x0F) << 4) | (*cursor & 0x0F); in uncompress_tfl()
871 memmove(&ipv6->flow, cursor, sizeof(ipv6->flow)); in uncompress_tfl()
872 cursor += sizeof(ipv6->flow); in uncompress_tfl()
882 ipv6->vtc |= ((tcl & 0xF0) >> 4); in uncompress_tfl()
883 ipv6->tcflow = (tcl & 0x0F) << 4; in uncompress_tfl()
884 ipv6->flow = 0U; in uncompress_tfl()
890 ipv6->tcflow = 0U; in uncompress_tfl()
891 ipv6->flow = 0U; in uncompress_tfl()
901 struct net_ipv6_hdr *ipv6) in uncompress_hoplimit() argument
905 ipv6->hop_limit = *cursor; in uncompress_hoplimit()
910 ipv6->hop_limit = 1U; in uncompress_hoplimit()
914 ipv6->hop_limit = 64U; in uncompress_hoplimit()
918 ipv6->hop_limit = 255U; in uncompress_hoplimit()
928 struct net_ipv6_hdr *ipv6, in uncompress_sa() argument
935 net_ipv6_addr_copy_raw((uint8_t *)&src_ip, ipv6->src); in uncompress_sa()
981 net_ipv6_addr_copy_raw(ipv6->src, (uint8_t *)&src_ip); in uncompress_sa()
988 struct net_ipv6_hdr *ipv6, in uncompress_sa_ctx() argument
994 net_ipv6_addr_copy_raw((uint8_t *)&src_ip, ipv6->src); in uncompress_sa_ctx()
1042 net_ipv6_addr_copy_raw(ipv6->src, (uint8_t *)&src_ip); in uncompress_sa_ctx()
1050 struct net_ipv6_hdr *ipv6) in uncompress_da_mcast() argument
1056 net_ipv6_addr_copy_raw((uint8_t *)&dst_ip, ipv6->dst); in uncompress_da_mcast()
1127 net_ipv6_addr_copy_raw(ipv6->dst, (uint8_t *)&dst_ip); in uncompress_da_mcast()
1134 struct net_ipv6_hdr *ipv6, in uncompress_da() argument
1141 net_ipv6_addr_copy_raw((uint8_t *)&dst_ip, ipv6->dst); in uncompress_da()
1188 net_ipv6_addr_copy_raw(ipv6->dst, (uint8_t *)&dst_ip); in uncompress_da()
1195 struct net_ipv6_hdr *ipv6, in uncompress_da_ctx() argument
1203 net_ipv6_addr_copy_raw((uint8_t *)&dst_ip, ipv6->dst); in uncompress_da_ctx()
1252 net_ipv6_addr_copy_raw(ipv6->dst, (uint8_t *)&dst_ip); in uncompress_da_ctx()
1353 struct net_ipv6_hdr *ipv6; in uncompress_IPHC_header() local
1413 ipv6 = (struct net_ipv6_hdr *)(frag->data); in uncompress_IPHC_header()
1427 ipv6->vtc = 0x60; in uncompress_IPHC_header()
1431 cursor = uncompress_tfl(iphc, cursor, ipv6); in uncompress_IPHC_header()
1434 ipv6->nexthdr = *cursor; in uncompress_IPHC_header()
1439 cursor = uncompress_hoplimit(iphc, cursor, ipv6); in uncompress_IPHC_header()
1447 memset(&ipv6->src[0], 0, in uncompress_IPHC_header()
1448 sizeof(ipv6->src)); in uncompress_IPHC_header()
1456 cursor = uncompress_sa_ctx(iphc, cursor, ipv6, src, pkt); in uncompress_IPHC_header()
1463 cursor = uncompress_sa(iphc, cursor, ipv6, pkt); in uncompress_IPHC_header()
1475 cursor = uncompress_da_mcast(iphc, cursor, ipv6); in uncompress_IPHC_header()
1485 cursor = uncompress_da_ctx(iphc, cursor, ipv6, dst, pkt); in uncompress_IPHC_header()
1491 cursor = uncompress_da(iphc, cursor, ipv6, pkt); in uncompress_IPHC_header()
1496 ipv6->nexthdr = IPPROTO_UDP; in uncompress_IPHC_header()
1510 ipv6->len = htons(len); in uncompress_IPHC_header()
1512 if (ipv6->nexthdr == IPPROTO_UDP && udp) { in uncompress_IPHC_header()