]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/net/esp.h
UBUNTU: Ubuntu-5.15.0-39.42
[mirror_ubuntu-jammy-kernel.git] / include / net / esp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NET_ESP_H
3 #define _NET_ESP_H
4
5 #include <linux/skbuff.h>
6
7 #define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER)
8
9 struct ip_esp_hdr;
10
11 static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
12 {
13 return (struct ip_esp_hdr *)skb_transport_header(skb);
14 }
15
16 static inline void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto)
17 {
18 /* Fill padding... */
19 if (tfclen) {
20 memset(tail, 0, tfclen);
21 tail += tfclen;
22 }
23 do {
24 int i;
25 for (i = 0; i < plen - 2; i++)
26 tail[i] = i + 1;
27 } while (0);
28 tail[plen - 2] = plen - 2;
29 tail[plen - 1] = proto;
30 }
31
32 struct esp_info {
33 struct ip_esp_hdr *esph;
34 __be64 seqno;
35 int tfclen;
36 int tailen;
37 int plen;
38 int clen;
39 int len;
40 int nfrags;
41 __u8 proto;
42 bool inplace;
43 };
44
45 int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
46 int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
47 int esp_input_done2(struct sk_buff *skb, int err);
48 int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
49 int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp);
50 int esp6_input_done2(struct sk_buff *skb, int err);
51 #endif