Lines Matching full:nh

313 		    const struct nshhdr *nh)  in push_nsh()  argument
317 err = nsh_push(skb, nh); in push_nsh()
344 static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh, in update_ip_l4_checksum() argument
349 if (nh->frag_off & htons(IP_OFFSET)) in update_ip_l4_checksum()
352 if (nh->protocol == IPPROTO_TCP) { in update_ip_l4_checksum()
356 } else if (nh->protocol == IPPROTO_UDP) { in update_ip_l4_checksum()
370 static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, in set_ip_addr() argument
373 update_ip_l4_checksum(skb, nh, *addr, new_addr); in set_ip_addr()
374 csum_replace4(&nh->check, *addr, new_addr); in set_ip_addr()
428 static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) in set_ipv6_dsfield() argument
430 u8 old_ipv6_tclass = ipv6_get_dsfield(nh); in set_ipv6_dsfield()
438 ipv6_change_dsfield(nh, ~mask, ipv6_tclass); in set_ipv6_dsfield()
441 static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) in set_ipv6_fl() argument
445 ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; in set_ipv6_fl()
449 nh->flow_lbl[0] = (u8)(fl >> 16); in set_ipv6_fl()
450 nh->flow_lbl[1] = (u8)(fl >> 8); in set_ipv6_fl()
451 nh->flow_lbl[2] = (u8)fl; in set_ipv6_fl()
457 static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) in set_ipv6_ttl() argument
459 new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); in set_ipv6_ttl()
462 csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), in set_ipv6_ttl()
464 nh->hop_limit = new_ttl; in set_ipv6_ttl()
467 static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, in set_ip_ttl() argument
470 new_ttl = OVS_MASKED(nh->ttl, new_ttl, mask); in set_ip_ttl()
472 csum_replace2(&nh->check, htons(nh->ttl << 8), htons(new_ttl << 8)); in set_ip_ttl()
473 nh->ttl = new_ttl; in set_ip_ttl()
480 struct iphdr *nh; in set_ipv4() local
489 nh = ip_hdr(skb); in set_ipv4()
496 new_addr = OVS_MASKED(nh->saddr, key->ipv4_src, mask->ipv4_src); in set_ipv4()
498 if (unlikely(new_addr != nh->saddr)) { in set_ipv4()
499 set_ip_addr(skb, nh, &nh->saddr, new_addr); in set_ipv4()
504 new_addr = OVS_MASKED(nh->daddr, key->ipv4_dst, mask->ipv4_dst); in set_ipv4()
506 if (unlikely(new_addr != nh->daddr)) { in set_ipv4()
507 set_ip_addr(skb, nh, &nh->daddr, new_addr); in set_ipv4()
512 ipv4_change_dsfield(nh, ~mask->ipv4_tos, key->ipv4_tos); in set_ipv4()
513 flow_key->ip.tos = nh->tos; in set_ipv4()
516 set_ip_ttl(skb, nh, key->ipv4_ttl, mask->ipv4_ttl); in set_ipv4()
517 flow_key->ip.ttl = nh->ttl; in set_ipv4()
532 struct ipv6hdr *nh; in set_ipv6() local
540 nh = ipv6_hdr(skb); in set_ipv6()
547 __be32 *saddr = (__be32 *)&nh->saddr; in set_ipv6()
563 __be32 *daddr = (__be32 *)&nh->daddr; in set_ipv6()
569 if (ipv6_ext_hdr(nh->nexthdr)) in set_ipv6()
582 set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); in set_ipv6()
583 flow_key->ip.tos = ipv6_get_dsfield(nh); in set_ipv6()
586 set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), in set_ipv6()
589 *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); in set_ipv6()
592 set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); in set_ipv6()
593 flow_key->ip.ttl = nh->hop_limit; in set_ipv6()
601 struct nshhdr *nh; in set_nsh() local
619 nh = nsh_hdr(skb); in set_nsh()
620 length = nsh_hdr_len(nh); in set_nsh()
628 nh = nsh_hdr(skb); in set_nsh()
629 skb_postpull_rcsum(skb, nh, length); in set_nsh()
630 flags = nsh_get_flags(nh); in set_nsh()
633 ttl = nsh_get_ttl(nh); in set_nsh()
636 nsh_set_flags_and_ttl(nh, flags, ttl); in set_nsh()
637 nh->path_hdr = OVS_MASKED(nh->path_hdr, key.base.path_hdr, in set_nsh()
639 flow_key->nsh.base.path_hdr = nh->path_hdr; in set_nsh()
640 switch (nh->mdtype) { in set_nsh()
643 nh->md1.context[i] = in set_nsh()
644 OVS_MASKED(nh->md1.context[i], key.context[i], in set_nsh()
647 memcpy(flow_key->nsh.context, nh->md1.context, in set_nsh()
648 sizeof(nh->md1.context)); in set_nsh()
657 skb_postpush_rcsum(skb, nh, length); in set_nsh()
1242 struct ipv6hdr *nh; in execute_dec_ttl() local
1245 sizeof(*nh)); in execute_dec_ttl()
1249 nh = ipv6_hdr(skb); in execute_dec_ttl()
1251 if (nh->hop_limit <= 1) in execute_dec_ttl()
1254 key->ip.ttl = --nh->hop_limit; in execute_dec_ttl()
1256 struct iphdr *nh; in execute_dec_ttl() local
1260 sizeof(*nh)); in execute_dec_ttl()
1264 nh = ip_hdr(skb); in execute_dec_ttl()
1265 if (nh->ttl <= 1) in execute_dec_ttl()
1268 old_ttl = nh->ttl--; in execute_dec_ttl()
1269 csum_replace2(&nh->check, htons(old_ttl << 8), in execute_dec_ttl()
1270 htons(nh->ttl << 8)); in execute_dec_ttl()
1271 key->ip.ttl = nh->ttl; in execute_dec_ttl()
1424 struct nshhdr *nh = (struct nshhdr *)buffer; in do_execute_actions() local
1426 err = nsh_hdr_from_nlattr(nla_data(a), nh, in do_execute_actions()
1430 err = push_nsh(skb, key, nh); in do_execute_actions()