]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/netdev/tunnel.h
Merge pull request #10730 from yuwata/udev_device_get_ifindex_returns_zero
[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 int config_parse_ip6tnl_mode(const char *unit, const char *filename,
82 unsigned line, const char *section,
83 unsigned section_line, const char *lvalue,
84 int ltype, const char *rvalue, void *data,
85 void *userdata);
86
87 int config_parse_tunnel_address(const char *unit,
88 const char *filename,
89 unsigned line,
90 const char *section,
91 unsigned section_line,
92 const char *lvalue,
93 int ltype,
94 const char *rvalue,
95 void *data,
96 void *userdata);
97
98 int config_parse_ipv6_flowlabel(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);
103
104 int config_parse_encap_limit(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_tunnel_key(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
116 CONFIG_PARSER_PROTOTYPE(config_parse_6rd_prefix);