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