1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include "in-addr-util.h"
6 #include "netdev/netdev.h"
8 typedef enum Ip6TnlMode
{
9 NETDEV_IP6_TNL_MODE_IP6IP6
,
10 NETDEV_IP6_TNL_MODE_IPIP6
,
11 NETDEV_IP6_TNL_MODE_ANYIP6
,
12 _NETDEV_IP6_TNL_MODE_MAX
,
13 _NETDEV_IP6_TNL_MODE_INVALID
= -1,
16 typedef enum IPv6FlowLabel
{
17 NETDEV_IPV6_FLOWLABEL_INHERIT
= 0xFFFFF + 1,
18 _NETDEV_IPV6_FLOWLABEL_MAX
,
19 _NETDEV_IPV6_FLOWLABEL_INVALID
= -1,
22 typedef struct Tunnel
{
29 int allow_localremote
;
39 union in_addr_union local
;
40 union in_addr_union remote
;
42 Ip6TnlMode ip6tnl_mode
;
49 DEFINE_NETDEV_CAST(IPIP
, Tunnel
);
50 DEFINE_NETDEV_CAST(GRE
, Tunnel
);
51 DEFINE_NETDEV_CAST(GRETAP
, Tunnel
);
52 DEFINE_NETDEV_CAST(IP6GRE
, Tunnel
);
53 DEFINE_NETDEV_CAST(IP6GRETAP
, Tunnel
);
54 DEFINE_NETDEV_CAST(SIT
, Tunnel
);
55 DEFINE_NETDEV_CAST(VTI
, Tunnel
);
56 DEFINE_NETDEV_CAST(VTI6
, Tunnel
);
57 DEFINE_NETDEV_CAST(IP6TNL
, Tunnel
);
58 extern const NetDevVTable ipip_vtable
;
59 extern const NetDevVTable sit_vtable
;
60 extern const NetDevVTable vti_vtable
;
61 extern const NetDevVTable vti6_vtable
;
62 extern const NetDevVTable gre_vtable
;
63 extern const NetDevVTable gretap_vtable
;
64 extern const NetDevVTable ip6gre_vtable
;
65 extern const NetDevVTable ip6gretap_vtable
;
66 extern const NetDevVTable ip6tnl_vtable
;
68 const char *ip6tnl_mode_to_string(Ip6TnlMode d
) _const_
;
69 Ip6TnlMode
ip6tnl_mode_from_string(const char *d
) _pure_
;
71 int config_parse_ip6tnl_mode(const char *unit
, const char *filename
,
72 unsigned line
, const char *section
,
73 unsigned section_line
, const char *lvalue
,
74 int ltype
, const char *rvalue
, void *data
,
77 int config_parse_tunnel_address(const char *unit
,
81 unsigned section_line
,
88 int config_parse_ipv6_flowlabel(const char *unit
, const char *filename
,
89 unsigned line
, const char *section
,
90 unsigned section_line
, const char *lvalue
,
91 int ltype
, const char *rvalue
, void *data
,
94 int config_parse_encap_limit(const char *unit
, const char *filename
,
95 unsigned line
, const char *section
,
96 unsigned section_line
, const char *lvalue
,
97 int ltype
, const char *rvalue
, void *data
,
99 int config_parse_tunnel_key(const char *unit
, const char *filename
,
100 unsigned line
, const char *section
,
101 unsigned section_line
, const char *lvalue
,
102 int ltype
, const char *rvalue
, void *data
,