]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/netdev/tunnel.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
0ef6f454
LP
2#pragma once
3
3be1d7e0 4/***
96b2fb93 5 Copyright © 2014 Tom Gundersen <teg@jklm.no>
3be1d7e0
TG
6***/
7
634f0f98 8#include "in-addr-util.h"
aa9f1140 9
441e9ae4 10#include "netdev/netdev.h"
3be1d7e0 11
855ee1a1
SS
12typedef enum Ip6TnlMode {
13 NETDEV_IP6_TNL_MODE_IP6IP6,
14 NETDEV_IP6_TNL_MODE_IPIP6,
15 NETDEV_IP6_TNL_MODE_ANYIP6,
16 _NETDEV_IP6_TNL_MODE_MAX,
17 _NETDEV_IP6_TNL_MODE_INVALID = -1,
18} Ip6TnlMode;
19
407af9dd
SS
20typedef enum IPv6FlowLabel {
21 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
22 _NETDEV_IPV6_FLOWLABEL_MAX,
23 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
24} IPv6FlowLabel;
25
634f0f98 26typedef struct Tunnel {
aa9f1140
TG
27 NetDev meta;
28
855ee1a1
SS
29 uint8_t encap_limit;
30
aa9f1140 31 int family;
6870b415 32 int ipv6_flowlabel;
3a4f3e42 33 int allow_localremote;
aa9f1140
TG
34
35 unsigned ttl;
36 unsigned tos;
855ee1a1
SS
37 unsigned flags;
38
1d710029
SS
39 uint32_t key;
40 uint32_t ikey;
41 uint32_t okey;
42
aa9f1140
TG
43 union in_addr_union local;
44 union in_addr_union remote;
855ee1a1
SS
45
46 Ip6TnlMode ip6tnl_mode;
47
aa9f1140 48 bool pmtudisc;
a9b70f9d 49 bool copy_dscp;
4d7fa6de 50 bool independent;
634f0f98
ZJS
51} Tunnel;
52
53DEFINE_NETDEV_CAST(IPIP, Tunnel);
54DEFINE_NETDEV_CAST(GRE, Tunnel);
55DEFINE_NETDEV_CAST(GRETAP, Tunnel);
56DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
57DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
58DEFINE_NETDEV_CAST(SIT, Tunnel);
59DEFINE_NETDEV_CAST(VTI, Tunnel);
60DEFINE_NETDEV_CAST(VTI6, Tunnel);
61DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
3be1d7e0
TG
62extern const NetDevVTable ipip_vtable;
63extern const NetDevVTable sit_vtable;
64extern const NetDevVTable vti_vtable;
9011ce77 65extern const NetDevVTable vti6_vtable;
3be1d7e0 66extern const NetDevVTable gre_vtable;
1af2536a 67extern const NetDevVTable gretap_vtable;
b16492f8
SS
68extern const NetDevVTable ip6gre_vtable;
69extern const NetDevVTable ip6gretap_vtable;
855ee1a1
SS
70extern const NetDevVTable ip6tnl_vtable;
71
72const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
73Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
74
75int config_parse_ip6tnl_mode(const char *unit, const char *filename,
76 unsigned line, const char *section,
77 unsigned section_line, const char *lvalue,
78 int ltype, const char *rvalue, void *data,
79 void *userdata);
3b50bf80
SS
80
81int config_parse_tunnel_address(const char *unit,
82 const char *filename,
83 unsigned line,
84 const char *section,
85 unsigned section_line,
86 const char *lvalue,
87 int ltype,
88 const char *rvalue,
89 void *data,
90 void *userdata);
407af9dd 91
407af9dd
SS
92int config_parse_ipv6_flowlabel(const char *unit, const char *filename,
93 unsigned line, const char *section,
94 unsigned section_line, const char *lvalue,
95 int ltype, const char *rvalue, void *data,
96 void *userdata);
b4828886
SS
97
98int config_parse_encap_limit(const char *unit, const char *filename,
99 unsigned line, const char *section,
100 unsigned section_line, const char *lvalue,
101 int ltype, const char *rvalue, void *data,
102 void *userdata);
1d710029
SS
103int config_parse_tunnel_key(const char *unit, const char *filename,
104 unsigned line, const char *section,
105 unsigned section_line, const char *lvalue,
106 int ltype, const char *rvalue, void *data,
107 void *userdata);