xref: /freebsd/share/man/man4/ng_l2tp.4 (revision 97cbe82b4063fad6a2f01cc5b8cf3af4f2087a4d)
197cbe82bSArchie Cobbs.\" Copyright (c) 2001-2002 Packet Design, LLC.
297cbe82bSArchie Cobbs.\" All rights reserved.
397cbe82bSArchie Cobbs.\"
497cbe82bSArchie Cobbs.\" Subject to the following obligations and disclaimer of warranty,
597cbe82bSArchie Cobbs.\" use and redistribution of this software, in source or object code
697cbe82bSArchie Cobbs.\" forms, with or without modifications are expressly permitted by
797cbe82bSArchie Cobbs.\" Packet Design; provided, however, that:
897cbe82bSArchie Cobbs.\"
997cbe82bSArchie Cobbs.\"    (i)  Any and all reproductions of the source or object code
1097cbe82bSArchie Cobbs.\"         must include the copyright notice above and the following
1197cbe82bSArchie Cobbs.\"         disclaimer of warranties; and
1297cbe82bSArchie Cobbs.\"    (ii) No rights are granted, in any manner or form, to use
1397cbe82bSArchie Cobbs.\"         Packet Design trademarks, including the mark "PACKET DESIGN"
1497cbe82bSArchie Cobbs.\"         on advertising, endorsements, or otherwise except as such
1597cbe82bSArchie Cobbs.\"         appears in the above copyright notice or in the software.
1697cbe82bSArchie Cobbs.\"
1797cbe82bSArchie Cobbs.\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
1897cbe82bSArchie Cobbs.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
1997cbe82bSArchie Cobbs.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
2097cbe82bSArchie Cobbs.\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
2197cbe82bSArchie Cobbs.\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
2297cbe82bSArchie Cobbs.\" OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
2397cbe82bSArchie Cobbs.\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
2497cbe82bSArchie Cobbs.\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
2597cbe82bSArchie Cobbs.\" RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
2697cbe82bSArchie Cobbs.\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
2797cbe82bSArchie Cobbs.\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
2897cbe82bSArchie Cobbs.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
2997cbe82bSArchie Cobbs.\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
3097cbe82bSArchie Cobbs.\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
3197cbe82bSArchie Cobbs.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3297cbe82bSArchie Cobbs.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
3397cbe82bSArchie Cobbs.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
3497cbe82bSArchie Cobbs.\" THE POSSIBILITY OF SUCH DAMAGE.
3597cbe82bSArchie Cobbs.\"
3697cbe82bSArchie Cobbs.\" Author: Archie Cobbs <archie@freebsd.org>
3797cbe82bSArchie Cobbs.\"
3897cbe82bSArchie Cobbs.\" $FreeBSD$
3997cbe82bSArchie Cobbs.\"
4097cbe82bSArchie Cobbs.Dd April 22, 2002
4197cbe82bSArchie Cobbs.Dt NG_L2TP 4
4297cbe82bSArchie Cobbs.Os
4397cbe82bSArchie Cobbs.Sh NAME
4497cbe82bSArchie Cobbs.Nm ng_l2tp
4597cbe82bSArchie Cobbs.Nd L2TP protocol netgraph node type
4697cbe82bSArchie Cobbs.Sh SYNOPSIS
4797cbe82bSArchie Cobbs.In netgraph/ng_l2tp.h
4897cbe82bSArchie Cobbs.Sh DESCRIPTION
4997cbe82bSArchie CobbsThe
5097cbe82bSArchie Cobbs.Nm ng_l2tp
5197cbe82bSArchie Cobbsnode type implements the encapsulation layer of the L2TP protocol
5297cbe82bSArchie Cobbsas described in RFC 2661.
5397cbe82bSArchie CobbsThis includes adding the L2TP packet header for outgoing packets
5497cbe82bSArchie Cobbsand verifying and removing it for incoming packets.
5597cbe82bSArchie CobbsThe node maintains the L2TP sequence number state and handles
5697cbe82bSArchie Cobbscontrol session packet acknowledgment and retransmission.
5797cbe82bSArchie Cobbs.Sh HOOKS
5897cbe82bSArchie CobbsThe
5997cbe82bSArchie Cobbs.Nm ng_l2tp
6097cbe82bSArchie Cobbsnode type supports the following hooks:
6197cbe82bSArchie Cobbs.Pp
6297cbe82bSArchie Cobbs.Bl -tag -compact -offset 3n -width session_hhhh
6397cbe82bSArchie Cobbs.It Dv lower
6497cbe82bSArchie CobbsL2TP frames
6597cbe82bSArchie Cobbs.It Dv ctrl
6697cbe82bSArchie CobbsControl packets
6797cbe82bSArchie Cobbs.It Dv session_hhhh
6897cbe82bSArchie CobbsSession 0xhhhh data packets
6997cbe82bSArchie Cobbs.El
7097cbe82bSArchie Cobbs.Pp
7197cbe82bSArchie CobbsL2TP control and data packets are transmitted to, and received from,
7297cbe82bSArchie Cobbsthe L2TP peer via the
7397cbe82bSArchie Cobbs.Dv lower
7497cbe82bSArchie Cobbshook.
7597cbe82bSArchie CobbsTypically this hook would be connected to the
7697cbe82bSArchie Cobbs.Dv "inet/dgram/udp"
7797cbe82bSArchie Cobbshook of an
7897cbe82bSArchie Cobbs.Xr ng_ksocket 4
7997cbe82bSArchie Cobbsnode for L2TP over UDP.
8097cbe82bSArchie Cobbs.Pp
8197cbe82bSArchie CobbsThe
8297cbe82bSArchie Cobbs.Dv ctrl
8397cbe82bSArchie Cobbshook connects to the local L2TP management entity.
8497cbe82bSArchie CobbsL2TP control messages (without any L2TP headers) are transmitted
8597cbe82bSArchie Cobbsand received on this hook.
8697cbe82bSArchie CobbsMessages written to this hook are guaranteed to be delivered to the
8797cbe82bSArchie Cobbspeer reliably, in order, and without duplicates.
8897cbe82bSArchie Cobbs.Pp
8997cbe82bSArchie CobbsPackets written to the
9097cbe82bSArchie Cobbs.Dv ctrl
9197cbe82bSArchie Cobbshook must contain a two byte session ID prepended to the frame
9297cbe82bSArchie Cobbs(in network order).
9397cbe82bSArchie CobbsThis session ID is copied to the outgoing L2TP header.
9497cbe82bSArchie CobbsSimilarly, packets read from the
9597cbe82bSArchie Cobbs.Dv ctrl
9697cbe82bSArchie Cobbshook will have the received session ID prepended.
9797cbe82bSArchie Cobbs.Pp
9897cbe82bSArchie CobbsOnce an L2TP session has been created, the corresponding session
9997cbe82bSArchie Cobbshook may be used to transmit and receive the session's data frames:
10097cbe82bSArchie Cobbsfor the session with session ID
10197cbe82bSArchie Cobbs.Dv 0xabcd ,
10297cbe82bSArchie Cobbsthe hook is named
10397cbe82bSArchie Cobbs.Dv session_abcd .
10497cbe82bSArchie Cobbs.Sh CONTROL MESSAGES
10597cbe82bSArchie CobbsThis node type supports the generic control messages, plus the following:
10697cbe82bSArchie Cobbs.Bl -tag -width xx
10797cbe82bSArchie Cobbs.It Dv NGM_L2TP_SET_CONFIG
10897cbe82bSArchie CobbsThis command updates the configuration of the node.
10997cbe82bSArchie CobbsIt takes a
11097cbe82bSArchie Cobbs.Li "struct ng_l2tp_config"
11197cbe82bSArchie Cobbsas an argument:
11297cbe82bSArchie Cobbs.Bd -literal -offset 0n
11397cbe82bSArchie Cobbs/* Configuration for a node */
11497cbe82bSArchie Cobbsstruct ng_l2tp_config {
11597cbe82bSArchie Cobbs    u_char      enabled;        /* enables traffic flow */
11697cbe82bSArchie Cobbs    u_char      match_id;       /* tunnel id must match 'tunnel_id' */
11797cbe82bSArchie Cobbs    u_int16_t   tunnel_id;      /* local tunnel id */
11897cbe82bSArchie Cobbs    u_int16_t   peer_id;        /* peer's tunnel id */
11997cbe82bSArchie Cobbs    u_int16_t   peer_win;       /* peer's max recv window size */
12097cbe82bSArchie Cobbs    u_int16_t   rexmit_max;     /* max retransmits before failure */
12197cbe82bSArchie Cobbs    u_int16_t   rexmit_max_to;  /* max delay between retransmits */
12297cbe82bSArchie Cobbs};
12397cbe82bSArchie Cobbs.Ed
12497cbe82bSArchie Cobbs.Pp
12597cbe82bSArchie CobbsThe
12697cbe82bSArchie Cobbs.Va enabled
12797cbe82bSArchie Cobbsfield enables packet processing.
12897cbe82bSArchie CobbsEach time this field is changed back to zero the sequence
12997cbe82bSArchie Cobbsnumber state is reset. In this way, reuse of a node is possible.
13097cbe82bSArchie Cobbs.Pp
13197cbe82bSArchie CobbsThe
13297cbe82bSArchie Cobbs.Va tunnel_id
13397cbe82bSArchie Cobbsfield configures the local tunnel ID for the control connection.
13497cbe82bSArchie CobbsThe
13597cbe82bSArchie Cobbs.Va match_id
13697cbe82bSArchie Cobbsfield determines how incoming L2TP packets with a tunnel ID
13797cbe82bSArchie Cobbsfield different from
13897cbe82bSArchie Cobbs.Va tunnel_id
13997cbe82bSArchie Cobbsare handled.
14097cbe82bSArchie CobbsIf
14197cbe82bSArchie Cobbs.Va match_id
14297cbe82bSArchie Cobbsis non-zero, they will be dropped; otherwise, they will be dropped
14397cbe82bSArchie Cobbsonly if the tunnel ID is non-zero.
14497cbe82bSArchie CobbsTypically
14597cbe82bSArchie Cobbs.Va tunnel_id
14697cbe82bSArchie Cobbsis set to the local tunnel ID as soon as it is known and
14797cbe82bSArchie Cobbs.Va match_id
14897cbe82bSArchie Cobbsis set to non-zero after receipt of the SCCRP or SCCCN control message.
14997cbe82bSArchie Cobbs.Pp
15097cbe82bSArchie CobbsThe peer's tunnel ID should be set in
15197cbe82bSArchie Cobbs.Va peer_id
15297cbe82bSArchie Cobbsas soon as it is learned, typically after receipt of a SCCRQ or SCCRP
15397cbe82bSArchie Cobbscontrol message.
15497cbe82bSArchie CobbsThis value is copied into the L2TP header for outgoing packets.
15597cbe82bSArchie Cobbs.Pp
15697cbe82bSArchie CobbsThe
15797cbe82bSArchie Cobbs.Va peer_win
15897cbe82bSArchie Cobbsfield should be set from the
15997cbe82bSArchie Cobbs.Dq Receive Window Size
16097cbe82bSArchie CobbsAVP received from the peer.
16197cbe82bSArchie CobbsThe default value for this field is one; zero is an invalid value.
16297cbe82bSArchie CobbsAs long as
16397cbe82bSArchie Cobbs.Va enabled
16497cbe82bSArchie Cobbsis non-zero, this value may not be decreased.
16597cbe82bSArchie Cobbs.Pp
16697cbe82bSArchie CobbsThe
16797cbe82bSArchie Cobbs.Va rexmit_max
16897cbe82bSArchie Cobbsand
16997cbe82bSArchie Cobbs.Va rexmit_max_to
17097cbe82bSArchie Cobbsfields configure packet retransmission.
17197cbe82bSArchie Cobbs.Va rexmit_max_to
17297cbe82bSArchie Cobbsis the maximum retransmission delay between packets, in seconds.
17397cbe82bSArchie CobbsThe retransmit delay will start at a small value and increase
17497cbe82bSArchie Cobbsexponentially up to this limit.
17597cbe82bSArchie CobbsThe
17697cbe82bSArchie Cobbs.Va rexmit_max
17797cbe82bSArchie Cobbssets the maximum number of times a packet will be retransmitted
17897cbe82bSArchie Cobbswithout being acknowledged before a failure condition is declared.
17997cbe82bSArchie CobbsOnce a failure condition is declared, each additional retransmission
18097cbe82bSArchie Cobbswill cause the
18197cbe82bSArchie Cobbs.Nm ng_l2tp
18297cbe82bSArchie Cobbsnode to send a
18397cbe82bSArchie Cobbs.Dv NGM_L2TP_ACK_FAILURE
18497cbe82bSArchie Cobbscontrol message back to the node that sent the last
18597cbe82bSArchie Cobbs.Dv NGM_L2TP_SET_CONFIG .
18697cbe82bSArchie CobbsAppropriate action should then be taken to shutdown the control connection.
18797cbe82bSArchie Cobbs.It Dv NGM_L2TP_GET_CONFIG
18897cbe82bSArchie CobbsReturns the current configuration as a
18997cbe82bSArchie Cobbs.Dv "struct ng_l2tp_config" .
19097cbe82bSArchie Cobbs.It Dv NGM_L2TP_SET_SESS_CONFIG
19197cbe82bSArchie CobbsThis control message configures a single data session.
19297cbe82bSArchie CobbsThe corresponding hook must already be connected before sending this command.
19397cbe82bSArchie CobbsThe argument is a
19497cbe82bSArchie Cobbs.Li "struct ng_l2tp_sess_config" :
19597cbe82bSArchie Cobbs.Bd -literal -offset 0n
19697cbe82bSArchie Cobbs/* Configuration for a session hook */
19797cbe82bSArchie Cobbsstruct ng_l2tp_sess_config {
19897cbe82bSArchie Cobbs    u_int16_t   session_id;     /* local session id */
19997cbe82bSArchie Cobbs    u_int16_t   peer_id;        /* peer's session id */
20097cbe82bSArchie Cobbs    u_char      control_dseq;   /* we control data sequencing? */
20197cbe82bSArchie Cobbs    u_char      enable_dseq;    /* enable data sequencing? */
20297cbe82bSArchie Cobbs    u_char      include_length; /* include length field? */
20397cbe82bSArchie Cobbs};
20497cbe82bSArchie Cobbs.Ed
20597cbe82bSArchie Cobbs.Pp
20697cbe82bSArchie CobbsThe
20797cbe82bSArchie Cobbs.Va session_id
20897cbe82bSArchie Cobbsand
20997cbe82bSArchie Cobbs.Va peer_id
21097cbe82bSArchie Cobbsfields configure the local and remote session ID's, respectively.
21197cbe82bSArchie Cobbs.Pp
21297cbe82bSArchie CobbsThe
21397cbe82bSArchie Cobbs.Va control_dseq
21497cbe82bSArchie Cobbsand
21597cbe82bSArchie Cobbs.Va enable_dseq
21697cbe82bSArchie Cobbsfields determine whether sequence numbers are used with L2TP data packets.
21797cbe82bSArchie CobbsIf
21897cbe82bSArchie Cobbs.Va enable_dseq
21997cbe82bSArchie Cobbsis zero, then no sequence numbers are sent and incoming sequence numbers
22097cbe82bSArchie Cobbsare ignored.
22197cbe82bSArchie CobbsOtherwise, sequence numbers are included on outgoing packets and checked
22297cbe82bSArchie Cobbson incoming packets.
22397cbe82bSArchie Cobbs.Pp
22497cbe82bSArchie CobbsIf
22597cbe82bSArchie Cobbs.Va control_dseq
22697cbe82bSArchie Cobbsis non-zero, then the setting of
22797cbe82bSArchie Cobbs.Va enable_dseq
22897cbe82bSArchie Cobbswill never change except by another
22997cbe82bSArchie Cobbs.Dv NGM_L2TP_SET_SESS_CONFIG
23097cbe82bSArchie Cobbscontrol message.
23197cbe82bSArchie CobbsIf
23297cbe82bSArchie Cobbs.Va control_dseq
23397cbe82bSArchie Cobbsis zero, then the peer controls whether sequence numbers are used:
23497cbe82bSArchie Cobbsif an incoming L2TP data packet contains sequence numbers,
23597cbe82bSArchie Cobbs.Va enable_dseq
23697cbe82bSArchie Cobbsis set to one, and conversely if an incoming L2TP data packet does not
23797cbe82bSArchie Cobbscontain sequence numbers,
23897cbe82bSArchie Cobbs.Va enable_dseq
23997cbe82bSArchie Cobbsis set to zero.
24097cbe82bSArchie CobbsThe current value of
24197cbe82bSArchie Cobbs.Va enable_dseq
24297cbe82bSArchie Cobbsis always accessible via the
24397cbe82bSArchie Cobbs.Dv NGM_L2TP_GET_SESS_CONFIG
24497cbe82bSArchie Cobbscontrol message (see below).
24597cbe82bSArchie CobbsTypically an LNS would set
24697cbe82bSArchie Cobbs.Va control_dseq
24797cbe82bSArchie Cobbsto one while a LAC would set
24897cbe82bSArchie Cobbs.Va control_dseq
24997cbe82bSArchie Cobbsto zero (if the Sequencing Required AVP were not sent), thus giving
25097cbe82bSArchie Cobbscontrol of data packet sequencing to the LNS.
25197cbe82bSArchie Cobbs.Pp
25297cbe82bSArchie CobbsThe
25397cbe82bSArchie Cobbs.Va include_length
25497cbe82bSArchie Cobbsfield determines whether the L2TP header length field is included
25597cbe82bSArchie Cobbsin outgoing L2TP data packets.
25697cbe82bSArchie CobbsFor incoming packets, the L2TP length field is always checked when present.
25797cbe82bSArchie Cobbs.It Dv NGM_L2TP_GET_SESS_CONFIG
25897cbe82bSArchie CobbsThis command takes a two byte session ID as an argument and returns
25997cbe82bSArchie Cobbsthe current configuration for the corresponding data session as a
26097cbe82bSArchie Cobbs.Dv "struct ng_l2tp_sess_config" .
26197cbe82bSArchie CobbsThe corresponding session hook must be connected.
26297cbe82bSArchie Cobbs.It Dv NGM_L2TP_GET_STATS
26397cbe82bSArchie CobbsThis command takes a two byte session ID as an argument and returns a
26497cbe82bSArchie Cobbs.Dv "struct ng_l2tp_stats"
26597cbe82bSArchie Cobbscontaining statistics for the corresponding data session.
26697cbe82bSArchie CobbsThe corresponding session hook must be connected.
26797cbe82bSArchie Cobbs.It Dv NGM_L2TP_CLR_STATS
26897cbe82bSArchie CobbsThis command takes a two byte session ID as an argument and
26997cbe82bSArchie Cobbsclears the statistics for that data session.
27097cbe82bSArchie CobbsThe corresponding session hook must be connected.
27197cbe82bSArchie Cobbs.It Dv NGM_L2TP_GETCLR_STATS
27297cbe82bSArchie CobbsSame as
27397cbe82bSArchie Cobbs.Dv NGM_L2TP_GET_STATS ,
27497cbe82bSArchie Cobbsbut also atomically clears the statistics as well.
27597cbe82bSArchie Cobbs.El
27697cbe82bSArchie Cobbs.Pp
27797cbe82bSArchie Cobbs.Sh SHUTDOWN
27897cbe82bSArchie CobbsThis node shuts down upon receipt of a
27997cbe82bSArchie Cobbs.Dv NGM_SHUTDOWN
28097cbe82bSArchie Cobbscontrol message, or when all hooks have been disconnected.
28197cbe82bSArchie Cobbs.Sh SEE ALSO
28297cbe82bSArchie Cobbs.Xr netgraph 4 ,
28397cbe82bSArchie Cobbs.Xr ng_ksocket 4 ,
28497cbe82bSArchie Cobbs.Xr ng_ppp 4 ,
28597cbe82bSArchie Cobbs.Xr ng_pptp 4 ,
28697cbe82bSArchie Cobbs.Xr ngctl 8
28797cbe82bSArchie Cobbs.Rs
28897cbe82bSArchie Cobbs.%A W. Townsley
28997cbe82bSArchie Cobbs.%A A. Valencia
29097cbe82bSArchie Cobbs.%A A. Rubens
29197cbe82bSArchie Cobbs.%A G. Pall
29297cbe82bSArchie Cobbs.%A G. Zorn
29397cbe82bSArchie Cobbs.%A B. Palter
29497cbe82bSArchie Cobbs.%T "Layer Two Tunneling Protocol L2TP"
29597cbe82bSArchie Cobbs.%O RFC 2661
29697cbe82bSArchie Cobbs.Re
29797cbe82bSArchie Cobbs.Sh HISTORY
29897cbe82bSArchie CobbsThe
29997cbe82bSArchie Cobbs.Nm
30097cbe82bSArchie Cobbsnode type was developed at Packet Design, LLC.
30197cbe82bSArchie Cobbs.Dv "http://www.packetdesign.com/"
30297cbe82bSArchie Cobbs.Sh AUTHORS
30397cbe82bSArchie Cobbs.An Archie Cobbs Aq archie@packetdesign.com
304