srh 60 include/net/seg6.h extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len); srh 50 include/net/seg6_hmac.h struct ipv6_sr_hdr *srh); srh 22 include/net/seg6_local.h struct ipv6_sr_hdr *srh; srh 47 include/uapi/linux/seg6.h #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) srh 29 include/uapi/linux/seg6_iptunnel.h struct ipv6_sr_hdr srh[0]; srh 32 include/uapi/linux/seg6_iptunnel.h #define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) srh 56 include/uapi/linux/seg6_iptunnel.h return ((tuninfo->srh->hdrlen + 1) << 3) + head; srh 4924 net/core/filter.c struct ipv6_sr_hdr *srh = (struct ipv6_sr_hdr *)hdr; srh 4926 net/core/filter.c if (!seg6_validate_srh(srh, len)) srh 4934 net/core/filter.c err = seg6_do_srh_inline(skb, srh); srh 4939 net/core/filter.c err = seg6_do_srh_encap(skb, srh, IPPROTO_IPV6); srh 5021 net/core/filter.c struct ipv6_sr_hdr *srh = srh_state->srh; srh 5025 net/core/filter.c if (srh == NULL) srh 5028 net/core/filter.c srh_tlvs = (void *)((char *)srh + ((srh->first_segment + 1) << 4)); srh 5029 net/core/filter.c srh_end = (void *)((char *)srh + sizeof(*srh) + srh_state->hdrlen); srh 5034 net/core/filter.c else if (ptr < (void *)&srh->flags || srh 5035 net/core/filter.c ptr + len > (void *)&srh->segments) srh 5042 net/core/filter.c srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); srh 5065 net/core/filter.c srh_state->srh = NULL; srh 5067 net/core/filter.c srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); srh 5068 net/core/filter.c srh_state->hdrlen = srh_state->srh->hdrlen << 3; srh 5114 net/core/filter.c if (srh_state->srh && !seg6_bpf_has_valid_srh(skb)) srh 5123 net/core/filter.c if (srh_state->srh && !seg6_bpf_has_valid_srh(skb)) srh 5151 net/core/filter.c struct ipv6_sr_hdr *srh = srh_state->srh; srh 5157 net/core/filter.c if (unlikely(srh == NULL)) srh 5160 net/core/filter.c srh_tlvs = (void *)((unsigned char *)srh + sizeof(*srh) + srh 5161 net/core/filter.c ((srh->first_segment + 1) << 4)); srh 5162 net/core/filter.c srh_end = (void *)((unsigned char *)srh + sizeof(*srh) + srh 5190 net/core/filter.c srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); srh 1157 net/ipv6/exthdrs.c struct ipv6_sr_hdr *srh = (struct ipv6_sr_hdr *)opt->srcrt; srh 1159 net/ipv6/exthdrs.c fl6->daddr = srh->segments[srh->segments_left]; srh 458 net/ipv6/ipv6_sockglue.c struct ipv6_sr_hdr *srh = (struct ipv6_sr_hdr *) srh 461 net/ipv6/ipv6_sockglue.c if (!seg6_validate_srh(srh, optlen)) srh 27 net/ipv6/netfilter/ip6t_srh.c struct ipv6_sr_hdr *srh; srh 33 net/ipv6/netfilter/ip6t_srh.c srh = skb_header_pointer(skb, srhoff, sizeof(_srh), &_srh); srh 34 net/ipv6/netfilter/ip6t_srh.c if (!srh) srh 37 net/ipv6/netfilter/ip6t_srh.c hdrlen = ipv6_optlen(srh); srh 41 net/ipv6/netfilter/ip6t_srh.c if (srh->type != IPV6_SRCRT_TYPE_4) srh 44 net/ipv6/netfilter/ip6t_srh.c if (srh->segments_left > srh->first_segment) srh 50 net/ipv6/netfilter/ip6t_srh.c !(srh->nexthdr == srhinfo->next_hdr))) srh 56 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen == srhinfo->hdr_len))) srh 61 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen > srhinfo->hdr_len))) srh 66 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen < srhinfo->hdr_len))) srh 72 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left == srhinfo->segs_left))) srh 77 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left > srhinfo->segs_left))) srh 82 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left < srhinfo->segs_left))) srh 92 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment == srhinfo->last_entry))) srh 97 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment > srhinfo->last_entry))) srh 102 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment < srhinfo->last_entry))) srh 111 net/ipv6/netfilter/ip6t_srh.c !(srh->tag == srhinfo->tag))) srh 122 net/ipv6/netfilter/ip6t_srh.c struct ipv6_sr_hdr *srh; srh 127 net/ipv6/netfilter/ip6t_srh.c srh = skb_header_pointer(skb, srhoff, sizeof(_srh), &_srh); srh 128 net/ipv6/netfilter/ip6t_srh.c if (!srh) srh 131 net/ipv6/netfilter/ip6t_srh.c hdrlen = ipv6_optlen(srh); srh 135 net/ipv6/netfilter/ip6t_srh.c if (srh->type != IPV6_SRCRT_TYPE_4) srh 138 net/ipv6/netfilter/ip6t_srh.c if (srh->segments_left > srh->first_segment) srh 144 net/ipv6/netfilter/ip6t_srh.c !(srh->nexthdr == srhinfo->next_hdr))) srh 150 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen == srhinfo->hdr_len))) srh 154 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen > srhinfo->hdr_len))) srh 158 net/ipv6/netfilter/ip6t_srh.c !(srh->hdrlen < srhinfo->hdr_len))) srh 164 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left == srhinfo->segs_left))) srh 168 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left > srhinfo->segs_left))) srh 172 net/ipv6/netfilter/ip6t_srh.c !(srh->segments_left < srhinfo->segs_left))) srh 182 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment == srhinfo->last_entry))) srh 186 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment > srhinfo->last_entry))) srh 190 net/ipv6/netfilter/ip6t_srh.c !(srh->first_segment < srhinfo->last_entry))) srh 199 net/ipv6/netfilter/ip6t_srh.c !(srh->tag == srhinfo->tag))) srh 204 net/ipv6/netfilter/ip6t_srh.c if (srh->segments_left == srh->first_segment) srh 207 net/ipv6/netfilter/ip6t_srh.c ((srh->segments_left + 1) * sizeof(struct in6_addr)); srh 219 net/ipv6/netfilter/ip6t_srh.c if (srh->segments_left == 0) srh 222 net/ipv6/netfilter/ip6t_srh.c ((srh->segments_left - 1) * sizeof(struct in6_addr)); srh 28 net/ipv6/seg6.c bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len) srh 33 net/ipv6/seg6.c if (srh->type != IPV6_SRCRT_TYPE_4) srh 36 net/ipv6/seg6.c if (((srh->hdrlen + 1) << 3) != len) srh 39 net/ipv6/seg6.c if (srh->segments_left > srh->first_segment) srh 42 net/ipv6/seg6.c tlv_offset = sizeof(*srh) + ((srh->first_segment + 1) << 4); srh 55 net/ipv6/seg6.c tlv = (struct sr6_tlv *)((unsigned char *)srh + tlv_offset); srh 86 net/ipv6/seg6_hmac.c static struct sr6_tlv_hmac *seg6_get_tlv_hmac(struct ipv6_sr_hdr *srh) srh 90 net/ipv6/seg6_hmac.c if (srh->hdrlen < (srh->first_segment + 1) * 2 + 5) srh 93 net/ipv6/seg6_hmac.c if (!sr_has_hmac(srh)) srh 97 net/ipv6/seg6_hmac.c ((char *)srh + ((srh->hdrlen + 1) << 3) - 40); srh 244 net/ipv6/seg6_hmac.c struct ipv6_sr_hdr *srh; srh 249 net/ipv6/seg6_hmac.c srh = (struct ipv6_sr_hdr *)skb_transport_header(skb); srh 251 net/ipv6/seg6_hmac.c tlv = seg6_get_tlv_hmac(srh); srh 271 net/ipv6/seg6_hmac.c if (seg6_hmac_compute(hinfo, srh, &ipv6_hdr(skb)->saddr, hmac_output)) srh 328 net/ipv6/seg6_hmac.c struct ipv6_sr_hdr *srh) srh 334 net/ipv6/seg6_hmac.c tlv = seg6_get_tlv_hmac(srh); srh 345 net/ipv6/seg6_hmac.c err = seg6_hmac_compute(hinfo, srh, saddr, tlv->hmac); srh 237 net/ipv6/seg6_iptunnel.c err = seg6_do_srh_inline(skb, tinfo->srh); srh 253 net/ipv6/seg6_iptunnel.c err = seg6_do_srh_encap(skb, tinfo->srh, proto); srh 271 net/ipv6/seg6_iptunnel.c err = seg6_do_srh_encap(skb, tinfo->srh, NEXTHDR_NONE); srh 429 net/ipv6/seg6_iptunnel.c if (!seg6_validate_srh(tuninfo->srh, tuninfo_len - sizeof(*tuninfo))) srh 50 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 69 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 75 net/ipv6/seg6_local.c if (!pskb_may_pull(skb, srhoff + sizeof(*srh))) srh 78 net/ipv6/seg6_local.c srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); srh 80 net/ipv6/seg6_local.c len = (srh->hdrlen + 1) << 3; srh 88 net/ipv6/seg6_local.c srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); srh 90 net/ipv6/seg6_local.c if (!seg6_validate_srh(srh, len)) srh 93 net/ipv6/seg6_local.c return srh; srh 98 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 100 net/ipv6/seg6_local.c srh = get_srh(skb); srh 101 net/ipv6/seg6_local.c if (!srh) srh 104 net/ipv6/seg6_local.c if (srh->segments_left == 0) srh 112 net/ipv6/seg6_local.c return srh; srh 117 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 120 net/ipv6/seg6_local.c srh = get_srh(skb); srh 121 net/ipv6/seg6_local.c if (srh && srh->segments_left > 0) srh 125 net/ipv6/seg6_local.c if (srh && !seg6_hmac_validate_skb(skb)) srh 145 net/ipv6/seg6_local.c static void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr) srh 149 net/ipv6/seg6_local.c srh->segments_left--; srh 150 net/ipv6/seg6_local.c addr = srh->segments + srh->segments_left; srh 207 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 209 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 210 net/ipv6/seg6_local.c if (!srh) srh 213 net/ipv6/seg6_local.c advance_nextseg(srh, &ipv6_hdr(skb)->daddr); srh 227 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 229 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 230 net/ipv6/seg6_local.c if (!srh) srh 233 net/ipv6/seg6_local.c advance_nextseg(srh, &ipv6_hdr(skb)->daddr); srh 246 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 248 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 249 net/ipv6/seg6_local.c if (!srh) srh 252 net/ipv6/seg6_local.c advance_nextseg(srh, &ipv6_hdr(skb)->daddr); srh 413 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 416 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 417 net/ipv6/seg6_local.c if (!srh) srh 420 net/ipv6/seg6_local.c err = seg6_do_srh_inline(skb, slwt->srh); srh 440 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 443 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 444 net/ipv6/seg6_local.c if (!srh) srh 447 net/ipv6/seg6_local.c advance_nextseg(srh, &ipv6_hdr(skb)->daddr); srh 452 net/ipv6/seg6_local.c err = seg6_do_srh_encap(skb, slwt->srh, IPPROTO_IPV6); srh 474 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh = srh_state->srh; srh 476 net/ipv6/seg6_local.c if (unlikely(srh == NULL)) srh 483 net/ipv6/seg6_local.c srh->hdrlen = (u8)(srh_state->hdrlen >> 3); srh 484 net/ipv6/seg6_local.c if (!seg6_validate_srh(srh, (srh->hdrlen + 1) << 3)) srh 498 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 501 net/ipv6/seg6_local.c srh = get_and_validate_srh(skb); srh 502 net/ipv6/seg6_local.c if (!srh) { srh 506 net/ipv6/seg6_local.c advance_nextseg(srh, &ipv6_hdr(skb)->daddr); srh 512 net/ipv6/seg6_local.c srh_state->srh = srh; srh 513 net/ipv6/seg6_local.c srh_state->hdrlen = srh->hdrlen << 3; srh 532 net/ipv6/seg6_local.c if (srh_state->srh && !seg6_bpf_has_valid_srh(skb)) srh 649 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 652 net/ipv6/seg6_local.c srh = nla_data(attrs[SEG6_LOCAL_SRH]); srh 656 net/ipv6/seg6_local.c if (len < sizeof(*srh) + sizeof(struct in6_addr)) srh 659 net/ipv6/seg6_local.c if (!seg6_validate_srh(srh, len)) srh 662 net/ipv6/seg6_local.c slwt->srh = kmemdup(srh, len, GFP_KERNEL); srh 663 net/ipv6/seg6_local.c if (!slwt->srh) srh 673 net/ipv6/seg6_local.c struct ipv6_sr_hdr *srh; srh 677 net/ipv6/seg6_local.c srh = slwt->srh; srh 678 net/ipv6/seg6_local.c len = (srh->hdrlen + 1) << 3; srh 684 net/ipv6/seg6_local.c memcpy(nla_data(nla), srh, len); srh 691 net/ipv6/seg6_local.c int len = (a->srh->hdrlen + 1) << 3; srh 693 net/ipv6/seg6_local.c if (len != ((b->srh->hdrlen + 1) << 3)) srh 696 net/ipv6/seg6_local.c return memcmp(a->srh, b->srh, len); srh 1000 net/ipv6/seg6_local.c kfree(slwt->srh); srh 1009 net/ipv6/seg6_local.c kfree(slwt->srh); srh 1052 net/ipv6/seg6_local.c nlsize += nla_total_size((slwt->srh->hdrlen + 1) << 3); srh 47 tools/include/uapi/linux/seg6.h #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) srh 56 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c struct ip6_srh_t *srh; srh 77 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh = cursor_advance(cursor, sizeof(*srh)); srh 78 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if ((void *)srh + sizeof(*srh) > data_end) srh 81 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->type != 4) srh 84 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c return srh; srh 118 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh, srh 126 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh_off = (char *)srh - (char *)(long)skb->data; srh 128 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c cur_off = srh_off + sizeof(*srh) + srh 129 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c sizeof(struct ip6_addr_t) * (srh->first_segment + 1); srh 141 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (cur_off >= srh_off + ((srh->hdrlen + 1) << 3)) srh 177 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off, srh 180 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c uint32_t srh_off = (char *)srh - (char *)(long)skb->data; srh 193 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c err = is_valid_tlv_boundary(skb, srh, &tlv_off, &pad_size, &pad_off); srh 221 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c int delete_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, srh 224 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c uint32_t srh_off = (char *)srh - (char *)(long)skb->data; srh 234 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c err = is_valid_tlv_boundary(skb, srh, &tlv_off, &pad_size, &pad_off); srh 259 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c int has_egr_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh) srh 262 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c ((srh->first_segment + 1) << 4); srh 290 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c struct ip6_srh_t *srh; srh 294 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh = (struct ip6_srh_t *)srh_buf; srh 295 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->nexthdr = 0; srh 296 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->hdrlen = 8; srh 297 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->type = 4; srh 298 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->segments_left = 3; srh 299 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->first_segment = 3; srh 300 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->flags = 0; srh 301 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c srh->tag = 0; srh 303 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c seg = (struct ip6_addr_t *)((char *)srh + sizeof(*srh)); srh 312 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c err = bpf_lwt_push_encap(skb, 0, (void *)srh, sizeof(srh_buf)); srh 326 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c struct ip6_srh_t *srh = get_srh(skb); srh 331 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh == NULL) srh 337 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c err = add_tlv(skb, srh, (srh->hdrlen+1) << 3, srh 362 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c struct ip6_srh_t *srh = get_srh(skb); srh 367 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh == NULL) srh 370 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->flags != SR6_FLAG_ALERT) srh 373 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->hdrlen != 11) // 4 segments + Egress TLV + Padding TLV srh 376 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (!has_egr_tlv(skb, srh)) srh 379 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c err = delete_tlv(skb, srh, 8 + (srh->first_segment + 1) * 16); srh 401 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c struct ip6_srh_t *srh = get_srh(skb); srh 405 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh == NULL) srh 408 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->flags != 0) srh 411 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->tag != bpf_htons(2442)) srh 414 tools/testing/selftests/bpf/progs/test_lwt_seg6local.c if (srh->hdrlen != 8) // 4 segments srh 56 tools/testing/selftests/bpf/progs/test_seg6_loop.c struct ip6_srh_t *srh; srh 77 tools/testing/selftests/bpf/progs/test_seg6_loop.c srh = cursor_advance(cursor, sizeof(*srh)); srh 78 tools/testing/selftests/bpf/progs/test_seg6_loop.c if ((void *)srh + sizeof(*srh) > data_end) srh 81 tools/testing/selftests/bpf/progs/test_seg6_loop.c if (srh->type != 4) srh 84 tools/testing/selftests/bpf/progs/test_seg6_loop.c return srh; srh 118 tools/testing/selftests/bpf/progs/test_seg6_loop.c struct ip6_srh_t *srh, srh 127 tools/testing/selftests/bpf/progs/test_seg6_loop.c srh_off = (char *)srh - (char *)(long)skb->data; srh 129 tools/testing/selftests/bpf/progs/test_seg6_loop.c cur_off = srh_off + sizeof(*srh) + srh 130 tools/testing/selftests/bpf/progs/test_seg6_loop.c sizeof(struct ip6_addr_t) * (srh->first_segment + 1); srh 144 tools/testing/selftests/bpf/progs/test_seg6_loop.c if (cur_off >= srh_off + ((srh->hdrlen + 1) << 3)) srh 180 tools/testing/selftests/bpf/progs/test_seg6_loop.c struct ip6_srh_t *srh, uint32_t tlv_off, srh 183 tools/testing/selftests/bpf/progs/test_seg6_loop.c uint32_t srh_off = (char *)srh - (char *)(long)skb->data; srh 196 tools/testing/selftests/bpf/progs/test_seg6_loop.c err = is_valid_tlv_boundary(skb, srh, &tlv_off, &pad_size, &pad_off); srh 230 tools/testing/selftests/bpf/progs/test_seg6_loop.c struct ip6_srh_t *srh = get_srh(skb); srh 235 tools/testing/selftests/bpf/progs/test_seg6_loop.c if (srh == NULL) srh 241 tools/testing/selftests/bpf/progs/test_seg6_loop.c err = add_tlv(skb, srh, (srh->hdrlen+1) << 3,