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