treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / net / xfrm / xfrm_inout.h
blobc7b0318938e227b8d69f84959bcbcaeb7512ddcb
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <linux/ipv6.h>
3 #include <net/dsfield.h>
4 #include <net/xfrm.h>
6 #ifndef XFRM_INOUT_H
7 #define XFRM_INOUT_H 1
9 static inline void xfrm6_beet_make_header(struct sk_buff *skb)
11 struct ipv6hdr *iph = ipv6_hdr(skb);
13 iph->version = 6;
15 memcpy(iph->flow_lbl, XFRM_MODE_SKB_CB(skb)->flow_lbl,
16 sizeof(iph->flow_lbl));
17 iph->nexthdr = XFRM_MODE_SKB_CB(skb)->protocol;
19 ipv6_change_dsfield(iph, 0, XFRM_MODE_SKB_CB(skb)->tos);
20 iph->hop_limit = XFRM_MODE_SKB_CB(skb)->ttl;
23 static inline void xfrm4_beet_make_header(struct sk_buff *skb)
25 struct iphdr *iph = ip_hdr(skb);
27 iph->ihl = 5;
28 iph->version = 4;
30 iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol;
31 iph->tos = XFRM_MODE_SKB_CB(skb)->tos;
33 iph->id = XFRM_MODE_SKB_CB(skb)->id;
34 iph->frag_off = XFRM_MODE_SKB_CB(skb)->frag_off;
35 iph->ttl = XFRM_MODE_SKB_CB(skb)->ttl;
38 #endif