]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man4/ng_l2tp.4
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man4 / ng_l2tp.4
1 .\" Copyright (c) 2001-2002 Packet Design, LLC.
2 .\" All rights reserved.
3 .\"
4 .\" Subject to the following obligations and disclaimer of warranty,
5 .\" use and redistribution of this software, in source or object code
6 .\" forms, with or without modifications are expressly permitted by
7 .\" Packet Design; provided, however, that:
8 .\"
9 .\"    (i)  Any and all reproductions of the source or object code
10 .\"         must include the copyright notice above and the following
11 .\"         disclaimer of warranties; and
12 .\"    (ii) No rights are granted, in any manner or form, to use
13 .\"         Packet Design trademarks, including the mark "PACKET DESIGN"
14 .\"         on advertising, endorsements, or otherwise except as such
15 .\"         appears in the above copyright notice or in the software.
16 .\"
17 .\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
18 .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
19 .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
20 .\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
21 .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
22 .\" OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
23 .\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
24 .\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
25 .\" RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
26 .\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
27 .\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
28 .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
29 .\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
30 .\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
31 .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33 .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
34 .\" THE POSSIBILITY OF SUCH DAMAGE.
35 .\"
36 .\" Author: Archie Cobbs <archie@FreeBSD.org>
37 .\"
38 .\" $FreeBSD$
39 .\"
40 .Dd November 13, 2012
41 .Dt NG_L2TP 4
42 .Os
43 .Sh NAME
44 .Nm ng_l2tp
45 .Nd L2TP protocol netgraph node type
46 .Sh SYNOPSIS
47 .In sys/types.h
48 .In netgraph/ng_l2tp.h
49 .Sh DESCRIPTION
50 The
51 .Nm l2tp
52 node type implements the encapsulation layer of the L2TP protocol
53 as described in RFC 2661.
54 This includes adding the L2TP packet header for outgoing packets
55 and verifying and removing it for incoming packets.
56 The node maintains the L2TP sequence number state and handles
57 control session packet acknowledgment and retransmission.
58 .Sh HOOKS
59 The
60 .Nm l2tp
61 node type supports the following hooks:
62 .Bl -tag -width ".Va session_hhhh"
63 .It Va lower
64 L2TP frames.
65 .It Va ctrl
66 Control packets.
67 .It Va session_hhhh
68 Session 0xhhhh data packets.
69 .El
70 .Pp
71 L2TP control and data packets are transmitted to, and received from,
72 the L2TP peer via the
73 .Dv lower
74 hook.
75 Typically this hook would be connected to the
76 .Dv "inet/dgram/udp"
77 hook of an
78 .Xr ng_ksocket 4
79 node for L2TP over UDP.
80 .Pp
81 The
82 .Dv ctrl
83 hook connects to the local L2TP management entity.
84 L2TP control messages (without any L2TP headers) are transmitted
85 and received on this hook.
86 Messages written to this hook are guaranteed to be delivered to the
87 peer reliably, in order, and without duplicates.
88 .Pp
89 Packets written to the
90 .Dv ctrl
91 hook must contain a two byte session ID prepended to the frame
92 (in network order).
93 This session ID is copied to the outgoing L2TP header.
94 Similarly, packets read from the
95 .Dv ctrl
96 hook will have the received session ID prepended.
97 .Pp
98 Once an L2TP session has been created, the corresponding session
99 hook may be used to transmit and receive the session's data frames:
100 for the session with session ID
101 .Dv 0xabcd ,
102 the hook is named
103 .Dv session_abcd .
104 .Sh CONTROL MESSAGES
105 This node type supports the generic control messages, plus the following:
106 .Bl -tag -width foo
107 .It Dv NGM_L2TP_SET_CONFIG Pq Ic setconfig
108 This command updates the configuration of the node.
109 It takes a
110 .Vt "struct ng_l2tp_config"
111 as an argument:
112 .Bd -literal
113 /* Configuration for a node */
114 struct ng_l2tp_config {
115     u_char      enabled;        /* enables traffic flow */
116     u_char      match_id;       /* tunnel id must match 'tunnel_id' */
117     uint16_t    tunnel_id;      /* local tunnel id */
118     uint16_t    peer_id;        /* peer's tunnel id */
119     uint16_t    peer_win;       /* peer's max recv window size */
120     uint16_t    rexmit_max;     /* max retransmits before failure */
121     uint16_t    rexmit_max_to;  /* max delay between retransmits */
122 };
123 .Ed
124 .Pp
125 The
126 .Va enabled
127 field enables packet processing.
128 Each time this field is changed back to zero the sequence
129 number state is reset.
130 In this way, reuse of a node is possible.
131 .Pp
132 The
133 .Va tunnel_id
134 field configures the local tunnel ID for the control connection.
135 The
136 .Va match_id
137 field determines how incoming L2TP packets with a tunnel ID
138 field different from
139 .Va tunnel_id
140 are handled.
141 If
142 .Va match_id
143 is non-zero, they will be dropped; otherwise, they will be dropped
144 only if the tunnel ID is non-zero.
145 Typically
146 .Va tunnel_id
147 is set to the local tunnel ID as soon as it is known and
148 .Va match_id
149 is set to non-zero after receipt of the SCCRP or SCCCN control message.
150 .Pp
151 The peer's tunnel ID should be set in
152 .Va peer_id
153 as soon as it is learned, typically after receipt of a SCCRQ or SCCRP
154 control message.
155 This value is copied into the L2TP header for outgoing packets.
156 .Pp
157 The
158 .Va peer_win
159 field should be set from the
160 .Dq "Receive Window Size"
161 AVP received from the peer.
162 The default value for this field is one; zero is an invalid value.
163 As long as
164 .Va enabled
165 is non-zero, this value may not be decreased.
166 .Pp
167 The
168 .Va rexmit_max
169 and
170 .Va rexmit_max_to
171 fields configure packet retransmission.
172 .Va rexmit_max_to
173 is the maximum retransmission delay between packets, in seconds.
174 The retransmit delay will start at a small value and increase
175 exponentially up to this limit.
176 The
177 .Va rexmit_max
178 sets the maximum number of times a packet will be retransmitted
179 without being acknowledged before a failure condition is declared.
180 Once a failure condition is declared, each additional retransmission
181 will cause the
182 .Nm l2tp
183 node to send a
184 .Dv NGM_L2TP_ACK_FAILURE Pq Ic ackfailure
185 control message back to the node that sent the last
186 .Dv NGM_L2TP_SET_CONFIG .
187 Appropriate action should then be taken to shutdown the control connection.
188 .It Dv NGM_L2TP_GET_CONFIG Pq Ic getconfig
189 Returns the current configuration as a
190 .Vt "struct ng_l2tp_config" .
191 .It Dv NGM_L2TP_SET_SESS_CONFIG Pq Ic setsessconfig
192 This control message configures a single data session.
193 The corresponding hook must already be connected before sending this command.
194 The argument is a
195 .Vt "struct ng_l2tp_sess_config" :
196 .Bd -literal
197 /* Configuration for a session hook */
198 struct ng_l2tp_sess_config {
199     uint16_t    session_id;     /* local session id */
200     uint16_t    peer_id;        /* peer's session id */
201     u_char      control_dseq;   /* whether we control data sequencing */
202     u_char      enable_dseq;    /* whether to enable data sequencing */
203     u_char      include_length; /* whether to include length field */
204 };
205 .Ed
206 .Pp
207 The
208 .Va session_id
209 and
210 .Va peer_id
211 fields configure the local and remote session IDs, respectively.
212 .Pp
213 The
214 .Va control_dseq
215 and
216 .Va enable_dseq
217 fields determine whether sequence numbers are used with L2TP data packets.
218 If
219 .Va enable_dseq
220 is zero, then no sequence numbers are sent and incoming sequence numbers
221 are ignored.
222 Otherwise, sequence numbers are included on outgoing packets and checked
223 on incoming packets.
224 .Pp
225 If
226 .Va control_dseq
227 is non-zero, then the setting of
228 .Va enable_dseq
229 will never change except by another
230 .Dv NGM_L2TP_SET_SESS_CONFIG
231 control message.
232 If
233 .Va control_dseq
234 is zero, then the peer controls whether sequence numbers are used:
235 if an incoming L2TP data packet contains sequence numbers,
236 .Va enable_dseq
237 is set to one, and conversely if an incoming L2TP data packet does not
238 contain sequence numbers,
239 .Va enable_dseq
240 is set to zero.
241 The current value of
242 .Va enable_dseq
243 is always accessible via the
244 .Dv NGM_L2TP_GET_SESS_CONFIG
245 control message (see below).
246 Typically an LNS would set
247 .Va control_dseq
248 to one while a LAC would set
249 .Va control_dseq
250 to zero (if the Sequencing Required AVP were not sent), thus giving
251 control of data packet sequencing to the LNS.
252 .Pp
253 The
254 .Va include_length
255 field determines whether the L2TP header length field is included
256 in outgoing L2TP data packets.
257 For incoming packets, the L2TP length field is always checked when present.
258 .It Dv NGM_L2TP_GET_SESS_CONFIG Pq Ic getsessconfig
259 This command takes a two byte session ID as an argument and returns
260 the current configuration for the corresponding data session as a
261 .Vt "struct ng_l2tp_sess_config" .
262 The corresponding session hook must be connected.
263 .It Dv NGM_L2TP_GET_STATS Pq Ic getstats
264 This command returns a
265 .Vt "struct ng_l2tp_stats"
266 containing statistics of the L2TP tunnel.
267 .It Dv NGM_L2TP_CLR_STATS Pq Ic clrstats
268 This command clears the statistics for the L2TP tunnel.
269 .It Dv NGM_L2TP_GETCLR_STATS Pq Ic getclrstats
270 Same as
271 .Dv NGM_L2TP_GET_STATS ,
272 but also atomically clears the statistics as well.
273 .It Dv NGM_L2TP_GET_SESSION_STATS Pq Ic getsessstats
274 This command takes a two byte session ID as an argument and returns a
275 .Vt "struct ng_l2tp_session_stats"
276 containing statistics for the corresponding data session.
277 The corresponding session hook must be connected.
278 .It Dv NGM_L2TP_CLR_SESSION_STATS Pq Ic clrsessstats
279 This command takes a two byte session ID as an argument and
280 clears the statistics for that data session.
281 The corresponding session hook must be connected.
282 .It Dv NGM_L2TP_GETCLR_SESSION_STATS Pq Ic getclrsessstats
283 Same as
284 .Dv NGM_L2TP_GET_SESSION_STATS ,
285 but also atomically clears the statistics as well.
286 .It Dv NGM_L2TP_SET_SEQ Pq Ic setsequence
287 This command sets the sequence numbers of a not yet enabled node.
288 It takes a
289 .Vt "struct ng_l2tp_seq_config"
290 as argument, where
291 .Va xack
292 and
293 .Va nr
294 respectively
295 .Va ns
296 and
297 .Va rack
298 must be the same.
299 This option is particularly useful if one receives and processes
300 the first packet entirely in userspace and wants to hand over further
301 processing to the node.
302 .El
303 .Sh SHUTDOWN
304 This node shuts down upon receipt of a
305 .Dv NGM_SHUTDOWN
306 control message, or when all hooks have been disconnected.
307 .Sh SEE ALSO
308 .Xr netgraph 4 ,
309 .Xr ng_ksocket 4 ,
310 .Xr ng_ppp 4 ,
311 .Xr ng_pptpgre 4 ,
312 .Xr ngctl 8
313 .Rs
314 .%A W. Townsley
315 .%A A. Valencia
316 .%A A. Rubens
317 .%A G. Pall
318 .%A G. Zorn
319 .%A B. Palter
320 .%T "Layer Two Tunneling Protocol L2TP"
321 .%O RFC 2661
322 .Re
323 .Sh HISTORY
324 The
325 .Nm l2tp
326 node type was developed at Packet Design, LLC,
327 .Pa http://www.packetdesign.com/ .
328 .Sh AUTHORS
329 .An Archie Cobbs Aq archie@packetdesign.com