]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
Merge pull request #10734 from yuwata/network-use-structured-initializers
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "in-addr-util.h"
5
6 #include "conf-parser.h"
7 #include "netdev/netdev.h"
8 #include "netdev/fou-tunnel.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
33 unsigned ttl;
34 unsigned tos;
35 unsigned flags;
36
37 uint32_t key;
38 uint32_t ikey;
39 uint32_t okey;
40
41 union in_addr_union local;
42 union in_addr_union remote;
43
44 Ip6TnlMode ip6tnl_mode;
45 FooOverUDPEncapType fou_encap_type;
46
47 bool pmtudisc;
48 bool copy_dscp;
49 bool independent;
50 bool fou_tunnel;
51
52 uint16_t encap_src_port;
53 uint16_t fou_destination_port;
54
55 struct in6_addr sixrd_prefix;
56 uint8_t sixrd_prefixlen;
57 } Tunnel;
58
59 DEFINE_NETDEV_CAST(IPIP, Tunnel);
60 DEFINE_NETDEV_CAST(GRE, Tunnel);
61 DEFINE_NETDEV_CAST(GRETAP, Tunnel);
62 DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
63 DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
64 DEFINE_NETDEV_CAST(SIT, Tunnel);
65 DEFINE_NETDEV_CAST(VTI, Tunnel);
66 DEFINE_NETDEV_CAST(VTI6, Tunnel);
67 DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
68 extern const NetDevVTable ipip_vtable;
69 extern const NetDevVTable sit_vtable;
70 extern const NetDevVTable vti_vtable;
71 extern const NetDevVTable vti6_vtable;
72 extern const NetDevVTable gre_vtable;
73 extern const NetDevVTable gretap_vtable;
74 extern const NetDevVTable ip6gre_vtable;
75 extern const NetDevVTable ip6gretap_vtable;
76 extern const NetDevVTable ip6tnl_vtable;
77
78 const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
79 Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
80
81 CONFIG_PARSER_PROTOTYPE(config_parse_ip6tnl_mode);
82 CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_address);
83 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_flowlabel);
84 CONFIG_PARSER_PROTOTYPE(config_parse_encap_limit);
85 CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_key);
86 CONFIG_PARSER_PROTOTYPE(config_parse_6rd_prefix);