Lines Matching full:nh

287 	struct nshhdr *nh = (struct nshhdr *)buffer;  in push_nsh()  local
290 err = nsh_hdr_from_nlattr(a, nh, NSH_HDR_MAX_LEN); in push_nsh()
294 err = nsh_push(skb, nh); in push_nsh()
321 static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh, in update_ip_l4_checksum() argument
326 if (nh->frag_off & htons(IP_OFFSET)) in update_ip_l4_checksum()
329 if (nh->protocol == IPPROTO_TCP) { in update_ip_l4_checksum()
333 } else if (nh->protocol == IPPROTO_UDP) { in update_ip_l4_checksum()
347 static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, in set_ip_addr() argument
350 update_ip_l4_checksum(skb, nh, *addr, new_addr); in set_ip_addr()
351 csum_replace4(&nh->check, *addr, new_addr); in set_ip_addr()
405 static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) in set_ipv6_dsfield() argument
407 u8 old_ipv6_tclass = ipv6_get_dsfield(nh); in set_ipv6_dsfield()
415 ipv6_change_dsfield(nh, ~mask, ipv6_tclass); in set_ipv6_dsfield()
418 static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) in set_ipv6_fl() argument
422 ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; in set_ipv6_fl()
426 nh->flow_lbl[0] = (u8)(fl >> 16); in set_ipv6_fl()
427 nh->flow_lbl[1] = (u8)(fl >> 8); in set_ipv6_fl()
428 nh->flow_lbl[2] = (u8)fl; in set_ipv6_fl()
434 static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) in set_ipv6_ttl() argument
436 new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); in set_ipv6_ttl()
439 csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), in set_ipv6_ttl()
441 nh->hop_limit = new_ttl; in set_ipv6_ttl()
444 static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, in set_ip_ttl() argument
447 new_ttl = OVS_MASKED(nh->ttl, new_ttl, mask); in set_ip_ttl()
449 csum_replace2(&nh->check, htons(nh->ttl << 8), htons(new_ttl << 8)); in set_ip_ttl()
450 nh->ttl = new_ttl; in set_ip_ttl()
457 struct iphdr *nh; in set_ipv4() local
466 nh = ip_hdr(skb); in set_ipv4()
473 new_addr = OVS_MASKED(nh->saddr, key->ipv4_src, mask->ipv4_src); in set_ipv4()
475 if (unlikely(new_addr != nh->saddr)) { in set_ipv4()
476 set_ip_addr(skb, nh, &nh->saddr, new_addr); in set_ipv4()
481 new_addr = OVS_MASKED(nh->daddr, key->ipv4_dst, mask->ipv4_dst); in set_ipv4()
483 if (unlikely(new_addr != nh->daddr)) { in set_ipv4()
484 set_ip_addr(skb, nh, &nh->daddr, new_addr); in set_ipv4()
489 ipv4_change_dsfield(nh, ~mask->ipv4_tos, key->ipv4_tos); in set_ipv4()
490 flow_key->ip.tos = nh->tos; in set_ipv4()
493 set_ip_ttl(skb, nh, key->ipv4_ttl, mask->ipv4_ttl); in set_ipv4()
494 flow_key->ip.ttl = nh->ttl; in set_ipv4()
509 struct ipv6hdr *nh; in set_ipv6() local
517 nh = ipv6_hdr(skb); in set_ipv6()
524 __be32 *saddr = (__be32 *)&nh->saddr; in set_ipv6()
540 __be32 *daddr = (__be32 *)&nh->daddr; in set_ipv6()
546 if (ipv6_ext_hdr(nh->nexthdr)) in set_ipv6()
559 set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); in set_ipv6()
560 flow_key->ip.tos = ipv6_get_dsfield(nh); in set_ipv6()
563 set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), in set_ipv6()
566 *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); in set_ipv6()
569 set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); in set_ipv6()
570 flow_key->ip.ttl = nh->hop_limit; in set_ipv6()
578 struct nshhdr *nh; in set_nsh() local
596 nh = nsh_hdr(skb); in set_nsh()
597 length = nsh_hdr_len(nh); in set_nsh()
605 nh = nsh_hdr(skb); in set_nsh()
606 skb_postpull_rcsum(skb, nh, length); in set_nsh()
607 flags = nsh_get_flags(nh); in set_nsh()
610 ttl = nsh_get_ttl(nh); in set_nsh()
613 nsh_set_flags_and_ttl(nh, flags, ttl); in set_nsh()
614 nh->path_hdr = OVS_MASKED(nh->path_hdr, key.base.path_hdr, in set_nsh()
616 flow_key->nsh.base.path_hdr = nh->path_hdr; in set_nsh()
617 switch (nh->mdtype) { in set_nsh()
620 nh->md1.context[i] = in set_nsh()
621 OVS_MASKED(nh->md1.context[i], key.context[i], in set_nsh()
624 memcpy(flow_key->nsh.context, nh->md1.context, in set_nsh()
625 sizeof(nh->md1.context)); in set_nsh()
634 skb_postpush_rcsum(skb, nh, length); in set_nsh()
1241 struct ipv6hdr *nh; in execute_dec_ttl() local
1244 sizeof(*nh)); in execute_dec_ttl()
1248 nh = ipv6_hdr(skb); in execute_dec_ttl()
1250 if (nh->hop_limit <= 1) in execute_dec_ttl()
1253 key->ip.ttl = --nh->hop_limit; in execute_dec_ttl()
1255 struct iphdr *nh; in execute_dec_ttl() local
1259 sizeof(*nh)); in execute_dec_ttl()
1263 nh = ip_hdr(skb); in execute_dec_ttl()
1264 if (nh->ttl <= 1) in execute_dec_ttl()
1267 old_ttl = nh->ttl--; in execute_dec_ttl()
1268 csum_replace2(&nh->check, htons(old_ttl << 8), in execute_dec_ttl()
1269 htons(nh->ttl << 8)); in execute_dec_ttl()
1270 key->ip.ttl = nh->ttl; in execute_dec_ttl()