1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 #include <netinet/in.h>
5 #include <linux/l2tp.h>
7 #include "in-addr-util.h"
9 #include "networkd-util.h"
11 typedef enum L2tpL2specType
{
12 NETDEV_L2TP_L2SPECTYPE_NONE
= L2TP_L2SPECTYPE_NONE
,
13 NETDEV_L2TP_L2SPECTYPE_DEFAULT
= L2TP_L2SPECTYPE_DEFAULT
,
14 _NETDEV_L2TP_L2SPECTYPE_MAX
,
15 _NETDEV_L2TP_L2SPECTYPE_INVALID
= -1,
18 typedef enum L2tpEncapType
{
19 NETDEV_L2TP_ENCAPTYPE_UDP
= L2TP_ENCAPTYPE_UDP
,
20 NETDEV_L2TP_ENCAPTYPE_IP
= L2TP_ENCAPTYPE_IP
,
21 _NETDEV_L2TP_ENCAPTYPE_MAX
,
22 _NETDEV_L2TP_ENCAPTYPE_INVALID
= -1,
25 typedef enum L2tpLocalAddressType
{
26 NETDEV_L2TP_LOCAL_ADDRESS_AUTO
,
27 NETDEV_L2TP_LOCAL_ADDRESS_STATIC
,
28 NETDEV_L2TP_LOCAL_ADDRESS_DYNAMIC
,
29 _NETDEV_L2TP_LOCAL_ADDRESS_MAX
,
30 _NETDEV_L2TP_LOCAL_ADDRESS_INVALID
= -1,
31 } L2tpLocalAddressType
;
33 typedef struct L2tpTunnel L2tpTunnel
;
35 typedef struct L2tpSession
{
37 NetworkConfigSection
*section
;
42 uint32_t peer_session_id
;
43 L2tpL2specType l2tp_l2spec_type
;
49 uint16_t l2tp_udp_sport
;
50 uint16_t l2tp_udp_dport
;
53 uint32_t peer_tunnel_id
;
61 L2tpLocalAddressType local_address_type
;
62 union in_addr_union local
;
63 union in_addr_union remote
;
65 L2tpEncapType l2tp_encap_type
;
67 OrderedHashmap
*sessions_by_section
;
70 DEFINE_NETDEV_CAST(L2TP
, L2tpTunnel
);
71 extern const NetDevVTable l2tptnl_vtable
;
73 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_tunnel_address
);
74 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_tunnel_id
);
75 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_encap_type
);
76 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_session_l2spec
);
77 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_session_id
);
78 CONFIG_PARSER_PROTOTYPE(config_parse_l2tp_session_name
);