]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
networkd: Allow tunnels to be created without .network (#6701)
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2014 Tom Gundersen <teg@jklm.no>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include "in-addr-util.h"
23
24 #include "netdev/netdev.h"
25
26 typedef enum Ip6TnlMode {
27 NETDEV_IP6_TNL_MODE_IP6IP6,
28 NETDEV_IP6_TNL_MODE_IPIP6,
29 NETDEV_IP6_TNL_MODE_ANYIP6,
30 _NETDEV_IP6_TNL_MODE_MAX,
31 _NETDEV_IP6_TNL_MODE_INVALID = -1,
32 } Ip6TnlMode;
33
34 typedef enum IPv6FlowLabel {
35 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
36 _NETDEV_IPV6_FLOWLABEL_MAX,
37 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
38 } IPv6FlowLabel;
39
40 typedef struct Tunnel {
41 NetDev meta;
42
43 uint8_t encap_limit;
44
45 int family;
46 int ipv6_flowlabel;
47
48 unsigned ttl;
49 unsigned tos;
50 unsigned flags;
51
52 uint32_t key;
53 uint32_t ikey;
54 uint32_t okey;
55
56 union in_addr_union local;
57 union in_addr_union remote;
58
59 Ip6TnlMode ip6tnl_mode;
60
61 bool pmtudisc;
62 bool copy_dscp;
63 bool independent;
64 } Tunnel;
65
66 DEFINE_NETDEV_CAST(IPIP, Tunnel);
67 DEFINE_NETDEV_CAST(GRE, Tunnel);
68 DEFINE_NETDEV_CAST(GRETAP, Tunnel);
69 DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
70 DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
71 DEFINE_NETDEV_CAST(SIT, Tunnel);
72 DEFINE_NETDEV_CAST(VTI, Tunnel);
73 DEFINE_NETDEV_CAST(VTI6, Tunnel);
74 DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
75 extern const NetDevVTable ipip_vtable;
76 extern const NetDevVTable sit_vtable;
77 extern const NetDevVTable vti_vtable;
78 extern const NetDevVTable vti6_vtable;
79 extern const NetDevVTable gre_vtable;
80 extern const NetDevVTable gretap_vtable;
81 extern const NetDevVTable ip6gre_vtable;
82 extern const NetDevVTable ip6gretap_vtable;
83 extern const NetDevVTable ip6tnl_vtable;
84
85 const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
86 Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
87
88 int config_parse_ip6tnl_mode(const char *unit, const char *filename,
89 unsigned line, const char *section,
90 unsigned section_line, const char *lvalue,
91 int ltype, const char *rvalue, void *data,
92 void *userdata);
93
94 int config_parse_tunnel_address(const char *unit,
95 const char *filename,
96 unsigned line,
97 const char *section,
98 unsigned section_line,
99 const char *lvalue,
100 int ltype,
101 const char *rvalue,
102 void *data,
103 void *userdata);
104
105 int config_parse_ipv6_flowlabel(const char *unit, const char *filename,
106 unsigned line, const char *section,
107 unsigned section_line, const char *lvalue,
108 int ltype, const char *rvalue, void *data,
109 void *userdata);
110
111 int config_parse_encap_limit(const char *unit, const char *filename,
112 unsigned line, const char *section,
113 unsigned section_line, const char *lvalue,
114 int ltype, const char *rvalue, void *data,
115 void *userdata);
116 int config_parse_tunnel_key(const char *unit, const char *filename,
117 unsigned line, const char *section,
118 unsigned section_line, const char *lvalue,
119 int ltype, const char *rvalue, void *data,
120 void *userdata);