]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
networkd-wait-online: move to separate subdirectory
[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 } Tunnel;
64
65 DEFINE_NETDEV_CAST(IPIP, Tunnel);
66 DEFINE_NETDEV_CAST(GRE, Tunnel);
67 DEFINE_NETDEV_CAST(GRETAP, Tunnel);
68 DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
69 DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
70 DEFINE_NETDEV_CAST(SIT, Tunnel);
71 DEFINE_NETDEV_CAST(VTI, Tunnel);
72 DEFINE_NETDEV_CAST(VTI6, Tunnel);
73 DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
74 extern const NetDevVTable ipip_vtable;
75 extern const NetDevVTable sit_vtable;
76 extern const NetDevVTable vti_vtable;
77 extern const NetDevVTable vti6_vtable;
78 extern const NetDevVTable gre_vtable;
79 extern const NetDevVTable gretap_vtable;
80 extern const NetDevVTable ip6gre_vtable;
81 extern const NetDevVTable ip6gretap_vtable;
82 extern const NetDevVTable ip6tnl_vtable;
83
84 const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
85 Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
86
87 int config_parse_ip6tnl_mode(const char *unit, const char *filename,
88 unsigned line, const char *section,
89 unsigned section_line, const char *lvalue,
90 int ltype, const char *rvalue, void *data,
91 void *userdata);
92
93 int config_parse_tunnel_address(const char *unit,
94 const char *filename,
95 unsigned line,
96 const char *section,
97 unsigned section_line,
98 const char *lvalue,
99 int ltype,
100 const char *rvalue,
101 void *data,
102 void *userdata);
103
104 int config_parse_ipv6_flowlabel(const char *unit, const char *filename,
105 unsigned line, const char *section,
106 unsigned section_line, const char *lvalue,
107 int ltype, const char *rvalue, void *data,
108 void *userdata);
109
110 int config_parse_encap_limit(const char *unit, const char *filename,
111 unsigned line, const char *section,
112 unsigned section_line, const char *lvalue,
113 int ltype, const char *rvalue, void *data,
114 void *userdata);
115 int config_parse_tunnel_key(const char *unit, const char *filename,
116 unsigned line, const char *section,
117 unsigned section_line, const char *lvalue,
118 int ltype, const char *rvalue, void *data,
119 void *userdata);