Lines Matching refs:nh

315 		    const struct nshhdr *nh)  in push_nsh()  argument
319 err = nsh_push(skb, nh); in push_nsh()
346 static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh, in update_ip_l4_checksum() argument
351 if (nh->frag_off & htons(IP_OFFSET)) in update_ip_l4_checksum()
354 if (nh->protocol == IPPROTO_TCP) { in update_ip_l4_checksum()
358 } else if (nh->protocol == IPPROTO_UDP) { in update_ip_l4_checksum()
372 static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, in set_ip_addr() argument
375 update_ip_l4_checksum(skb, nh, *addr, new_addr); in set_ip_addr()
376 csum_replace4(&nh->check, *addr, new_addr); in set_ip_addr()
430 static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) in set_ipv6_dsfield() argument
432 u8 old_ipv6_tclass = ipv6_get_dsfield(nh); in set_ipv6_dsfield()
440 ipv6_change_dsfield(nh, ~mask, ipv6_tclass); in set_ipv6_dsfield()
443 static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) in set_ipv6_fl() argument
447 ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; in set_ipv6_fl()
451 nh->flow_lbl[0] = (u8)(fl >> 16); in set_ipv6_fl()
452 nh->flow_lbl[1] = (u8)(fl >> 8); in set_ipv6_fl()
453 nh->flow_lbl[2] = (u8)fl; in set_ipv6_fl()
459 static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) in set_ipv6_ttl() argument
461 new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); in set_ipv6_ttl()
464 csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), in set_ipv6_ttl()
466 nh->hop_limit = new_ttl; in set_ipv6_ttl()
469 static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, in set_ip_ttl() argument
472 new_ttl = OVS_MASKED(nh->ttl, new_ttl, mask); in set_ip_ttl()
474 csum_replace2(&nh->check, htons(nh->ttl << 8), htons(new_ttl << 8)); in set_ip_ttl()
475 nh->ttl = new_ttl; in set_ip_ttl()
482 struct iphdr *nh; in set_ipv4() local
491 nh = ip_hdr(skb); in set_ipv4()
498 new_addr = OVS_MASKED(nh->saddr, key->ipv4_src, mask->ipv4_src); in set_ipv4()
500 if (unlikely(new_addr != nh->saddr)) { in set_ipv4()
501 set_ip_addr(skb, nh, &nh->saddr, new_addr); in set_ipv4()
506 new_addr = OVS_MASKED(nh->daddr, key->ipv4_dst, mask->ipv4_dst); in set_ipv4()
508 if (unlikely(new_addr != nh->daddr)) { in set_ipv4()
509 set_ip_addr(skb, nh, &nh->daddr, new_addr); in set_ipv4()
514 ipv4_change_dsfield(nh, ~mask->ipv4_tos, key->ipv4_tos); in set_ipv4()
515 flow_key->ip.tos = nh->tos; in set_ipv4()
518 set_ip_ttl(skb, nh, key->ipv4_ttl, mask->ipv4_ttl); in set_ipv4()
519 flow_key->ip.ttl = nh->ttl; in set_ipv4()
534 struct ipv6hdr *nh; in set_ipv6() local
542 nh = ipv6_hdr(skb); in set_ipv6()
549 __be32 *saddr = (__be32 *)&nh->saddr; in set_ipv6()
565 __be32 *daddr = (__be32 *)&nh->daddr; in set_ipv6()
571 if (ipv6_ext_hdr(nh->nexthdr)) in set_ipv6()
584 set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); in set_ipv6()
585 flow_key->ip.tos = ipv6_get_dsfield(nh); in set_ipv6()
588 set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), in set_ipv6()
591 *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); in set_ipv6()
594 set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); in set_ipv6()
595 flow_key->ip.ttl = nh->hop_limit; in set_ipv6()
603 struct nshhdr *nh; in set_nsh() local
621 nh = nsh_hdr(skb); in set_nsh()
622 length = nsh_hdr_len(nh); in set_nsh()
630 nh = nsh_hdr(skb); in set_nsh()
631 skb_postpull_rcsum(skb, nh, length); in set_nsh()
632 flags = nsh_get_flags(nh); in set_nsh()
635 ttl = nsh_get_ttl(nh); in set_nsh()
638 nsh_set_flags_and_ttl(nh, flags, ttl); in set_nsh()
639 nh->path_hdr = OVS_MASKED(nh->path_hdr, key.base.path_hdr, in set_nsh()
641 flow_key->nsh.base.path_hdr = nh->path_hdr; in set_nsh()
642 switch (nh->mdtype) { in set_nsh()
645 nh->md1.context[i] = in set_nsh()
646 OVS_MASKED(nh->md1.context[i], key.context[i], in set_nsh()
649 memcpy(flow_key->nsh.context, nh->md1.context, in set_nsh()
650 sizeof(nh->md1.context)); in set_nsh()
659 skb_postpush_rcsum(skb, nh, length); in set_nsh()
1255 struct ipv6hdr *nh; in execute_dec_ttl() local
1258 sizeof(*nh)); in execute_dec_ttl()
1262 nh = ipv6_hdr(skb); in execute_dec_ttl()
1264 if (nh->hop_limit <= 1) in execute_dec_ttl()
1267 key->ip.ttl = --nh->hop_limit; in execute_dec_ttl()
1269 struct iphdr *nh; in execute_dec_ttl() local
1273 sizeof(*nh)); in execute_dec_ttl()
1277 nh = ip_hdr(skb); in execute_dec_ttl()
1278 if (nh->ttl <= 1) in execute_dec_ttl()
1281 old_ttl = nh->ttl--; in execute_dec_ttl()
1282 csum_replace2(&nh->check, htons(old_ttl << 8), in execute_dec_ttl()
1283 htons(nh->ttl << 8)); in execute_dec_ttl()
1284 key->ip.ttl = nh->ttl; in execute_dec_ttl()
1444 struct nshhdr *nh = (struct nshhdr *)buffer; in do_execute_actions() local
1446 err = nsh_hdr_from_nlattr(nla_data(a), nh, in do_execute_actions()
1450 err = push_nsh(skb, key, nh); in do_execute_actions()