]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/netdev/tunnel.h
network: fix memleaks
[thirdparty/systemd.git] / src / network / netdev / tunnel.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
0ef6f454
LP
2#pragma once
3
634f0f98 4#include "in-addr-util.h"
aa9f1140 5
d067cab3 6#include "conf-parser.h"
737f1405
YW
7#include "fou-tunnel.h"
8#include "netdev.h"
3be1d7e0 9
855ee1a1
SS
10typedef 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
407af9dd
SS
18typedef enum IPv6FlowLabel {
19 NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
20 _NETDEV_IPV6_FLOWLABEL_MAX,
21 _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
22} IPv6FlowLabel;
23
634f0f98 24typedef struct Tunnel {
aa9f1140
TG
25 NetDev meta;
26
855ee1a1
SS
27 uint8_t encap_limit;
28
aa9f1140 29 int family;
6870b415 30 int ipv6_flowlabel;
3a4f3e42 31 int allow_localremote;
a8b9a65c 32 int gre_erspan_sequence;
918049ad 33 int isatap;
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;
2266864b 42 uint32_t erspan_index;
1d710029 43
aa9f1140
TG
44 union in_addr_union local;
45 union in_addr_union remote;
855ee1a1
SS
46
47 Ip6TnlMode ip6tnl_mode;
53cb501a 48 FooOverUDPEncapType fou_encap_type;
855ee1a1 49
aa9f1140 50 bool pmtudisc;
a9b70f9d 51 bool copy_dscp;
4d7fa6de 52 bool independent;
53cb501a 53 bool fou_tunnel;
8c9c703c 54 bool assign_to_loopback;
53cb501a
SS
55
56 uint16_t encap_src_port;
57 uint16_t fou_destination_port;
d067cab3
DA
58
59 struct in6_addr sixrd_prefix;
60 uint8_t sixrd_prefixlen;
634f0f98
ZJS
61} Tunnel;
62
63DEFINE_NETDEV_CAST(IPIP, Tunnel);
64DEFINE_NETDEV_CAST(GRE, Tunnel);
65DEFINE_NETDEV_CAST(GRETAP, Tunnel);
66DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
67DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
68DEFINE_NETDEV_CAST(SIT, Tunnel);
69DEFINE_NETDEV_CAST(VTI, Tunnel);
70DEFINE_NETDEV_CAST(VTI6, Tunnel);
71DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
2266864b 72DEFINE_NETDEV_CAST(ERSPAN, Tunnel);
3be1d7e0
TG
73extern const NetDevVTable ipip_vtable;
74extern const NetDevVTable sit_vtable;
75extern const NetDevVTable vti_vtable;
9011ce77 76extern const NetDevVTable vti6_vtable;
3be1d7e0 77extern const NetDevVTable gre_vtable;
1af2536a 78extern const NetDevVTable gretap_vtable;
b16492f8
SS
79extern const NetDevVTable ip6gre_vtable;
80extern const NetDevVTable ip6gretap_vtable;
855ee1a1 81extern const NetDevVTable ip6tnl_vtable;
2266864b 82extern const NetDevVTable erspan_vtable;
855ee1a1
SS
83
84const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
85Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
86
538f15cf
YW
87CONFIG_PARSER_PROTOTYPE(config_parse_ip6tnl_mode);
88CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_address);
89CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_flowlabel);
90CONFIG_PARSER_PROTOTYPE(config_parse_encap_limit);
91CONFIG_PARSER_PROTOTYPE(config_parse_tunnel_key);
d067cab3 92CONFIG_PARSER_PROTOTYPE(config_parse_6rd_prefix);