]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
networkd and sd-netlink: add support for Generic netlink And FooOverUDP to IPIP tunnel
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "in-addr-util.h"
5
6 #include "netdev/netdev.h"
7 #include "netdev/fou-tunnel.h"
8
9 typedef enum Ip6TnlMode {
10 NETDEV_IP6_TNL_MODE_IP6IP6,
11 NETDEV_IP6_TNL_MODE_IPIP6,
12 NETDEV_IP6_TNL_MODE_ANYIP6,
13 _NETDEV_IP6_TNL_MODE_MAX,
14 _NETDEV_IP6_TNL_MODE_INVALID = -1,
15 } Ip6TnlMode;
16
17 typedef enum IPv6FlowLabel {
18 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
19 _NETDEV_IPV6_FLOWLABEL_MAX,
20 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
21 } IPv6FlowLabel;
22
23 typedef struct Tunnel {
24 NetDev meta;
25
26 uint8_t encap_limit;
27
28 int family;
29 int ipv6_flowlabel;
30 int allow_localremote;
31
32 unsigned ttl;
33 unsigned tos;
34 unsigned flags;
35
36 uint32_t key;
37 uint32_t ikey;
38 uint32_t okey;
39
40 union in_addr_union local;
41 union in_addr_union remote;
42
43 Ip6TnlMode ip6tnl_mode;
44 FooOverUDPEncapType fou_encap_type;
45
46 bool pmtudisc;
47 bool copy_dscp;
48 bool independent;
49 bool fou_tunnel;
50
51 uint16_t encap_src_port;
52 uint16_t fou_destination_port;
53 } Tunnel;
54
55 DEFINE_NETDEV_CAST(IPIP, Tunnel);
56 DEFINE_NETDEV_CAST(GRE, Tunnel);
57 DEFINE_NETDEV_CAST(GRETAP, Tunnel);
58 DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
59 DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
60 DEFINE_NETDEV_CAST(SIT, Tunnel);
61 DEFINE_NETDEV_CAST(VTI, Tunnel);
62 DEFINE_NETDEV_CAST(VTI6, Tunnel);
63 DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
64 extern const NetDevVTable ipip_vtable;
65 extern const NetDevVTable sit_vtable;
66 extern const NetDevVTable vti_vtable;
67 extern const NetDevVTable vti6_vtable;
68 extern const NetDevVTable gre_vtable;
69 extern const NetDevVTable gretap_vtable;
70 extern const NetDevVTable ip6gre_vtable;
71 extern const NetDevVTable ip6gretap_vtable;
72 extern const NetDevVTable ip6tnl_vtable;
73
74 const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
75 Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
76
77 int config_parse_ip6tnl_mode(const char *unit, const char *filename,
78 unsigned line, const char *section,
79 unsigned section_line, const char *lvalue,
80 int ltype, const char *rvalue, void *data,
81 void *userdata);
82
83 int config_parse_tunnel_address(const char *unit,
84 const char *filename,
85 unsigned line,
86 const char *section,
87 unsigned section_line,
88 const char *lvalue,
89 int ltype,
90 const char *rvalue,
91 void *data,
92 void *userdata);
93
94 int config_parse_ipv6_flowlabel(const char *unit, const char *filename,
95 unsigned line, const char *section,
96 unsigned section_line, const char *lvalue,
97 int ltype, const char *rvalue, void *data,
98 void *userdata);
99
100 int config_parse_encap_limit(const char *unit, const char *filename,
101 unsigned line, const char *section,
102 unsigned section_line, const char *lvalue,
103 int ltype, const char *rvalue, void *data,
104 void *userdata);
105
106 int config_parse_tunnel_key(const char *unit, const char *filename,
107 unsigned line, const char *section,
108 unsigned section_line, const char *lvalue,
109 int ltype, const char *rvalue, void *data,
110 void *userdata);