]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
Merge pull request #17549 from yuwata/tiny-fixes
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "in-addr-util.h"
5
6 #include "conf-parser.h"
7 #include "fou-tunnel.h"
8 #include "netdev.h"
9
10 typedef enum Ip6TnlMode {
11 NETDEV_IP6_TNL_MODE_IP6IP6,
12 NETDEV_IP6_TNL_MODE_IPIP6,
13 NETDEV_IP6_TNL_MODE_ANYIP6,
14 _NETDEV_IP6_TNL_MODE_MAX,
15 _NETDEV_IP6_TNL_MODE_INVALID = -1,
16 } Ip6TnlMode;
17
18 typedef enum IPv6FlowLabel {
19 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
20 _NETDEV_IPV6_FLOWLABEL_MAX,
21 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
22 } IPv6FlowLabel;
23
24 typedef struct Tunnel {
25 NetDev meta;
26
27 uint8_t encap_limit;
28
29 int family;
30 int ipv6_flowlabel;
31 int allow_localremote;
32 int gre_erspan_sequence;
33 int isatap;
34
35 unsigned ttl;
36 unsigned tos;
37 unsigned flags;
38
39 uint32_t key;
40 uint32_t ikey;
41 uint32_t okey;
42 uint32_t erspan_index;
43
44 union in_addr_union local;
45 union in_addr_union remote;
46
47 Ip6TnlMode ip6tnl_mode;
48 FooOverUDPEncapType fou_encap_type;
49
50 bool pmtudisc;
51 bool copy_dscp;
52 bool independent;
53 bool fou_tunnel;
54 bool assign_to_loopback;
55
56 uint16_t encap_src_port;
57 uint16_t fou_destination_port;
58
59 struct in6_addr sixrd_prefix;
60 uint8_t sixrd_prefixlen;
61 } Tunnel;
62
63 DEFINE_NETDEV_CAST(IPIP, Tunnel);
64 DEFINE_NETDEV_CAST(GRE, Tunnel);
65 DEFINE_NETDEV_CAST(GRETAP, Tunnel);
66 DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
67 DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
68 DEFINE_NETDEV_CAST(SIT, Tunnel);
69 DEFINE_NETDEV_CAST(VTI, Tunnel);
70 DEFINE_NETDEV_CAST(VTI6, Tunnel);
71 DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
72 DEFINE_NETDEV_CAST(ERSPAN, Tunnel);
73 extern const NetDevVTable ipip_vtable;
74 extern const NetDevVTable sit_vtable;
75 extern const NetDevVTable vti_vtable;
76 extern const NetDevVTable vti6_vtable;
77 extern const NetDevVTable gre_vtable;
78 extern const NetDevVTable gretap_vtable;
79 extern const NetDevVTable ip6gre_vtable;
80 extern const NetDevVTable ip6gretap_vtable;
81 extern const NetDevVTable ip6tnl_vtable;
82 extern const NetDevVTable erspan_vtable;
83
84 const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
85 Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
86
87 CONFIG_PARSER_PROTOTYPE(config_parse_ip6tnl_mode);
88 CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_address);
89 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_flowlabel);
90 CONFIG_PARSER_PROTOTYPE(config_parse_encap_limit);
91 CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_key);
92 CONFIG_PARSER_PROTOTYPE(config_parse_6rd_prefix);