home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_j_p / draft-ietf-pppext-l2f-04.txt < prev    next >
Text File  |  1997-10-02  |  61KB  |  1,684 lines

  1.  
  2. INTERNET DRAFT        EXPIRES APRIL 1998        INTERNET DRAFT
  3.  
  4. PPP Working Group                                             A. Valencia
  5. INTERNET DRAFT                                            M. Littlewood
  6. Category: Experimental                                            T. Kolar
  7.                                         Cisco Systems
  8.                                  October 1997
  9.  
  10.  
  11.                  Layer Two Forwarding (Protocol) "L2F"
  12.                     <draft-ietf-pppext-l2f-04.txt>
  13.  
  14. Status of This Memo
  15.  
  16. This document is an Internet-Draft.  Internet-Drafts are working
  17. documents of the Internet Engineering Task Force (IETF), its
  18. areas, and its working groups.  Note that other groups may also
  19. distribute working documents as Internet-Drafts.
  20.  
  21. Internet-Drafts are draft documents valid for a maximum of six
  22. months and may be updated, replaced, or obsoleted by other
  23. documents at any time.  It is inappropriate to use Internet-
  24. Drafts as reference material or to cite them other than as
  25. "work in progress."
  26.  
  27. To learn the current status of any Internet-Draft, please check
  28. the "1id-abstracts.txt" listing contained in the Internet-
  29. Drafts Shadow Directories on ftp.is.co.za (Africa),
  30. nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  31. ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  32.  
  33. Distribution of this document is unlimited.
  34.  
  35.  
  36. Abstract
  37.  
  38.    Virtual dial-up allows many separate and autonomous protocol domains
  39.    to share common access infrastructure including modems, Access
  40.    Servers, and ISDN routers.  Previous RFCs have specified protocols
  41.    for supporting IP dial-up via SLIP [1] and multiprotocol dial-up via
  42.    PPP [2].  This document describes the Layer Two Forwarding protocol
  43.    (L2F) which permits the tunneling of the link layer (i.e., HDLC,
  44.    async HDLC, or SLIP frames) of higher level protocols.  Using such
  45.    tunnels, it is possible to divorce the location of the initial dial-
  46.    up server from the location at which the dial-up protocol connection
  47.    is terminated and access to the network provided.
  48.  
  49. Table of Contents
  50.  
  51.    1.0 Introduction                                                2
  52.    1.1 Conventions
  53.    2.0 Problem Space Overview                                      3
  54.    2.1 Initial Assumptions
  55.    2.2 Topology
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. INTERNET DRAFT                                             December 1996
  66.  
  67.  
  68.    2.3 Virtual dial-up Service - a walk-though                     4
  69.    3.0 Service Model Issues                                        6
  70.    3.1 Security
  71.    3.2 Address allocation
  72.    3.3 Authentication                                              7
  73.    3.4 Accounting
  74.    4.0 Protocol Definition                                         8
  75.    4.1 Encapsulation within L2F                                    8
  76.    4.1.1 Encapsulation of PPP within L2F
  77.    4.1.2 Encapsulation of SLIP within L2F                          9
  78.    4.2 L2F Packet Format
  79.    4.2.1 Overall Packet Format
  80.    4.2.2 Packet Header                                            10
  81.    4.2.3 Version field
  82.    4.2.4 Protocol field
  83.    4.2.5 Sequence Number                                          11
  84.    4.2.6 Packet Multiplex ID
  85.    4.2.7 Client ID
  86.    4.2.8 Length                                                   12
  87.    4.2.9 Packet Checksum
  88.    4.2.10 Payload Offset
  89.    4.2.11 Packet Key                                              13
  90.    4.3 L2F Tunnel Establishment
  91.    4.3.1 Normal Tunnel Negotiation Sequence
  92.    4.3.2 Normal Client Negotiation Sequence                       15
  93.    4.4 L2F management message types
  94.    4.4.1 L2F message type: Invalid                                16
  95.    4.4.2 L2F_CONF
  96.    4.4.3 L2F_OPEN, tunnel establishment                           17
  97.    4.4.4 L2F_OPEN, client establishment
  98.    4.4.5 L2F_CLOSE                                                18
  99.    4.4.6 L2F_ECHO                                                 19
  100.    4.4.7 L2F_ECHO_RESP
  101.    4.5 L2F Message Delivery                                       20
  102.    4.5.1 Sequenced Delivery
  103.    4.5.2 Flow Control
  104.    4.5.3 Tunnel State Table
  105.    4.5.4 Client State Table                                       21
  106.    5.0 Protocol Considerations
  107.    5.1 PPP Features
  108.    5.2 Termination                                                22
  109.    5.3 Extended Authentication
  110.    5.4 MNP4 and Apple Remote Access Protocol
  111.    5.5 Operation over IP/UDP
  112.    6.0 Acknowledgments
  113.    7.0 References                                                 23
  114.    8.0 Authors' Addresses
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125. INTERNET DRAFT 
  126.  
  127.  
  128. 1.0 Introduction
  129.  
  130.    The traditional dial-up network service on the Internet is for
  131.    registered IP addresses only.  A new class of virtual dial-up
  132.    application which allows multiple protocols and unregistered IP
  133.    addresses is also desired on the Internet. Examples of this class of
  134.    network application are support for privately addressed IP, IPX, and
  135.    AppleTalk dial-up via SLIP/PPP across existing Internet
  136.    infrastructure.
  137.  
  138.    The support of these multiprotocol virtual dial-up applications is of
  139.    significant benefit to end users and Internet Service providers as it
  140.    allows the sharing of very large investments in access and core
  141.    infrastructure and allows local calls to be used.  It also allows
  142.    existing investments in non-IP protocol applications to be supported
  143.    in a secure manner while still leveraging the access infrastructure
  144.    of the Internet.
  145.  
  146.    It is the purpose of this document to identify the issues encountered in
  147.    integrating multiprotocol dial-up services into an existing Internet
  148.    Service Provider's Point of Presence (hereafter referred to as ISP
  149.    and POP, respectively), and to describe the L2F protocol which
  150.    permits the leveraging of existing access protocols.
  151.  
  152. 1.1. Conventions
  153.  
  154.    The following language conventions are used in the items of
  155.    specification in this document:
  156.  
  157.       o   MUST, SHALL, or MANDATORY -- This item is an absolute
  158.           requirement of the specification.
  159.  
  160.       o   SHOULD or RECOMMEND -- This item should generally be followed
  161.           for all but exceptional circumstances.
  162.  
  163.       o   MAY or OPTIONAL -- This item is truly optional and may be
  164.           followed or ignored according to the needs of the implementor.
  165.  
  166. 2.0 Problem Space Overview
  167.  
  168.    In this section we describe in high level terms the scope of
  169.    the problem that will be explored in more detail in later sections.
  170.  
  171. 2.1 Initial Assumptions
  172.  
  173.    We begin by assuming that Internet access is provided by an ISP and that the
  174.    ISP wishes to offer services other than traditional registered IP address
  175.    based services to dial-up users of the network.
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185. INTERNET DRAFT 
  186.  
  187.  
  188.    We also assume that the user of such a service wants all of the security
  189.    facilities that are available to him in a dedicated dial-up configuration.
  190.    In particular, the end user requires:
  191.  
  192.    + End System transparency: Neither the remote end system nor his home site
  193.    hosts should require any special software to use this service in a secure
  194.    manner.
  195.  
  196.    +  Authentication as provided via dial-up PPP CHAP or PAP, or through other
  197.    dialogs as needed for protocols without authentication (e.g., SLIP).  This
  198.    will include TACACS+ and RADIUS solutions as well as support for smart cards
  199.    and one-time passwords.  The authentication should be manageable by the user
  200.    independently of the ISP.
  201.  
  202.    +  Addressing should be as manageable as dedicated dial-up solutions.  The
  203.    address should be assigned by the home site and not the ISP.
  204.  
  205.    + Authorization should be managed by the home site as it would in a direct
  206.    dial-up solution.
  207.  
  208.    +  Accounting should be performed both by the ISP (for billing purposes) and
  209.    by the user (for charge-back and auditing).
  210.  
  211. 2.2 Topology
  212.  
  213.    Shown below is a generic Internet with Public switched Telephone Network
  214.    (PSTN) access (i.e., async PPP via modems) and Integrated Services Digital
  215.    Network (ISDN) access (i.e., synchronous PPP access).  Remote users (either
  216.    async PPP or SLIP, or ISDN) will access the Home LAN as if they were dialed
  217.    into the Home Gateway, although their physical dial-up is via the ISP
  218.    Network Access Server.
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245. INTERNET DRAFT  
  246.  
  247.  
  248.            ...----[L]----+---[L]-----...
  249.                          |
  250.                          |
  251.                         [H]
  252.                          |
  253.                  ________|________________________
  254.                  |                                |
  255.          ________|__                        ______|________
  256.          |         |                        |             |
  257.          |  PSTN  [R]                      [R]  ISDN      |
  258.          |  Cloud  |                        |   Cloud    [N]__[U]
  259.          |         |             Internet   |             |
  260.          |         |                       [R]            |
  261.          [N]______[R]                       |_____________|
  262.           |      |                                |
  263.           |      |                                |
  264.          [U]     |________________________________|
  265.  
  266.  
  267.       [H] = Home Gateway
  268.       [L] = Home LAN(s)
  269.       [R] = Router
  270.       [U] = Remote User
  271.       [N] = ISP Network Access Server ("NAS")
  272.  
  273.  
  274. 2.3 Providing Virtual dial-up Services - a walk-through
  275.  
  276.    To motivate the following discussion, this section walks through an
  277.    example of what might happen when a Virtual dial-up client initiates
  278.    access.
  279.  
  280.    The Remote User initiates a PPP connection to an ISP via either the
  281.    PSTN or ISDN.  The Network Access Server (NAS) accepts the connection
  282.    and the PPP link is established.
  283.  
  284.    The ISP undertakes a partial authentication of the end system/user
  285.    via CHAP or PAP.  Only the username field is interpreted to determine
  286.    whether the user requires a Virtual dial-up service.  It is expect--
  287.    but not required--that usernames will be structured (e.g.
  288.    littlewo@cisco.com).  Alternatively, the ISP may maintain a database
  289.    mapping users to services.  In the case of Virtual dial-up, the
  290.    mapping will name a specific endpoint, the Home Gateway.
  291.  
  292.    If a virtual dial-up service is not required, standard access to the
  293.    Internet may be provided.
  294.  
  295.    If no tunnel connection currently exists to the desired Home Gateway,
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305. INTERNET DRAFT 
  306.  
  307.  
  308.    one is initiated.  L2F is designed to be largely insulated from the
  309.    details of the media over which the tunnel is established; L2F
  310.    requires only that the tunnel media provide packet oriented point-
  311.    to-point connectivity.  Obvious examples of such media are UDP, Frame
  312.    Relay PVC's, or X.25 VC's.  Details for L2F operation over UDP are
  313.    provided in section 5.5.  The specification for L2F packet formats is
  314.    provided in section 4.2, and the message types and semantics starting
  315.    in section 4.4.
  316.  
  317.    Once the tunnel exists, an unused Multiplex ID (hereafter, "MID") is
  318.    allocated, and a connect indication is sent to notify the Home
  319.    Gateway of this new dial-up session.  The Home Gateway either accepts
  320.    the connection, or rejects.  Rejection may include a reason
  321.    indication, which may be displayed to the dial-up user, after which
  322.    the call should be disconnected.
  323.  
  324.    The initial setup notification may include the authentication
  325.    information required to allow the Home Gateway to authenticate the
  326.    user and decide to accept or decline the connection.  In the case of
  327.    CHAP, the set-up packet includes the challenge, username and raw
  328.    response.  For PAP or text dialog (i.e., for SLIP users), it includes
  329.    username and clear text password.  The Home Gateway may choose to use
  330.    this information to complete its authentication, avoiding an
  331.    additional cycle of authentication.
  332.  
  333.    For PPP, the initial setup notification may also include a copy of
  334.    the the LCP CONFACKs sent in each direction which completed LCP
  335.    negotiation.  The Home Gateway may use this information to initialize
  336.    its own PPP state (thus avoiding an additional LCP negotiation), or
  337.    it may choose to initiate a new LCP CONFREQ exchange.
  338.  
  339.    If the Home Gateway accepts the connection, it creates a "virtual
  340.    interface" for SLIP or PPP in a manner analogous to what it would use
  341.    for a direct-dialed connection.  With this "virtual interface" in
  342.    place, link layer frames may now pass over this tunnel in both
  343.    directions.  Frames from the remote user are received at the POP,
  344.    stripped of any link framing or transparency bytes, encapsulated in
  345.    L2F, and forwarded over the appropriate tunnel.
  346.  
  347.    The Home Gateway accepts these frames, strips L2F, and processes them
  348.    as normal incoming frames for the appropriate interface and protocol.
  349.    The "virtual interface" behaves very much like a hardware interface,
  350.    with the exception that the hardware in this case is physically
  351.    located at the ISP POP.  The other direction behaves analogously,
  352.    with the Home Gateway encapsulating the packet in L2F, and the POP
  353.    stripping L2F before transmitting it out the physical interface to
  354.    the remote user.
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365. INTERNET DRAFT  
  366.  
  367.  
  368.    At this point, the connectivity is a point-to-point PPP or SLIP
  369.    connection whose endpoints are the remote user's networking
  370.    application on one end and the termination of this connectivity into
  371.    the Home Gateway's SLIP or PPP support on the other.  Because the
  372.    remote user has become simply another dial-up client of the Home
  373.    Gateway access server, client connectivity can now be managed using
  374.    traditional mechanisms with respect to further authorization,
  375.    protocol access, and filtering.
  376.  
  377.    Accounting can be performed at both the NAS as well as the Home
  378.    Gateway.  This document illustrates some Accounting techniques which
  379.    are possible using L2F, but the policies surrounding such Accounting
  380.    are outside the scope of this specification.
  381.  
  382.    Because L2F connect notifications for PPP clients contain sufficient
  383.    information for a Home Gateway to authenticate and initialize its LCP
  384.    state machine, it is not required that the remote user be queried a
  385.    second time for CHAP authentication, nor that the client undergo
  386.    multiple rounds of LCP negotiation and convergence.  These techniques
  387.    are intended to optimize connection setup, and are not intended to
  388.    deprecate any functions required by the PPP specification.
  389.  
  390. 3.0 Service Model Issues
  391.  
  392.    There are several significant differences between the standard
  393.    Internet access service and the Virtual dial-up service with respect
  394.    to authentication, address allocation, authorization and accounting.
  395.    The details of the differences between these services and the
  396.    problems presented by these differences are described below.  The
  397.    mechanisms used for Virtual Dial-up service are intended to coexist
  398.    with more traditional mechanisms; it is intended that an ISP's POP
  399.    can simultaneously service ISP clients as well as Virtual dial-up
  400.    clients.
  401.  
  402. 3.1 Security
  403.  
  404.    For the Virtual dial-up service, the ISP pursues authentication only
  405.    to the extent required to discover the user's apparent identity (and
  406.    by implication, their desired Home Gateway).  As soon as this is
  407.    determined, a connection to the Home Gateway is initiated with the
  408.    authentication information gathered by the ISP.  The Home Gateway
  409.    completes the authentication by either accepting the connection, or
  410.    rejecting it.
  411.  
  412.    The Home Gateway must also protect against attempts by third parties
  413.    to establish tunnels to the Home Gateway.  Tunnel establishment
  414.    involves an ISP-to-Home Gateway authentication phase to protect
  415.    against such attacks.
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425. INTERNET DRAFT 
  426.  
  427.  
  428. 3.2 Address Allocation
  429.  
  430.    For an Internet service, the user accepts that the IP address may be
  431.    allocated dynamically from a pool of Service provider addresses.
  432.    This model often means that the remote user has little or no access
  433.    to their home network's resources, due to firewalls and other
  434.    security policies applied by the home network to accesses from
  435.    external IP addresses.
  436.  
  437.    For the Virtual dial-up service, the Home Gateway can exist behind
  438.    the home firewall, allocating addresses which are internal (and, in
  439.    fact, can be RFC1597 addresses, or non-IP addresses).  Because L2F
  440.    tunnels exclusively at the frame layer, the actual policies of such
  441.    address management are irrelevant to correct Virtual dial-up service;
  442.    for all purposes of PPP or SLIP protocol handling, the dial-in user
  443.    appears to have connected at the Home Gateway.
  444.  
  445. 3.3 Authentication
  446.  
  447.    The authentication of the user occurs in three phases; the first at
  448.    the ISP, and the second and optional third at the Home gateway.
  449.  
  450.    The ISP uses the username to determine that a Virtual dial-up service
  451.    is required and initiate the tunnel connection to the appropriate
  452.    Home Gateway.  Once a tunnel is established, a new MID is allocated
  453.    and a session initiated by forwarding the gathered authentication
  454.    information.
  455.  
  456.    The Home Gateway undertakes the second phase by deciding whether or
  457.    not to accept the connection.  The connection indication may include
  458.    CHAP, PAP, or textual authentication information.  Based on this
  459.    information, the Home Gateway may accept the connection, or may
  460.    reject it (for instance, it was a PAP request and the
  461.    username/password are found to be incorrect).
  462.  
  463.    Once the connection is accepted, the Home Gateway is free to pursue a
  464.    third phase of authentication at the PPP or SLIP layer.  These
  465.    activities are outside the scope of this specification, but might
  466.    include an additional cycle of LCP authentication, proprietary PPP
  467.    extensions, or textual challenges carried via a TCP/IP telnet
  468.    session.
  469.  
  470. 3.4 Accounting
  471.  
  472.    It is a requirement that both the Access gateway and the Home Gateway
  473.    can provide accounting data and hence both may count packets, octets
  474.    and connection start and stop times.
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485. INTERNET DRAFT
  486.  
  487.  
  488.    Since Virtual dial-up is an access service, accounting of connection
  489.    attempts (in particular, failed connection attempts) is of
  490.    significant interest.  The Home Gateway can reject new connections
  491.    based on the authentication information gathered by the ISP, with
  492.    corresponding logging.  For cases where the Home Gateway accepts the
  493.    connection and then continues with further authentication, the Home
  494.    Gateway might subsequently disconnect the client.  For such
  495.    scenarios, the disconnection indication back to the ISP may also
  496.    include a reason.
  497.  
  498.    Because the Home Gateway can decline a connection based on the
  499.    authentication information collected by the ISP, accounting can
  500.    easily draw a distinction between a series of failed connection
  501.    attempts and a series of brief successful connections.  Lacking this
  502.    facility, the Home Gateway must always accept connection requests,
  503.    and would need to exchange a number of PPP packets with the remote
  504.    system.
  505.  
  506. 4.0 Protocol Definition
  507.  
  508.    The protocol definition for Virtual dial-up services requires two
  509.    areas of standardization:
  510.  
  511.    + Encapsulation of PPP packets within L2F.  The ISP NAS and the Home
  512.    gateway require a common understanding of the encapsulation protocol
  513.    so that SLIP/PPP packets can be successfully transmitted and received
  514.    across the Internet.
  515.  
  516.    + Connection management of L2F and MIDs.  The tunnel must be
  517.    initiated and terminated, as must MIDs within the tunnel.
  518.    Termination includes diagnostic codes to assist in the diagnosis of
  519.    problems and to support accounting.
  520.  
  521.    While providing these services, the protocol must address the
  522.    following required attributes:
  523.  
  524.    + Low overhead.  The protocol must impose a minimal additional
  525.    overhead.  This requires a compact encapsulation, and a structure for
  526.    omitting some portions of the encapsulation where their function is
  527.    not required.
  528.  
  529.    + Efficiency.  The protocol must be efficient to encapsulate and
  530.    deencapsulate.
  531.  
  532.    + Protocol independence.  The protocol must make very few assumptions
  533.    about the substrate over which L2F packets are carried.
  534.  
  535.    + Simple deployment.  The protocol must not rely on additional
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545. INTERNET DRAFT   
  546.  
  547.  
  548.    telecommunication support (for instance, unique called numbers, or
  549.    caller ID) to operate.
  550.  
  551. 4.1 Encapsulation within L2F
  552.  
  553. 4.1.1 Encapsulation of PPP within L2F
  554.  
  555.    The PPP packets may be encapsulated within L2F.  The packet
  556.    encapsulated is the packet as it would be transmitted over a physical
  557.    link.  The following are NOT present in the packet:
  558.  
  559.    + Flags
  560.    + Transparency data (ACCM for async, bit stuffing for sync)
  561.    + CRC
  562.  
  563.    The following ARE still present:
  564.  
  565.    + Address and control flags (unless negotiated away by LCP)
  566.    + Protocol value
  567.  
  568. 4.1.2 Encapsulation of SLIP within L2F
  569.  
  570.    SLIP is encapsulated within L2F in much the same way as PPP.  The
  571.    transparency characters are removed before encapsulating within L2F,
  572.    as is the framing.
  573.  
  574. 4.2 L2F Packet Format
  575.  
  576. 4.2.1 Overall Packet Format
  577.  
  578.    The entire encapsulated packet has the form:
  579.  
  580.  
  581.               ---------------------------------
  582.               |                               |
  583.               |         L2F Header            |
  584.               |                               |
  585.               ---------------------------------
  586.               |                               |
  587.               |  Payload packet (SLIP/PPP)    |
  588.               |                               |
  589.               ---------------------------------
  590.               |                               |
  591.               |    L2F Checksum (optional)    |
  592.               |                               |
  593.               ---------------------------------
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605. INTERNET DRAFT 
  606.  
  607.  
  608. 4.2.2 Packet Format
  609.  
  610.    An L2F packet has the form:
  611.  
  612.  
  613.     0                   1                   2                   3
  614.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  615.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  616.    |F|K|P|S|0|0|0|0|0|0|0|0|C| Ver |    Protocol   |Sequence (opt)|\
  617.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \
  618.    |          Multiplex ID         |           Client ID           |  |
  619.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  |  L2F
  620.    |             Length            |       Offset (opt)            |  | Header
  621.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  |
  622.    |                         Key (opt)                             | /
  623.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+/
  624.    +                                 (payload)                     |
  625.    +                             .....                             |
  626.    +                             .....                             |
  627.    +                             .....                             |
  628.    +                                 (payload)                     |
  629.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  630.    |   L2F Checksum (optional)     |
  631.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  632.  
  633.  
  634. 4.2.3 Version field
  635.  
  636.    The Ver ("Version") field represents the major version of the L2F
  637.    software creating the packet.  It MUST contain the value 001.
  638.  
  639.    If Ver holds a value other than 1, or any bits are non-zero after bit
  640.    S but before bit C, this corresponds to a packet containing
  641.    extensions not understood by the receiving end.  The packet is
  642.    handled as an invalid packet as defined in 4.4.1.
  643.  
  644. 4.2.4 Protocol field
  645.  
  646.    The Protocol specifies the protocol carried within the L2F packet.
  647.    Legal values (represented here in hexadecimal) are:
  648.  
  649.       Value           Type                   Description
  650.       0x00            L2F_ILLEGAL            Illegal
  651.       0x01            L2F_PROTO              L2F management packets
  652.       0x02            L2F_PPP                PPP tunneled inside L2F
  653.       0x03            L2F_SLIP               SLIP tunneled inside L2F
  654.  
  655.    If a packet is received with a Protocol of L2F_ILLEGAL or any other
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665. INTERNET DRAFT  
  666.  
  667.  
  668.    unrecognized value, it MUST be treated as an illegal packet as
  669.    defined in 4.4.1.
  670.  
  671. 4.2.5 Sequence Number
  672.  
  673.    The Sequence number is present if the S bit in the L2F header is set
  674.    to 1.  This bit MUST be 1 for all L2F management packets.  It MAY be
  675.    set to 1 for non-L2F management packets.  If a non-L2F management
  676.    packet is received with the S bit set, all future L2F packets sent
  677.    for that MID MUST have the S bit set (and, by implication, be sent
  678.    using sequence numbers).  For instance, the Home Gateway might choose
  679.    to force sequenced packet delivery if it detects an NCP opening for a
  680.    protocol which can not operate with out-of-sequence packets.
  681.  
  682.    The Sequence number starts at 0 for the first sequenced L2F packet.
  683.    Each subsequent packet is sent with the next increment of the
  684.    sequence number.  The sequence number is thus a free running counter
  685.    represented modulo 256.  There is distinct Sequence number state
  686.    (i.e., counter) for each distinct MID value.
  687.  
  688.    For packets with S bit and sequence number, the sequence number is
  689.    used to protect against duplication of packets, as follows:
  690.  
  691.    The receiving side of the tunnel records the sequence number of each
  692.    valid L2F packet it receives.  If a received packet appears to have a
  693.    value less than or equal to the last received value, the packet MUST
  694.    be silently discarded.  Otherwise, the packet is accepted and the
  695.    sequence number in the packet recorded as the latest value last
  696.    received.
  697.  
  698.    For purposes of detecting duplication, a received sequence value is
  699.    considered less than or equal to the last received value if its value
  700.    lies in the range of the last value and its 127 successor values.
  701.    For example, if the last received sequence number was 15, then
  702.    packets with sequence numbers 0 through 15, as well as 144 through
  703.    255, would be considered less than or equal to, and would be silently
  704.    discarded.  Otherwise it would be accepted.
  705.  
  706. 4.2.6 Packet Multiplex ID
  707.  
  708.    The Multiplex ID ("MID") identifies a particular connection within
  709.    the tunnel.  Each new connection is assigned a MID currently unused
  710.    within the tunnel.  It is recommended that the MID cycle through the
  711.    entire 16-bit namespace, to reduce aliasing between previous and
  712.    current sessions.  A MID value which has been previously used within
  713.    a tunnel, has been closed, and will now be used again, must be
  714.    considered as an entirely new MID, and initialised as such.
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725. INTERNET DRAFT 
  726.  
  727.  
  728.    The MID with value 0 is special; it is used to communicate the state
  729.    of the tunnel itself, as distinct from any connection within the
  730.    tunnel.  Only L2F_PROTO packets may be sent using an MID of 0; if any
  731.    other type is sent on MID 0, the packet is illegal and MUST be
  732.    processed as defined in 4.4.1.
  733.  
  734. 4.2.7 Client ID
  735.  
  736.    The Client ID ("CLID") is used to assist endpoints in demultiplexing
  737.    tunnels when the underlying point-to-point substrate lacks an
  738.    efficient or dependable technique for doing so directly.  Using the
  739.    CLID, it is possible to demultiplex multiple tunnels whose packets
  740.    arrive over the point-to-point media interleaved, without requiring
  741.    media-specific semantics.
  742.  
  743.    When transmitting the L2F_CONF message (described below), the peer's
  744.    CLID must be communicated via the Assigned_CLID field.  This MUST be
  745.    a unique non-zero value on the sender's side, which is to be expected
  746.    in the Home Gateway's L2F_CONF response, as well as all future non-
  747.    L2F_CONF packets received.
  748.  
  749.    The CLID value from the last valid L2F_CONF message received MUST be
  750.    recorded and used as the CLID field value for all subsequent packets
  751.    sent to the peer.
  752.  
  753.    Packets with an unknown Client ID MUST be silently discarded.
  754.  
  755.    For the initial packet sent during tunnel establishment, where no
  756.    L2F_CONF has yet been received, the CLID field MUST be set to 0.
  757.  
  758.    Thus, during L2F_CONF each side is told its CLID value.  All later
  759.    packets sent, tagged with this CLID value, serve as a tag which
  760.    uniquely identifies this peer.
  761.  
  762. 4.2.8 Length
  763.  
  764.    Length is the size in octets of the entire packet, including header,
  765.    all fields present, and payload.  Length does not reflect the
  766.    addition of the checksum, if one is present.  The packet should be
  767.    silently discarded if the received packet is shorter than the
  768.    indicated length.  Additional bytes present in the packet beyond the
  769.    indicated length MUST be silently ignored.
  770.  
  771. 4.2.9 Packet Checksum
  772.  
  773.    The Checksum is present if the C bit is present in the header flags.
  774.    It is a 16-bit CRC as used by PPP/HDLC (specifically, FCS-16 [3]).
  775.    Is is applied over the entire packet starting with the first byte of
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785. INTERNET DRAFT 
  786.  
  787.  
  788.    L2F flags, through the last byte of payload data.  The checksum is
  789.    then added as two bytes immediately following the last byte of
  790.    payload data.
  791.  
  792. 4.2.10 Payload Offset
  793.  
  794.    The Offset is present if the F bit is set in the header flags.  This
  795.    field specifies the number of bytes past the L2F header at which the
  796.    payload data is expected to start.  If it is 0, or the F bit is not
  797.    set, the first byte following the last byte of L2F header is the
  798.    first byte of payload data.
  799.  
  800.    It is recommended that data skipped due to the payload offset be
  801.    initialized to 0's.
  802.  
  803.    For architectures where it is more efficient to have the payload
  804.    start at an aligned 32-bit boundary with respect to the L2F header,
  805.    it is recommended that the F bit be set, and an offset of 0 be used.
  806.  
  807. 4.2.11 Packet Key
  808.  
  809.    The Key field is present if the K bit is set in the L2F header.  The
  810.    Key is based on the authentication response last given to the peer
  811.    during tunnel creation (the details of tunnel creation are provided
  812.    in the next section).  It serves as a key during the life of a
  813.    session to resist attacks based on spoofing.  If a packet is received
  814.    in which the Key does not match the expected value, the packet MUST
  815.    be silently discarded.  Such handling takes precedence over 4.4.1.
  816.  
  817.    The Key value is generated by taking the 128-bit authentication
  818.    response from the peer, interpreting it as four adjacent 32-bit words
  819.    in network byte order, XOR'ing these words together, and using the
  820.    resulting 32-bit value as the Key.
  821.  
  822. 4.2.11 Packet priority
  823.  
  824.    If the P bit in the L2F header is set, this packet is a "priority"
  825.    packet.  When possible for an implementation, a packet received with
  826.    the P bit should be processed in preference to previously received
  827.    unprocessed packets without the P bit.
  828.  
  829.    The P bit may be set by an implementation based on criteria beyond
  830.    the scope of this specification.  However, it is recommended that PPP
  831.    keepalive traffic, if any, be sent with this bit set.
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845. INTERNET DRAFT 
  846.  
  847.  
  848. 4.3 L2F Tunnel Establishment
  849.  
  850.    When the point-to-point link is first initiated between the NAS and
  851.    the Home Gateway, the endpoints communicate on MID 0 prior to
  852.    providing general L2F services to clients.  This communication is
  853.    used to verify the presence of L2F on the remote end, and to permit
  854.    any needed authentication.
  855.  
  856.    The protocol for such negotiation is always 1, indicating L2F
  857.    management.  The message itself is structured as a sequence of single
  858.    octets indicating an option, followed by zero or more further octets
  859.    formatted as needed for the option.
  860.  
  861. 4.3.1 Normal Tunnel Negotiation Sequence
  862.  
  863.    The establishment sequence is best illustrated by a "typical"
  864.    connection sequence.  Detailed description of each functions follows,
  865.    along with descriptions of the handling of exceptional conditions.
  866.  
  867.    Each packet is described as a source->destination on one line, a
  868.    description of the L2F packet field contents on the next, and the
  869.    contents of the packet's body on following lines.  The exact encoding
  870.    of octets will be described later.
  871.  
  872.    Note that this example uses the Key option, but does not use the
  873.    Offset and Checksum options.  The Length field would be present,
  874.    reflecting the actual length of the packets as encoded as an octet
  875.    stream.
  876.  
  877.       1. NAS->GW:
  878.           Proto=L2F, Seq=0, MID=0, CLID=0, Key=0
  879.           L2F_CONF
  880.               Name: NAS_name
  881.               Challenge: Rnd
  882.               Assigned_CLID: 22
  883.  
  884.    The NAS decides that a tunnel must be initiated from the NAS to the
  885.    GW.  An L2F packet is sent with the Proto field indicating an L2F
  886.    management message is contained.
  887.  
  888.    Because the tunnel is being initiated, Key is set to 0.  The sequence
  889.    number starts at 0; the MID is 0 to reflect the establishment of the
  890.    tunnel itself.  Since the NAS has not yet received an L2F_CONF, the
  891.    CLID is set to 0.
  892.  
  893.    The body of the packet specifies the claimed name of the NAS, and a
  894.    challenge random number which GW will use in authenticating itself as
  895.    a valid tunnel endpoint.  Assigned_CLID is generated to be a value
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905. INTERNET DRAFT  
  906.  
  907.  
  908.    not currently assigned out to any other tunnel to any other Home
  909.    Gateway.
  910.  
  911.       2. GW->NAS:
  912.           Proto=L2F, Seq=0, MID=0, CLID=22, Key=0
  913.           L2F_CONF
  914.               Name: GW_name
  915.               Challenge: Rnd2
  916.               Assigned_CLID: 73
  917.  
  918.    The Home Gateway has processed the previous packet, and sends a
  919.    response.  The protocol continues to be L2F, with a sequence number 0
  920.    (each side maintains its own sequence number for transmissions).  MID
  921.    continues to be 0 to reflect tunnel establishment.  CLID reflects the
  922.    Assigned_CLID field of the L2F_CONF received.  The Key continues to
  923.    be 0 during this phase of tunnel establishment.
  924.  
  925.    The body contains the Home Gateway's name, its own random number
  926.    challenge, and its own Assigned_CLID for the NAS to place in the CLID
  927.    field of future packets.  The CLID is generated in an analogous
  928.    manner to that of the NAS.  After this, all packets received from the
  929.    NAS must be tagged with a CLID field containing 73, and all packets
  930.    sent to the NAS must be tagged with a CLID field containing 22.
  931.  
  932.       3. NAS->GW
  933.           Proto=L2F, Seq=1, MID=0, CLID=73, Key=C(Rnd2)
  934.           L2F_OPEN
  935.               Response: C(Rnd2)
  936.  
  937.    The NAS responds with its Key now set to reflect the shared secret.
  938.    The Key is a CHAP-style hash of the random number received; each
  939.    packet hereafter will reflect this calculated value, which serves as
  940.    a key for the life of the tunnel.  Both the Home Gateway and the NAS
  941.    use such Keys for the life of the tunnel.  The Key is a 32-bit
  942.    representation of the MD5 digest resulting from encrypting the shared
  943.    secret; the full MD5 digest is included in the L2F_OPEN response, in
  944.    the "response" field.
  945.  
  946.       4. GW->NAS
  947.           Proto=L2F, Seq=1, MID=0, CLID=22, Key=C(Rnd)
  948.           L2F_OPEN
  949.               Response: C(Rnd)
  950.  
  951.    The Home Gateway provides closure of the key from the NAS, reflected
  952.    in both the Key field as well as the "response" field.  The tunnel is
  953.    now available for clients to be established.
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965. INTERNET DRAFT   
  966.  
  967.  
  968. 4.3.2 Normal Client Negotiation Sequence
  969.  
  970.    This section describes the establishment of a Virtual dial-up client
  971.    on a NAS into a Home Gateway.  It assumes a tunnel has been created
  972.    in the way described in 4.3.1.  The client for this example is a PPP
  973.    client configured for CHAP.
  974.  
  975.    Treatment of Checksum, Length, and Offset are as in 4.3.1.
  976.  
  977.       1. NAS->GW
  978.           Proto=L2F, Seq=2, MID=1, CLID=73, Key=C(Rnd2)
  979.           L2F_OPEN
  980.               Type: CHAP
  981.               Name: CHAP-name
  982.               Challenge: Rnd3
  983.               Response: <Value received, presumably C(Rnd3)>
  984.               ID: <ID used in challenge>
  985.  
  986.    The NAS has received a call, tried CHAP with a challenge value of
  987.    Rnd3, and found that the client responded.  The claimed name lead the
  988.    NAS to believe it was a Virtual dial-up client hosted by the Home
  989.    Gateway.  The next free MID is allocated, and the information
  990.    associated with the CHAP challenge/response is included in the
  991.    connect notification.
  992.  
  993.       2. GW->NAS
  994.           Proto=L2F, Seq=2, MID=1, CLID=22, Key=C(Rnd)
  995.           L2F_OPEN
  996.  
  997.    The Home Gateway, by sending back the L2F_OPEN, accepts the client.
  998.  
  999.       3. NAS->GW
  1000.           Proto=PPP, Seq=0, MID=1, CLID=73, Key=C(Rnd2)
  1001.           <Frame follows>
  1002.  
  1003.       4. GW->NAS
  1004.           Proto=PPP, Seq=0, MID=1, CLID=22, Key=C(Rnd)
  1005.           <Frame follows>
  1006.  
  1007.    Traffic is now free to flow in either direction as sent by the remote
  1008.    client or the home site.  The contents is uninterpreted data, HDLC in
  1009.    this case.  Data traffic, since it is not the L2F protocol, does not
  1010.    usually use the Seq field, which is set to 0 in non-L2F messages (see
  1011.    the S bit in section 4.2.5 for details on an exception to this).
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025. INTERNET DRAFT
  1026.  
  1027.  
  1028. 4.4 L2F management message types
  1029.  
  1030.    When an L2F packet's Proto field specifies L2F management, the body
  1031.    of the packet is encoded as zero or more options.  An option is a
  1032.    single octet "message type", followed by zero or more sub-options.
  1033.    Each sub-option is a single byte sub-option value, and further bytes
  1034.    as appropriate for the sub-option.
  1035.  
  1036.    Options in L2F are:
  1037.  
  1038.  
  1039.       Hex Value       Abbreviation          Description
  1040.       --------        ------------          -----------
  1041.       0x00            Invalid               Invalid message
  1042.       0x01            L2F_CONF              Request configuration
  1043.           0x02            L2F_CONF_NAME     Name of peer sending L2F_CONF
  1044.           0x03            L2F_CONF_CHAL     Random number peer challenges with
  1045.           0x04            L2F_CONF_CLID     Assigned_CLID for peer to use
  1046.       0x02            L2F_OPEN              Accept configuration
  1047.           0x01            L2F_OPEN_NAME     Name received from client
  1048.           0x02            L2F_OPEN_CHAL     Challenge client received
  1049.           0x03            L2F_OPEN_RESP     Challenge response from client
  1050.           0x04            L2F_ACK_LCP1      LCP CONFACK accepted from client
  1051.           0x05            L2F_ACK_LCP2      LCP CONFACK sent to client
  1052.           0x06            L2F_OPEN_TYPE     Type of authentication used
  1053.           0x07            L2F_OPEN_ID       ID associated with authentication
  1054.           0x08            L2F_REQ_LCP0      First LCP CONFREQ from client
  1055.       0x03            L2F_CLOSE             Request disconnect
  1056.           0x01            L2F_CLOSE_WHY     Reason code for close
  1057.           0x02            L2F_CLOSE_STR     ASCII string description
  1058.       0x04            L2F_ECHO              Verify presence of peer
  1059.       0x05            L2F_ECHO_RESP         Respond to L2F_ECHO
  1060.  
  1061.  
  1062. 4.4.1 L2F message type: Invalid
  1063.  
  1064.    If a message is received with this value, or any value higher than
  1065.    the last recognized option value, or if an illegal packet as defined
  1066.    by other parts of this specification is received, the packet is
  1067.    considered invalid.  The packet MUST be discarded, and an L2F_CLOSE
  1068.    of the entire tunnel MUST be requested.  Upon receipt of an
  1069.    L2F_CLOSE, the tunnel itself may be closed.  All other received
  1070.    message MUST be discarded.  An implementation MAY close the tunnel
  1071.    after an interval of time appropriate to the characteristics of the
  1072.    tunnel.
  1073.  
  1074.    Note that packets with an invalid Key are discarded, but disconnect
  1075.    is not initiated.  This prevents denial-of-service attacks.
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085. INTERNET DRAFT
  1086.  
  1087.  
  1088.    Invalid option types within a message MUST be treated as if the
  1089.    entire message type was invalid.
  1090.  
  1091. 4.4.2 L2F_CONF
  1092.  
  1093.    The L2F message type is used to establish the tunnel between the NAS
  1094.    and the Home Gateway.  MID is always set to 0.  The body of such a
  1095.    message starts with the octet 0x01 (L2F_CONF), followed by all three
  1096.    of the sub-options below.
  1097.  
  1098.    The L2F_CONF_NAME sub-option MUST be present.  It is encoded as the
  1099.    octet value 0x02, followed by an octet specifying a non-zero length,
  1100.    followed by the indicated number of bytes, which are interpreted as
  1101.    the sender's ASCII name.
  1102.  
  1103.    The L2F_CONF_CHAL sub-option MUST be present.  It is encoded as the
  1104.    octet value 0x03, followed by a non-zero octet, followed by a number
  1105.    of bytes specified by this non-zero octet.
  1106.  
  1107.    The challenge value should be generated using whatever techniques
  1108.    provide the highest quality of random numbers available to a given
  1109.    implementation.
  1110.  
  1111.    The L2F_CONF_CLID sub-option MUST be present.  It is encoded as the
  1112.    octet 0x04, followed by four bytes of Assigned_CLID value.  The
  1113.    Assigned_CLID value is generated as a non-zero 16-bit integer value
  1114.    unique across all tunnels which exist on the sending system.  The
  1115.    least significant two octets of Assigned_CLID are set to this value,
  1116.    and the most significant two octets MUST be set to 0.
  1117.  
  1118.    The CLID field is sent as 0 in the initial L2F_CONF packet from NAS
  1119.    to Home Gateway, and otherwise MUST be sent containing the value
  1120.    specified in the Assigned_CLID field of the last L2F_CONF message
  1121.    received.
  1122.  
  1123.    Key MUST be set to 0 in all L2F_CONF packets, and no key field is
  1124.    included in the packet.
  1125.  
  1126.    When sent from a NAS to a Home Gateway, the L2F_CONF is the initial
  1127.    packet in the conversation.
  1128.  
  1129.    When sent from the Home Gateway to the NAS, an L2F_CONF indicates the
  1130.    Home Gateway's recognition of the tunnel creation request.  The Home
  1131.    Gateway MUST provide its name and its own challenge in the message
  1132.    body.
  1133.  
  1134.    In all packets following the L2F_CONF, the Key MUST be set to the
  1135.    CHAP-style hash of the received challenge bytes.  The CHAP-style hash
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145. INTERNET DRAFT 
  1146.  
  1147.  
  1148.    is done over the concatenation of the low 8 bits of the assigned
  1149.    CLID, the secret, and the challenge value.  Generation of the 32-bit
  1150.    key value is discussed in section 4.2.11.
  1151.  
  1152. 4.4.3 L2F_OPEN, tunnel establishment
  1153.  
  1154.    The L2F_OPEN message is used to provide tunnel setup closure (for a
  1155.    MID of 0) or to establish a client connection within a tunnel
  1156.    previously established by L2F_CONF and L2F_OPEN messages (MID not
  1157.    equal to 0).  This section describes tunnel establishment; section
  1158.    4.4.4 following describes clients established within the tunnel.
  1159.  
  1160.    An L2F_OPEN for tunnel establishment MUST contain only the sub-option
  1161.    0x03, L2F_OPEN_RESP.  This option MUST be followed by the octet 0x10,
  1162.    specifying the size of the 128-bit MD5 digest resulting from
  1163.    encrypting the challenge value in the L2F_CONF, along with the low
  1164.    byte of the Assigned_CLID.  After this byte MUST be the sixteen bytes
  1165.    of the generated MD5 digest.
  1166.  
  1167.    If during tunnel establishment an L2F_OPEN is received with an
  1168.    incorrect L2F_OPEN_RESP, the packet MUST be silently discarded.  It
  1169.    is recommended that such an event generate a log event as well.
  1170.  
  1171. 4.4.4 L2F_OPEN, client establishment
  1172.  
  1173.    An L2F_OPEN (with non-zero MID) sent from the NAS to the Home Gateway
  1174.    indicates the presence of a new dial-in client.  When sent back from
  1175.    the Home Gateway to the NAS, it indicates acceptance of the client.
  1176.    This message starts with the octet 0x02.  When sent from the NAS, it
  1177.    may contain further sub-options.  When sent from the Home Gateway, it
  1178.    may not contain any sub-options.  All further discussion of sub-
  1179.    options in this section apply only to the NAS to Home Gateway
  1180.    direction.
  1181.  
  1182.    The L2F_OPEN_TYPE sub-option MUST be present.  It is encoded as the
  1183.    octet 0x06, followed by a single byte describing the type of
  1184.    authentication the NAS exchanged with the client in detecting the
  1185.    client's claimed identification.  Implicit in the authentication type
  1186.    is the encapsulation to be carried over the life of the session.  The
  1187.    authentication types are:
  1188.  
  1189.       0x01 Textual username/password exchange for SLIP
  1190.       0x02 PPP CHAP
  1191.       0x03 PPP PAP
  1192.       0x04 PPP no authentication
  1193.       0x05 SLIP no authentication
  1194.  
  1195.    The L2F_OPEN_NAME sub-option is encoded as the octet 0x01, followed
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205. INTERNET DRAFT 
  1206.  
  1207.  
  1208.    by an octet specifying the length of the name, followed by the
  1209.    indicated number of bytes of the name.  This field MUST be present
  1210.    for any authentication type except 0x04 (None).  It MUST contain the
  1211.    name specified in the client's authentication response.
  1212.  
  1213.    The L2F_OPEN_CHAL sub-option is encoded as the octet 0x02, followed
  1214.    by an octet specifying the length of the challenge sent, followed by
  1215.    the challenge itself.  This field is only present for CHAP, and MUST
  1216.    contain the challenge value sent to the client by the NAS.
  1217.  
  1218.    The L2F_OPEN_RESP sub-option is encoded as the octet 0x03, followed
  1219.    by an octet specifying the length of the response received, followed
  1220.    by the client's response to the challenge.  For CHAP, this field
  1221.    contains the response value received by the NAS.  For PAP or textual
  1222.    authentication, it contains the clear text password received from the
  1223.    client by the NAS.  This field is absent for authentication 0x04
  1224.    "None".
  1225.  
  1226.    The L2F_ACK_LCP1 and L2F_ACK_LCP2 sub-options are encoded as the
  1227.    octets 0x04 and 0x05 respectively, followed in either case by two
  1228.    octets in network byte order specifying the length of the LCP CONFACK
  1229.    last received from or sent to the client.  Following these octets is
  1230.    an exact copy of the CONFACK packet.  L2F_ACK_LCP1 specifies a copy
  1231.    of the closing CONFACK received from the client, and L2F_ACK_LCP2
  1232.    specifies a copy of the closing CONFACK sent to the client by the
  1233.    NAS.
  1234.  
  1235.    The L2F_REQ_LCP0 sub-option is encoded as the octet 0x08, followed by
  1236.    two octets in network byte order specifying the length of the LCP
  1237.    CONFREQ initially received from the client.  This may be used by the
  1238.    Home Gateway to detect capabilities of the client which were
  1239.    negotiated away while starting LCP with the NAS.  Detection of such
  1240.    options may be used by the Home Gateway to decide to renegotiate LCP.
  1241.  
  1242.    The L2F_OPEN_ID sub-option is encoded as the octet 0x06, followed by
  1243.    a single octet.  This sub-option is only present for CHAP; the single
  1244.    octet contains the CHAP Identifier value sent to the client during
  1245.    the CHAP challenge.
  1246.  
  1247.    The Home Gateway may choose to ignore any sub-option of the L2F_OPEN,
  1248.    and accept the connection anyway.  The Home Gateway would then have
  1249.    to undertake its own LCP negotiations and authentication.  To
  1250.    maximize the transparency of the L2F tunnel, it is recommended that
  1251.    extra negotiations and authentication be avoided if possible.
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265. INTERNET DRAFT  
  1266.  
  1267.  
  1268. 4.4.5 L2F_CLOSE
  1269.  
  1270.    This message is encoded as the byte 0x03.  An L2F_CLOSE may be sent
  1271.    by either side of the tunnel at any time.  When sent with MID of 0,
  1272.    it indicates the desire to terminate the entire tunnel and all
  1273.    clients within the tunnel.  When sent from the Home Gateway in
  1274.    response to an L2F_OPEN, it indicates that the Home Gateway has
  1275.    declined the connection.  When sent with a non-zero MID, it indicates
  1276.    the termination of that client within the tunnel.
  1277.  
  1278.    The L2F_CLOSE_WHY sub-option is encoded as the byte 0x01 followed
  1279.    four bytes in network byte order specifying a bit mask of reasons for
  1280.    the disconnection.  The bits are encoded as:
  1281.  
  1282.  
  1283.       0x00000001 Authentication failed
  1284.       0x00000002 Out of resources
  1285.       0x00000004 Administrative intervention
  1286.       0x00000008 User quota exceeded
  1287.       0x00000010 Protocol error
  1288.       0x00000020 Unknown user
  1289.       0x00000040 Incorrect password
  1290.       0x00000080 PPP configuration incompatible
  1291.       0x00000100 Wrong multilink PPP destination
  1292.  
  1293.  
  1294.    Bits in the mask 0xFF000000 are reserved for per-vendor
  1295.    interpretation.
  1296.  
  1297.    An implementation can choose to not provide status bits even if it
  1298.    detects a condition described by one of these bits.  For instance, an
  1299.    implementation may choose to not use 0x00000020 due to security
  1300.    considerations, as it can be used to probe user name space.
  1301.  
  1302.    The L2F_CLOSE_STR sub-option is encoded as the byte 0x02, followed by
  1303.    a two-byte length in network byte order, followed by the indicated
  1304.    number of bytes, which are interpreted as descriptive ASCII text
  1305.    associated with the disconnection.  This string may be ignored, but
  1306.    could be recorded in a log to provide detailed or auxiliary
  1307.    information associated with the L2F_CLOSE.
  1308.  
  1309. 4.4.6 L2F_ECHO
  1310.  
  1311.    Transmission of L2F_ECHO messages is optional.  If an implementation
  1312.    transmits L2F_ECHO messages, it MUST not transmit more than one such
  1313.    request each second.  The payload size MUST be 64 bytes or less in
  1314.    length.  It is recommended that at least 5 L2F_ECHO messages be sent
  1315.    without response before an implementation assumes that its peer has
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325. INTERNET DRAFT
  1326.  
  1327.  
  1328.    terminated.
  1329.  
  1330.    The L2F_ECHO message is encoded as the single byte 0x04.  It may be
  1331.    sent by either side once the tunnel is established.  MID MUST be 0.
  1332.    An L2F_ECHO_RESP (documented below) MUST be sent back in response.
  1333.  
  1334. 4.4.7 L2F_ECHO_RESP
  1335.  
  1336.    All implementations MUST respond to L2F_ECHO, using L2F_ECHO_RESP.
  1337.    The received packet MUST be sent back verbatim, except that the CLID,
  1338.    sequence number, and checksum (if any) MUST be updated, and the
  1339.    L2F_ECHO message type changed to an L2F_ECHO_RESP.  Payload data
  1340.    following the 0x04 octet, if any, MUST be preserved in the response.
  1341.  
  1342.    When an L2F_ECHO_RESP is received, the payload data may be used to
  1343.    associate this response with a previously sent L2F_ECHO, or the
  1344.    packet may be silently discarded.
  1345.  
  1346. 4.5 L2F Message Delivery
  1347.  
  1348.    L2F is designed to operate over point-to-point unreliable links.  It
  1349.    is not designed to provide flow control of the data traffic, nor does
  1350.    it provide reliable delivery of this traffic; each protocol tunnel
  1351.    carried via L2F is expected to manage flow control and retry itself.
  1352.    Thus, it is only L2F control messages which must be retransmitted;
  1353.    this process is described in this section.
  1354.  
  1355. 4.5.1 Sequenced delivery
  1356.  
  1357.    All L2F control messages (i.e., those L2F packets with a protocol
  1358.    type of 0x01) are transmitted with a sequence number.  The sequence
  1359.    number is a per-L2F tunnel free running counter which is incremented
  1360.    (modulo 256) after each packet is transmitted.  It is used to permit
  1361.    the receiving end to detect duplicated or out-of-order packets, and
  1362.    to discard such packets.  Section 4.2.5 describes the process in
  1363.    detail.
  1364.  
  1365. 4.5.2 Flow control
  1366.  
  1367.    L2F control messages are expected to be exchanged lock-step.  Thus,
  1368.    per-client activities can not occur until tunnel setup is complete.
  1369.    Neither can one client be serviced until the L2F message exchange is
  1370.    complete for a previous client.  Thus, it is expected that rarely--if
  1371.    ever--should a flow control action be required.  If the input queue
  1372.    of L2F control messages reaches an objectionable level for an
  1373.    implementation, the implementation may silently discard all messages
  1374.    in the queue to stabilize the situation.
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385. INTERNET DRAFT
  1386.  
  1387.  
  1388. 4.5.3 Tunnel State table
  1389.  
  1390.    The following enumerates the handling of L2F messages for tunnel
  1391.    creation in state table format.  Events name an L2F_ message type
  1392.    (the L2F_ portion of the named message is omitted to permit a more
  1393.    compact table).  A start ("*") matches any event not otherwise
  1394.    matched for the named state.
  1395.  
  1396.    A NAS starts at initial state Start0, sending a packet before waiting
  1397.    for its first event.  A Home Gateway starts at Start1, waiting for an
  1398.    initial packet to start service.
  1399.  
  1400.    If an event is not matched for a given state, the packet associated
  1401.    with that event is silently discarded.
  1402.  
  1403.    Tunnel establishment (MID == 0), NAS side.
  1404.  
  1405.  
  1406.       State   Event           Action                  New State
  1407.       -----   -----           ------                  ---------
  1408.       Start0                  Send CONF               Start1
  1409.       Start1  CONF            Send OPEN               Start2
  1410.       Start1  timeout 1-3     Send CONF               Start1
  1411.       Start1  timeout 4       Clean up tunnel         (done)
  1412.       Start2  OPEN            (initiate 1st client)   Open1
  1413.       Start2  timeout 1-3     Send OPEN               Start2
  1414.       Start2  timeout 4       Clean up tunnel         (done)
  1415.       Open1   OPEN            Send OPEN               Open1
  1416.       Open1   CLOSE           Send CLOSE              Close1
  1417.       Open1   no MIDs open    Send CLOSE              Close2
  1418.       Close1  CLOSE           Send CLOSE              Close1
  1419.       Close1  timeout 4       Clean up tunnel         (done)
  1420.       Close2  CLOSE           Clean up tunnel         (done)
  1421.       Close2  timeout 1-3     Send CLOSE              Close2
  1422.       Close2  timeout 4       Clean up tunnel         (done)
  1423.  
  1424.    Tunnel establishment (MID == 0), Home Gateway side.
  1425.  
  1426.       State   Event           Action                  New State
  1427.       -----   -----           ------                  ---------
  1428.       Start0  CONF            Send CONF               Start1
  1429.       Start1  CONF            Send CONF               Start1
  1430.       Start1  OPEN            Send OPEN               Open1
  1431.       Start1  timeout 4       Clean up tunnel         (done)
  1432.       Open1   OPEN            Send OPEN               Open1
  1433.       Open1   OPEN (MID > 0)  (1st client, below)     Open2
  1434.       Open1   CLOSE           Send CLOSE              Close1
  1435.       Open1   timeout 4       Clean up tunnel         (done)
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445. INTERNET DRAFT  
  1446.  
  1447.  
  1448.       Open2   OPEN (MID > 0)  (below)                 Open2
  1449.       Open2   CLOSE           Send CLOSE              Close1
  1450.       Close1  CLOSE           Send CLOSE              Close1
  1451.       Close1  timeout 4       Clean up tunnel         (done)
  1452.  
  1453.  
  1454. 4.5.4 Client State table
  1455.  
  1456.    This table is similar to the previous one, but enumerates the states
  1457.    for a client connection within a tunnel in the opened state from
  1458.    4.5.3.  As this sequence addresses clients, MID will be non-zero.
  1459.  
  1460.    Client establishment (MID != 0), NAS side.
  1461.  
  1462.       State   Event           Action                  New State
  1463.       -----   -----           ------                  ---------
  1464.       Start0                  Send OPEN               Start1
  1465.       Start1  OPEN            (enable forwarding)     Open1
  1466.       Start1  CLOSE           Clean up MID            (MID done)
  1467.       Start1  timeout 1-3     Send OPEN               Start1
  1468.       Start1  timeout 4       Clean up MID            (MID done)
  1469.       Start1  client done     Send CLOSE              Close2
  1470.       Open1   OPEN            (no change)             Open1
  1471.       Open1   CLOSE           Send CLOSE              Close1
  1472.       Open1   client done     Send CLOSE              Close2
  1473.       Close1  CLOSE           Send CLOSE              Close1
  1474.       Close1  timeout 4       Clean up MID            (MID done)
  1475.       Close2  CLOSE           Clean up MID            (MID done)
  1476.       Close2  timeout 1-3     Send CLOSE              Close2
  1477.       Close2  timeout 4       Clean up MID            (MID done)
  1478.  
  1479.    Client establishment (MID != 0), Home Gateway side.
  1480.  
  1481.       State   Event           Action                  New State
  1482.       -----   -----           ------                  ---------
  1483.       Start0  OPEN            Send OPEN               Open1
  1484.       Start0  OPEN (fail)     Send CLOSE              Close3
  1485.       Open1   OPEN            Send OPEN               Open1
  1486.       Open1   CLOSE           Send CLOSE              Close1
  1487.       Open1   client done     Send CLOSE              Close2
  1488.       Close1  CLOSE           Send CLOSE              Close1
  1489.       Close1  timeout 4       Clean up MID            (MID done)
  1490.       Close2  CLOSE           Clean up MID            (MID done)
  1491.       Close2  timeout 1-3     Send CLOSE              Close2
  1492.       Close2  timeout 4       Clean up MID            (MID done)
  1493.       Close3  OPEN            Send CLOSE              Close3
  1494.       Close3  timeout 4       Clean up MID            (MID done)
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505. INTERNET DRAFT 
  1506.  
  1507.  
  1508. 5. Protocol Considerations
  1509.  
  1510.    Several aspects of operation over L2F, while outside the realm of the
  1511.    protocol description itself, serve to clarify the operation of L2F.
  1512.  
  1513. 5.1 PPP Features
  1514.  
  1515.    Because L2F in operation carries uninterpreted frames, it permits
  1516.    operation of features without explicit knowledge of these features.
  1517.    For instance, if a PPP session is carried, L2F is simply transporting
  1518.    HDLC frames.  The two PPP endpoints can negotiate higher-level
  1519.    features, such as reliable link, compression, multi-link, or
  1520.    encryption.  These features then operate between the two PPP
  1521.    endpoints (the dial-in client on one end, and the Home Gateway on the
  1522.    other), with L2F continuing to simply ship HDLC frames back and
  1523.    forth.
  1524.  
  1525.    For similar reasons, PPP echo requests, NCP configuration
  1526.    negotiation, and even termination requests, are all simply tunneled
  1527.    HDLC frames.
  1528.  
  1529. 5.2 Termination
  1530.  
  1531.    As L2F simply tunnels link-layer frames, it does not detect frames
  1532.    like PPP TERMREQ.  L2F termination in these scenarios is driven from
  1533.    a protocol endpoint; for instance, if a Home Gateway receives a
  1534.    TERMREQ, its action will be to "hang up" the PPP session.  It is the
  1535.    responsibility of the L2F implementation at the Home Gateway to
  1536.    convert a "hang up" into an L2F_CLOSE action, which will shut down
  1537.    client's session in the tunnel cleanly.  L2F_CLOSE_WHY and
  1538.    L2F_CLOSE_STR may be included to describe the reason for the
  1539.    shutdown.
  1540.  
  1541. 5.3 Extended Authentication
  1542.  
  1543.    L2F is compatible with both PAP and CHAP protocols.  SLIP does not
  1544.    provide authentication within the protocol itself, and thus requires
  1545.    an ASCII exchange of username and password before SLIP is started.
  1546.    L2F is compatible with this mode of operation as well.
  1547.  
  1548.    One-time password cards have become very common.  To the extent the
  1549.    NAS can capture and forward the one-time password, L2F operation is
  1550.    compatible with password cards.  For the most general solution, an
  1551.    arbitrary request/response exchange must be supported.  In an L2F
  1552.    environment, the protocol must be structured so that the NAS can
  1553.    detect the apparent identity of the user and establish a tunnel
  1554.    connection to the Home Gateway, where the arbitrary exchange can
  1555.    occur.
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565. INTERNET DRAFT 
  1566.  
  1567.  
  1568. 5.4 MNP4 and Apple Remote Access Protocol
  1569.  
  1570.    L2F appears compatible with Apple's ARAP protocol.  Its operation
  1571.    under L2F has not been described simply because this experimental 
  1572.    document does not have a corresponding implementation of such operation.
  1573.  
  1574. 5.5 Operation of IP and UDP
  1575.  
  1576.    L2F tries to be self-describing, operating at a level above the
  1577.    particular media over which it is carried.  However, some details of
  1578.    its connection to media are required to permit interoperable
  1579.    implementations.  This section describes the issues which have been
  1580.    found when operating L2F over IP and UDP.
  1581.  
  1582.    L2F uses the well-known UDP port 1701 [4].  The entire L2F packet,
  1583.    including payload and L2F header, is sent within a UDP datagram.  The
  1584.    source and destination ports are the same (1701), with demultiplexing
  1585.    being achieved using CLID values.  It is legal for the source IP
  1586.    address of a given CLID to change over the life of a connection, as
  1587.    this may correspond to a peer with multiple IP interfaces responding
  1588.    to a network topology change.  Responses should reflect the last
  1589.    source IP address for that CLID.
  1590.  
  1591.    IP fragmentation may occur as the L2F packet travels over the IP
  1592.    substrate.  L2F makes no special efforts to optimize this.  A NAS
  1593.    implementation MAY cause its LCP to negotiate for a specific MRU,
  1594.    which could optimize for NAS environments in which the MTUs of the
  1595.    path over which the L2F packets are likely to travel have a
  1596.    consistent value.
  1597.  
  1598. 6.0 Acknowledgments
  1599.  
  1600.    L2F uses a packet format inspired by GRE [5].  Thanks to Fred Baker
  1601.    for consultation, Dave Carrel for consulting on security aspects, and
  1602.    to Paul Traina for philosophical guidance.
  1603.  
  1604. 7.0 References
  1605.  
  1606.    [1] J. Romkey, "A Nonstandard for Transmission of IP Datagrams over
  1607.       Serial Lines: SLIP", RFC 1055, June 1988
  1608.  
  1609.    [2] W. Simpson, "The Point-to-Point Protocol (PPP)", RFC 1661,
  1610.       07/21/1994
  1611.  
  1612.    [3] W. Simpson, "PPP in HDLC-like Framing", RFC 1662,
  1613.       07/1994
  1614.  
  1615.    [4] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC 1340,
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625. INTERNET DRAFT                 
  1626.  
  1627.  
  1628.       USC/Information Sciences Institute, July 1992.
  1629.  
  1630.    [5] S. Hanks, T. Li, D. Farinacci, P. Traina, "Generic Routing
  1631.       Encapsulation (GRE)", RFC 1701, 10/21/1994
  1632.  
  1633. 8.0 Authors' Addresses
  1634.  
  1635.    Tim Kolar
  1636.    Morgan Littlewood
  1637.    Andy Valencia
  1638.    Cisco Systems
  1639.    170 West Tasman Drive
  1640.    San Jose CA 95134-1706
  1641.    tkolar@cisco.com
  1642.    littlewo@cisco.com
  1643.    valencia@cisco.com
  1644.  
  1645. INTERNET DRAFT        EXPIRES APRIL 1998        INTERNET DRAFT
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680. Valencia                 expires September 1997                 [Page 28]
  1681.  
  1682.  
  1683.  
  1684.