1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright © 2014 Tom Gundersen <teg@jklm.no>
8 #include "in-addr-util.h"
10 #include "netdev/netdev.h"
12 typedef enum Ip6TnlMode
{
13 NETDEV_IP6_TNL_MODE_IP6IP6
,
14 NETDEV_IP6_TNL_MODE_IPIP6
,
15 NETDEV_IP6_TNL_MODE_ANYIP6
,
16 _NETDEV_IP6_TNL_MODE_MAX
,
17 _NETDEV_IP6_TNL_MODE_INVALID
= -1,
20 typedef enum IPv6FlowLabel
{
21 NETDEV_IPV6_FLOWLABEL_INHERIT
= 0xFFFFF + 1,
22 _NETDEV_IPV6_FLOWLABEL_MAX
,
23 _NETDEV_IPV6_FLOWLABEL_INVALID
= -1,
26 typedef struct Tunnel
{
33 int allow_localremote
;
43 union in_addr_union local
;
44 union in_addr_union remote
;
46 Ip6TnlMode ip6tnl_mode
;
53 DEFINE_NETDEV_CAST(IPIP
, Tunnel
);
54 DEFINE_NETDEV_CAST(GRE
, Tunnel
);
55 DEFINE_NETDEV_CAST(GRETAP
, Tunnel
);
56 DEFINE_NETDEV_CAST(IP6GRE
, Tunnel
);
57 DEFINE_NETDEV_CAST(IP6GRETAP
, Tunnel
);
58 DEFINE_NETDEV_CAST(SIT
, Tunnel
);
59 DEFINE_NETDEV_CAST(VTI
, Tunnel
);
60 DEFINE_NETDEV_CAST(VTI6
, Tunnel
);
61 DEFINE_NETDEV_CAST(IP6TNL
, Tunnel
);
62 extern const NetDevVTable ipip_vtable
;
63 extern const NetDevVTable sit_vtable
;
64 extern const NetDevVTable vti_vtable
;
65 extern const NetDevVTable vti6_vtable
;
66 extern const NetDevVTable gre_vtable
;
67 extern const NetDevVTable gretap_vtable
;
68 extern const NetDevVTable ip6gre_vtable
;
69 extern const NetDevVTable ip6gretap_vtable
;
70 extern const NetDevVTable ip6tnl_vtable
;
72 const char *ip6tnl_mode_to_string(Ip6TnlMode d
) _const_
;
73 Ip6TnlMode
ip6tnl_mode_from_string(const char *d
) _pure_
;
75 int config_parse_ip6tnl_mode(const char *unit
, const char *filename
,
76 unsigned line
, const char *section
,
77 unsigned section_line
, const char *lvalue
,
78 int ltype
, const char *rvalue
, void *data
,
81 int config_parse_tunnel_address(const char *unit
,
85 unsigned section_line
,
92 int config_parse_ipv6_flowlabel(const char *unit
, const char *filename
,
93 unsigned line
, const char *section
,
94 unsigned section_line
, const char *lvalue
,
95 int ltype
, const char *rvalue
, void *data
,
98 int config_parse_encap_limit(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
,
103 int config_parse_tunnel_key(const char *unit
, const char *filename
,
104 unsigned line
, const char *section
,
105 unsigned section_line
, const char *lvalue
,
106 int ltype
, const char *rvalue
, void *data
,