1 .\" Copyright (c) 2001-2002 Packet Design, LLC.
2 .\" All rights reserved.
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:
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.
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.
36 .\" Author: Archie Cobbs <archie@freebsd.org>
38 .\" $FreeBSD: src/share/man/man4/ng_l2tp.4,v 1.1.2.1 2002/08/20 23:48:53 archie Exp $
45 .Nd L2TP protocol netgraph node type
47 .In netgraph/l2tp/ng_l2tp.h
51 node type implements the encapsulation layer of the L2TP protocol
52 as described in RFC 2661.
53 This includes adding the L2TP packet header for outgoing packets
54 and verifying and removing it for incoming packets.
55 The node maintains the L2TP sequence number state and handles
56 control session packet acknowledgment and retransmission.
60 node type supports the following hooks:
62 .Bl -tag -compact -offset 3n -width session_hhhh
68 Session 0xhhhh data packets
71 L2TP control and data packets are transmitted to, and received from,
75 Typically this hook would be connected to the
79 node for L2TP over UDP.
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.
89 Packets written to the
91 hook must contain a two byte session ID prepended to the frame
93 This session ID is copied to the outgoing L2TP header.
94 Similarly, packets read from the
96 hook will have the received session ID prepended.
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
105 This node type supports the generic control messages, plus the following:
107 .It Dv NGM_L2TP_SET_CONFIG
108 This command updates the configuration of the node.
110 .Li "struct ng_l2tp_config"
112 .Bd -literal -offset 0n
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 u_int16_t tunnel_id; /* local tunnel id */
118 u_int16_t peer_id; /* peer's tunnel id */
119 u_int16_t peer_win; /* peer's max recv window size */
120 u_int16_t rexmit_max; /* max retransmits before failure */
121 u_int16_t rexmit_max_to; /* max delay between retransmits */
127 field enables packet processing.
128 Each time this field is changed back to zero the sequence
129 number state is reset. In this way, reuse of a node is possible.
133 field configures the local tunnel ID for the control connection.
136 field determines how incoming L2TP packets with a tunnel ID
142 is non-zero, they will be dropped; otherwise, they will be dropped
143 only if the tunnel ID is non-zero.
146 is set to the local tunnel ID as soon as it is known and
148 is set to non-zero after receipt of the SCCRP or SCCCN control message.
150 The peer's tunnel ID should be set in
152 as soon as it is learned, typically after receipt of a SCCRQ or SCCRP
154 This value is copied into the L2TP header for outgoing packets.
158 field should be set from the
159 .Dq Receive Window Size
160 AVP received from the peer.
161 The default value for this field is one; zero is an invalid value.
164 is non-zero, this value may not be decreased.
170 fields configure packet retransmission.
172 is the maximum retransmission delay between packets, in seconds.
173 The retransmit delay will start at a small value and increase
174 exponentially up to this limit.
177 sets the maximum number of times a packet will be retransmitted
178 without being acknowledged before a failure condition is declared.
179 Once a failure condition is declared, each additional retransmission
183 .Dv NGM_L2TP_ACK_FAILURE
184 control message back to the node that sent the last
185 .Dv NGM_L2TP_SET_CONFIG .
186 Appropriate action should then be taken to shutdown the control connection.
187 .It Dv NGM_L2TP_GET_CONFIG
188 Returns the current configuration as a
189 .Dv "struct ng_l2tp_config" .
190 .It Dv NGM_L2TP_SET_SESS_CONFIG
191 This control message configures a single data session.
192 The corresponding hook must already be connected before sending this command.
194 .Li "struct ng_l2tp_sess_config" :
195 .Bd -literal -offset 0n
196 /* Configuration for a session hook */
197 struct ng_l2tp_sess_config {
198 u_int16_t session_id; /* local session id */
199 u_int16_t peer_id; /* peer's session id */
200 u_char control_dseq; /* we control data sequencing? */
201 u_char enable_dseq; /* enable data sequencing? */
202 u_char include_length; /* include length field? */
210 fields configure the local and remote session ID's, respectively.
216 fields determine whether sequence numbers are used with L2TP data packets.
219 is zero, then no sequence numbers are sent and incoming sequence numbers
221 Otherwise, sequence numbers are included on outgoing packets and checked
226 is non-zero, then the setting of
228 will never change except by another
229 .Dv NGM_L2TP_SET_SESS_CONFIG
233 is zero, then the peer controls whether sequence numbers are used:
234 if an incoming L2TP data packet contains sequence numbers,
236 is set to one, and conversely if an incoming L2TP data packet does not
237 contain sequence numbers,
242 is always accessible via the
243 .Dv NGM_L2TP_GET_SESS_CONFIG
244 control message (see below).
245 Typically an LNS would set
247 to one while a LAC would set
249 to zero (if the Sequencing Required AVP were not sent), thus giving
250 control of data packet sequencing to the LNS.
254 field determines whether the L2TP header length field is included
255 in outgoing L2TP data packets.
256 For incoming packets, the L2TP length field is always checked when present.
257 .It Dv NGM_L2TP_GET_SESS_CONFIG
258 This command takes a two byte session ID as an argument and returns
259 the current configuration for the corresponding data session as a
260 .Dv "struct ng_l2tp_sess_config" .
261 The corresponding session hook must be connected.
262 .It Dv NGM_L2TP_GET_STATS
263 This command takes a two byte session ID as an argument and returns a
264 .Dv "struct ng_l2tp_stats"
265 containing statistics for the corresponding data session.
266 The corresponding session hook must be connected.
267 .It Dv NGM_L2TP_CLR_STATS
268 This command takes a two byte session ID as an argument and
269 clears the statistics for that data session.
270 The corresponding session hook must be connected.
271 .It Dv NGM_L2TP_GETCLR_STATS
273 .Dv NGM_L2TP_GET_STATS ,
274 but also atomically clears the statistics as well.
277 This node shuts down upon receipt of a
279 control message, or when all hooks have been disconnected.
293 .%T "Layer Two Tunneling Protocol L2TP"
299 node type was developed at Packet Design, LLC.
300 .Pa "http://www.packetdesign.com/"
302 .An Archie Cobbs Aq Mt archie@packetdesign.com