2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2016-02-16 20:05:15 +01:00
|
|
|
#pragma once
|
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
#include "in-addr-util.h"
|
2014-07-16 13:17:10 +02:00
|
|
|
|
2018-11-07 06:27:09 +01:00
|
|
|
#include "conf-parser.h"
|
2016-11-13 02:01:19 +01:00
|
|
|
#include "netdev/netdev.h"
|
2018-06-03 09:07:41 +02:00
|
|
|
#include "netdev/fou-tunnel.h"
|
2014-07-06 14:07:34 +02:00
|
|
|
|
2015-01-16 20:09:10 +01:00
|
|
|
typedef enum Ip6TnlMode {
|
|
|
|
NETDEV_IP6_TNL_MODE_IP6IP6,
|
|
|
|
NETDEV_IP6_TNL_MODE_IPIP6,
|
|
|
|
NETDEV_IP6_TNL_MODE_ANYIP6,
|
|
|
|
_NETDEV_IP6_TNL_MODE_MAX,
|
|
|
|
_NETDEV_IP6_TNL_MODE_INVALID = -1,
|
|
|
|
} Ip6TnlMode;
|
|
|
|
|
2015-07-21 06:36:44 +02:00
|
|
|
typedef enum IPv6FlowLabel {
|
|
|
|
NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
|
|
|
|
_NETDEV_IPV6_FLOWLABEL_MAX,
|
|
|
|
_NETDEV_IPV6_FLOWLABEL_INVALID = -1,
|
|
|
|
} IPv6FlowLabel;
|
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
typedef struct Tunnel {
|
2014-07-16 13:17:10 +02:00
|
|
|
NetDev meta;
|
|
|
|
|
2015-01-16 20:09:10 +01:00
|
|
|
uint8_t encap_limit;
|
|
|
|
|
2014-07-16 13:17:10 +02:00
|
|
|
int family;
|
2015-07-29 18:34:28 +02:00
|
|
|
int ipv6_flowlabel;
|
2017-12-29 15:19:21 +01:00
|
|
|
int allow_localremote;
|
2014-07-16 13:17:10 +02:00
|
|
|
|
|
|
|
unsigned ttl;
|
|
|
|
unsigned tos;
|
2015-01-16 20:09:10 +01:00
|
|
|
unsigned flags;
|
|
|
|
|
2016-06-14 19:11:57 +02:00
|
|
|
uint32_t key;
|
|
|
|
uint32_t ikey;
|
|
|
|
uint32_t okey;
|
|
|
|
|
2014-07-16 13:17:10 +02:00
|
|
|
union in_addr_union local;
|
|
|
|
union in_addr_union remote;
|
2015-01-16 20:09:10 +01:00
|
|
|
|
|
|
|
Ip6TnlMode ip6tnl_mode;
|
2018-06-03 09:07:41 +02:00
|
|
|
FooOverUDPEncapType fou_encap_type;
|
2015-01-16 20:09:10 +01:00
|
|
|
|
2014-07-16 13:17:10 +02:00
|
|
|
bool pmtudisc;
|
2015-07-25 04:26:00 +02:00
|
|
|
bool copy_dscp;
|
2017-08-31 18:51:03 +02:00
|
|
|
bool independent;
|
2018-06-03 09:07:41 +02:00
|
|
|
bool fou_tunnel;
|
|
|
|
|
|
|
|
uint16_t encap_src_port;
|
|
|
|
uint16_t fou_destination_port;
|
2018-11-07 06:27:09 +01:00
|
|
|
|
|
|
|
struct in6_addr sixrd_prefix;
|
|
|
|
uint8_t sixrd_prefixlen;
|
2016-04-29 04:52:04 +02:00
|
|
|
} Tunnel;
|
|
|
|
|
|
|
|
DEFINE_NETDEV_CAST(IPIP, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(GRE, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(GRETAP, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(IP6GRE, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(IP6GRETAP, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(SIT, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(VTI, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(VTI6, Tunnel);
|
|
|
|
DEFINE_NETDEV_CAST(IP6TNL, Tunnel);
|
2014-07-06 14:07:34 +02:00
|
|
|
extern const NetDevVTable ipip_vtable;
|
|
|
|
extern const NetDevVTable sit_vtable;
|
|
|
|
extern const NetDevVTable vti_vtable;
|
2015-04-22 10:44:55 +02:00
|
|
|
extern const NetDevVTable vti6_vtable;
|
2014-07-06 14:07:34 +02:00
|
|
|
extern const NetDevVTable gre_vtable;
|
2014-12-20 09:05:06 +01:00
|
|
|
extern const NetDevVTable gretap_vtable;
|
2015-01-18 18:54:24 +01:00
|
|
|
extern const NetDevVTable ip6gre_vtable;
|
|
|
|
extern const NetDevVTable ip6gretap_vtable;
|
2015-01-16 20:09:10 +01:00
|
|
|
extern const NetDevVTable ip6tnl_vtable;
|
|
|
|
|
|
|
|
const char *ip6tnl_mode_to_string(Ip6TnlMode d) _const_;
|
|
|
|
Ip6TnlMode ip6tnl_mode_from_string(const char *d) _pure_;
|
|
|
|
|
|
|
|
int config_parse_ip6tnl_mode(const char *unit, const char *filename,
|
|
|
|
unsigned line, const char *section,
|
|
|
|
unsigned section_line, const char *lvalue,
|
|
|
|
int ltype, const char *rvalue, void *data,
|
|
|
|
void *userdata);
|
2015-07-16 16:46:53 +02:00
|
|
|
|
|
|
|
int config_parse_tunnel_address(const char *unit,
|
|
|
|
const char *filename,
|
|
|
|
unsigned line,
|
|
|
|
const char *section,
|
|
|
|
unsigned section_line,
|
|
|
|
const char *lvalue,
|
|
|
|
int ltype,
|
|
|
|
const char *rvalue,
|
|
|
|
void *data,
|
|
|
|
void *userdata);
|
2015-07-21 06:36:44 +02:00
|
|
|
|
|
|
|
int config_parse_ipv6_flowlabel(const char *unit, const char *filename,
|
|
|
|
unsigned line, const char *section,
|
|
|
|
unsigned section_line, const char *lvalue,
|
|
|
|
int ltype, const char *rvalue, void *data,
|
|
|
|
void *userdata);
|
2015-08-31 09:51:44 +02:00
|
|
|
|
|
|
|
int config_parse_encap_limit(const char *unit, const char *filename,
|
|
|
|
unsigned line, const char *section,
|
|
|
|
unsigned section_line, const char *lvalue,
|
|
|
|
int ltype, const char *rvalue, void *data,
|
|
|
|
void *userdata);
|
2018-06-03 09:07:41 +02:00
|
|
|
|
2016-06-14 19:11:57 +02:00
|
|
|
int config_parse_tunnel_key(const char *unit, const char *filename,
|
|
|
|
unsigned line, const char *section,
|
|
|
|
unsigned section_line, const char *lvalue,
|
|
|
|
int ltype, const char *rvalue, void *data,
|
|
|
|
void *userdata);
|
2018-11-07 06:27:09 +01:00
|
|
|
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_6rd_prefix);
|