HDLC-like encoding and automatically escaping LCP Control Packets - PPP

This is a discussion on HDLC-like encoding and automatically escaping LCP Control Packets - PPP ; I am currently developing a PPP stack that utilizes HDLC-like Framing for the serial encode. As a learning tool, I am studying code from an existing pppd stack, and am confused by 1 thing. In the stack I am studying ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: HDLC-like encoding and automatically escaping LCP Control Packets

  1. HDLC-like encoding and automatically escaping LCP Control Packets

    I am currently developing a PPP stack that utilizes HDLC-like Framing
    for the serial encode. As a learning tool, I am studying code from an
    existing pppd stack, and am confused by 1 thing.

    In the stack I am studying (Opensource Stack, used on Linux/Solaris
    etc), inside the encoding function the code checks to see if the
    payload from the PPP Layer is a LCP packet.

    Here is the comment and check

    /*
    * All control characters must be escaped for LCP packets with code
    * values between 1 (Conf-Req) and 7 (Code-Rej).
    */
    is_lcp = ((MSG_BYTE(mp, 0) == PPP_ALLSTATIONS) &&
    (MSG_BYTE(mp, 1) == PPP_UI) &&
    (MSG_BYTE(mp, 2) == (PPP_LCP >> 8)) &&
    (MSG_BYTE(mp, 3) == (PPP_LCP & 0xff)) &&
    LCP_USE_DFLT(mp));


    Later on, if is_lcp is true, the local ACCM is updated (For this frame
    only) to force escape characters on 0x00 - 0x1f. I understand what they
    are doing, what confuses me is that the RFCs (1661/1662) make NO
    reference to a requirement to escape all control characters in LCP
    Packets to begin with. Is this just a safer way of doing things ? If
    so, why only codes 1-7 ? Why not 8 9 10 and 11 ?

    -Chris


  2. Re: HDLC-like encoding and automatically escaping LCP Control Packets

    In article <1140713639.444475.235410@o13g2000cwo.googlegroups. com>,
    Chris wrote:
    >I am currently developing a PPP stack that utilizes HDLC-like Framing
    >for the serial encode. As a learning tool, I am studying code from an
    >existing pppd stack, and am confused by 1 thing.
    >
    >In the stack I am studying (Opensource Stack, used on Linux/Solaris
    >etc), inside the encoding function the code checks to see if the
    >payload from the PPP Layer is a LCP packet.
    >
    >Here is the comment and check
    >
    > /*
    > * All control characters must be escaped for LCP packets with code
    > * values between 1 (Conf-Req) and 7 (Code-Rej).
    > */
    > is_lcp = ((MSG_BYTE(mp, 0) == PPP_ALLSTATIONS) &&
    > (MSG_BYTE(mp, 1) == PPP_UI) &&
    > (MSG_BYTE(mp, 2) == (PPP_LCP >> 8)) &&
    > (MSG_BYTE(mp, 3) == (PPP_LCP & 0xff)) &&
    > LCP_USE_DFLT(mp));
    >
    >
    >Later on, if is_lcp is true, the local ACCM is updated (For this frame
    >only) to force escape characters on 0x00 - 0x1f. I understand what they
    >are doing, what confuses me is that the RFCs (1661/1662) make NO
    >reference to a requirement to escape all control characters in LCP
    >Packets to begin with. Is this just a safer way of doing things ? If
    >so, why only codes 1-7 ?


    Note in RFC 1661 section 5 (LCP Packet Formats):

    Regardless of which Configuration Options are enabled, all LCP Link
    Configuration, Link Termination, and Code-Reject packets (codes 1
    through 7) are always sent as if no Configuration Options were
    negotiated. In particular, each Configuration Option specifies a
    default value. This ensures that such LCP packets are always
    recognizable, even when one end of the link mistakenly believes the
    link to be open.

    This implies that all LCP packets (with codes 1 through 7) should be sent
    as if the ACCM is set to the default value of 0xffffffff.

    >Why not 8 9 10 and 11 ?


    Probably because codes 1 thru 7 are used (necessary) to configure the link.

    Patrick
    =========== For PPP Protocol Analysis, check out PacketView Pro! ===========
    Patrick Klos Email: patrick@klos.com
    Klos Technologies, Inc. Web: http://www.klos.com/
    ==================== http://www.loving-long-island.com/ ====================

  3. Re: HDLC-like encoding and automatically escaping LCP Control Packets

    Well thats it! Thanks

    Not sure how I missed that, though I have been spending most of my time
    in rfc1662, and less in 1661 (Though I have read it a couple times). I
    guess I just missed it.

    THanks for the help !

    -Chris


+ Reply to Thread