]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/netdev/tunnel.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
0ef6f454
LP
2#pragma once
3
3be1d7e0
TG
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
634f0f98 23#include "in-addr-util.h"
aa9f1140 24
441e9ae4 25#include "netdev/netdev.h"
3be1d7e0 26
855ee1a1
SS
27typedef 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
407af9dd
SS
35typedef enum IPv6FlowLabel {
36 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
37 _NETDEV_IPV6_FLOWLABEL_MAX,
38 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
39} IPv6FlowLabel;
40
634f0f98 41typedef struct Tunnel {
aa9f1140
TG
42 NetDev meta;
43
855ee1a1
SS
44 uint8_t encap_limit;
45
aa9f1140 46 int family;
6870b415 47 int ipv6_flowlabel;
aa9f1140
TG
48
49 unsigned ttl;
50 unsigned tos;
855ee1a1
SS
51 unsigned flags;
52
1d710029
SS
53 uint32_t key;
54 uint32_t ikey;
55 uint32_t okey;
56
aa9f1140
TG
57 union in_addr_union local;
58 union in_addr_union remote;
855ee1a1
SS
59
60 Ip6TnlMode ip6tnl_mode;
61
aa9f1140 62 bool pmtudisc;
a9b70f9d 63 bool copy_dscp;
4d7fa6de 64 bool independent;
634f0f98
ZJS
65} Tunnel;
66
67DEFINE_NETDEV_CAST(IPIP, Tunnel);
68DEFINE_NETDEV_CAST(GRE, Tunnel);
69DEFINE_NETDEV_CAST(GRETAP, Tunnel);
70DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
71DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
72DEFINE_NETDEV_CAST(SIT, Tunnel);
73DEFINE_NETDEV_CAST(VTI, Tunnel);
74DEFINE_NETDEV_CAST(VTI6, Tunnel);
75DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
3be1d7e0
TG
76extern const NetDevVTable ipip_vtable;
77extern const NetDevVTable sit_vtable;
78extern const NetDevVTable vti_vtable;
9011ce77 79extern const NetDevVTable vti6_vtable;
3be1d7e0 80extern const NetDevVTable gre_vtable;
1af2536a 81extern const NetDevVTable gretap_vtable;
b16492f8
SS
82extern const NetDevVTable ip6gre_vtable;
83extern const NetDevVTable ip6gretap_vtable;
855ee1a1
SS
84extern const NetDevVTable ip6tnl_vtable;
85
86const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
87Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
88
89int 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);
3b50bf80
SS
94
95int 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);
407af9dd 105
407af9dd
SS
106int 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);
b4828886
SS
111
112int 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);
1d710029
SS
117int 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);