1
2
3
4
5
6
7
8 #ifndef _UAPI_LINUX_L2TP_H_
9 #define _UAPI_LINUX_L2TP_H_
10
11 #include <linux/types.h>
12 #include <linux/socket.h>
13 #include <linux/in.h>
14 #include <linux/in6.h>
15
16 #define IPPROTO_L2TP 115
17
18
19
20
21
22
23
24 #define __SOCK_SIZE__ 16
25 struct sockaddr_l2tpip {
26
27 __kernel_sa_family_t l2tp_family;
28 __be16 l2tp_unused;
29 struct in_addr l2tp_addr;
30
31 __u32 l2tp_conn_id;
32
33
34 unsigned char __pad[__SOCK_SIZE__ -
35 sizeof(__kernel_sa_family_t) -
36 sizeof(__be16) - sizeof(struct in_addr) -
37 sizeof(__u32)];
38 };
39
40
41
42
43
44
45
46 struct sockaddr_l2tpip6 {
47
48 __kernel_sa_family_t l2tp_family;
49 __be16 l2tp_unused;
50 __be32 l2tp_flowinfo;
51 struct in6_addr l2tp_addr;
52 __u32 l2tp_scope_id;
53 __u32 l2tp_conn_id;
54 };
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 enum {
76 L2TP_CMD_NOOP,
77 L2TP_CMD_TUNNEL_CREATE,
78 L2TP_CMD_TUNNEL_DELETE,
79 L2TP_CMD_TUNNEL_MODIFY,
80 L2TP_CMD_TUNNEL_GET,
81 L2TP_CMD_SESSION_CREATE,
82 L2TP_CMD_SESSION_DELETE,
83 L2TP_CMD_SESSION_MODIFY,
84 L2TP_CMD_SESSION_GET,
85 __L2TP_CMD_MAX,
86 };
87
88 #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
89
90
91
92
93 enum {
94 L2TP_ATTR_NONE,
95 L2TP_ATTR_PW_TYPE,
96 L2TP_ATTR_ENCAP_TYPE,
97 L2TP_ATTR_OFFSET,
98 L2TP_ATTR_DATA_SEQ,
99 L2TP_ATTR_L2SPEC_TYPE,
100 L2TP_ATTR_L2SPEC_LEN,
101 L2TP_ATTR_PROTO_VERSION,
102 L2TP_ATTR_IFNAME,
103 L2TP_ATTR_CONN_ID,
104 L2TP_ATTR_PEER_CONN_ID,
105 L2TP_ATTR_SESSION_ID,
106 L2TP_ATTR_PEER_SESSION_ID,
107 L2TP_ATTR_UDP_CSUM,
108 L2TP_ATTR_VLAN_ID,
109 L2TP_ATTR_COOKIE,
110 L2TP_ATTR_PEER_COOKIE,
111 L2TP_ATTR_DEBUG,
112 L2TP_ATTR_RECV_SEQ,
113 L2TP_ATTR_SEND_SEQ,
114 L2TP_ATTR_LNS_MODE,
115 L2TP_ATTR_USING_IPSEC,
116 L2TP_ATTR_RECV_TIMEOUT,
117 L2TP_ATTR_FD,
118 L2TP_ATTR_IP_SADDR,
119 L2TP_ATTR_IP_DADDR,
120 L2TP_ATTR_UDP_SPORT,
121 L2TP_ATTR_UDP_DPORT,
122 L2TP_ATTR_MTU,
123 L2TP_ATTR_MRU,
124 L2TP_ATTR_STATS,
125 L2TP_ATTR_IP6_SADDR,
126 L2TP_ATTR_IP6_DADDR,
127 L2TP_ATTR_UDP_ZERO_CSUM6_TX,
128 L2TP_ATTR_UDP_ZERO_CSUM6_RX,
129 L2TP_ATTR_PAD,
130 __L2TP_ATTR_MAX,
131 };
132
133 #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
134
135
136 enum {
137 L2TP_ATTR_STATS_NONE,
138 L2TP_ATTR_TX_PACKETS,
139 L2TP_ATTR_TX_BYTES,
140 L2TP_ATTR_TX_ERRORS,
141 L2TP_ATTR_RX_PACKETS,
142 L2TP_ATTR_RX_BYTES,
143 L2TP_ATTR_RX_SEQ_DISCARDS,
144 L2TP_ATTR_RX_OOS_PACKETS,
145 L2TP_ATTR_RX_ERRORS,
146 L2TP_ATTR_STATS_PAD,
147 __L2TP_ATTR_STATS_MAX,
148 };
149
150 #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
151
152 enum l2tp_pwtype {
153 L2TP_PWTYPE_NONE = 0x0000,
154 L2TP_PWTYPE_ETH_VLAN = 0x0004,
155 L2TP_PWTYPE_ETH = 0x0005,
156 L2TP_PWTYPE_PPP = 0x0007,
157 L2TP_PWTYPE_PPP_AC = 0x0008,
158 L2TP_PWTYPE_IP = 0x000b,
159 __L2TP_PWTYPE_MAX
160 };
161
162 enum l2tp_l2spec_type {
163 L2TP_L2SPECTYPE_NONE,
164 L2TP_L2SPECTYPE_DEFAULT,
165 };
166
167 enum l2tp_encap_type {
168 L2TP_ENCAPTYPE_UDP,
169 L2TP_ENCAPTYPE_IP,
170 };
171
172
173 enum l2tp_seqmode {
174 L2TP_SEQ_NONE = 0,
175 L2TP_SEQ_IP = 1,
176 L2TP_SEQ_ALL = 2,
177 };
178
179
180
181
182
183
184
185
186
187 enum l2tp_debug_flags {
188 L2TP_MSG_DEBUG = (1 << 0),
189 L2TP_MSG_CONTROL = (1 << 1),
190 L2TP_MSG_SEQ = (1 << 2),
191 L2TP_MSG_DATA = (1 << 3),
192 };
193
194
195
196
197 #define L2TP_GENL_NAME "l2tp"
198 #define L2TP_GENL_VERSION 0x1
199 #define L2TP_GENL_MCGROUP "l2tp"
200
201 #endif