[mpls] Label encoding in LDP

Ramakrishna Rao Desetti <ramakrishnadtv@gmail.com> Thu, 20 June 2019 10:45 UTC

Return-Path: <ramakrishnadtv@gmail.com>
X-Original-To: mpls@ietfa.amsl.com
Delivered-To: mpls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 943E912016C for <mpls@ietfa.amsl.com>; Thu, 20 Jun 2019 03:45:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hr-gFxVzXdAk for <mpls@ietfa.amsl.com>; Thu, 20 Jun 2019 03:45:31 -0700 (PDT)
Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B491C120073 for <mpls@ietf.org>; Thu, 20 Jun 2019 03:45:30 -0700 (PDT)
Received: by mail-oi1-x22f.google.com with SMTP id w196so1789579oie.7 for <mpls@ietf.org>; Thu, 20 Jun 2019 03:45:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=5Wwg7AJxJd8lLfem5IeXyeC3yPoBJkCuiuGzbe0BHGo=; b=MEzLYvYunzkZJjdgLI03xz6kYWm2E/lq5ABvBKjDutCEsw5Q4Kz/m32QbhtRQDMWoS 6fz5wEZsIArxFf+aglHC/rrpcXlHHTRroBkHltP6/hW83CDbCBr2HKoO2Ie2pCYLU1EA x6fYQdRF2x9zVnwmlxX9/sqtwh7OLn6Bu48i5SeRnuTtMi5Sx54dRPFySD68ImGW9mfO 6ZGQ03Ei7C2day57HnVgMKKb2veKDBqrfpAjEsPmFgMrc4HcRgs9A97rjhLcvc41McmK hsYb0zNaJSkLy9tUMrA07ILzS2BPyvLxt0P6DZVLGwg+KzrboBh/+4/nFHBVecaFK5bv Pa0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5Wwg7AJxJd8lLfem5IeXyeC3yPoBJkCuiuGzbe0BHGo=; b=C6M9xKi7tmxpfB0nJuLN9BoCHmLgE/pmlDbeV0P5+ZZ6macdnbPcoym/CpbQHmWYCr NN4uih3EYCS+hioB3yCrK/hlR0348Vm04/yQR69WhZLma0QP99Goq5dWs1bsroos4lJ7 lOq0Vp3PatCsUwX2oxDSGFrRpCUq3wfsBB/cXNS03vR4erMeO4Y3+HMaRc/LcU7qsJH2 ElTFxceJOzUkXqPIEq12dSIsLslLyB25DLEk4rM5CbGtw6w2HNrmS3UazcRhX6Vrcu/C TtwnQFpLJaihZXuUYqgUibq8tDf96m4cdrazM09FHcM8n0IzbFRCm6dSpkLakrnSNoVG YVBw==
X-Gm-Message-State: APjAAAVD7BV0MrAcZ4lD6dYici/0/5gYHO2fhpwaC+HVkZ2nYaxTEczW dcwWXM/W0C9V9UstmbxUVvKPCG1y0gzo6xSys4DvAAJK
X-Google-Smtp-Source: APXvYqyQ//AJVBXfbf60hZ4CsHq46mzfIpRzoLTynp8YHFDu9y8CgYmciTdYpGXNTJ+S7HCCsnHpfBQsCUcXuY3pGX8=
X-Received: by 2002:aca:f3d4:: with SMTP id r203mr5931329oih.143.1561027529777; Thu, 20 Jun 2019 03:45:29 -0700 (PDT)
MIME-Version: 1.0
From: Ramakrishna Rao Desetti <ramakrishnadtv@gmail.com>
Date: Thu, 20 Jun 2019 16:15:18 +0530
Message-ID: <CAEh1p17W5V=VZHvHdxYEN8x1dYVXdKCTNuDyEuhDND0bNJEL0A@mail.gmail.com>
To: mpls@ietf.org
Content-Type: multipart/alternative; boundary="00000000000065a6de058bbf0bb9"
Archived-At: <https://mailarchive.ietf.org/arch/msg/mpls/TdakgXG2dwD0zdHfKlAG2VmVBVc>
X-Mailman-Approved-At: Thu, 20 Jun 2019 06:48:25 -0700
Subject: [mpls] Label encoding in LDP
X-BeenThere: mpls@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Multi-Protocol Label Switching WG <mpls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/mpls>, <mailto:mpls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/mpls/>
List-Post: <mailto:mpls@ietf.org>
List-Help: <mailto:mpls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/mpls>, <mailto:mpls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Jun 2019 10:45:32 -0000

Hi,

I request a clarification on label encoding in LDP.
The reason is it appears implementations do not seem to follow what is
specified
in the LDP standard.

I have reproduced the relevant text from RFC 5036:

"
3.4.2.1.  Generic Label TLV

   An LSR uses Generic Label TLVs to encode labels for use on links for
   which label values are independent of the underlying link technology.
   Examples of such links are PPP and Ethernet.

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0|0| Generic Label (0x0200)    |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Label                                                     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Label
      This is a 20-bit label value represented as a 20-bit number in a 4
      octet field as follows:

       0                   1                   2                   3
       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Label                             |                       |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      For further information, see [RFC3032].
"

I have tested with 3 systems: Netbsd, wireshark, and a popular commercial
vendor.

In all these cases, the label is encoded as shown below:

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Label                                                     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

But from the RFC, it should be encoded as shown below:

      This is a 20-bit label value represented as a 20-bit number in a 4
      octet field as follows:

       0                   1                   2                   3
       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Label                             |                       |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Note that these two representations are not same.

For example, suppose label is 3. Then in the first representation, it is
sent
on the wire as:

0x00, 0x00, 0x00, 0x03.

Where as, in the 2nd representation, it is sent on the wire as:

0x00, 0x00, 0x30, 0x00.

Am I missing something?

I request your comments.

Thanks and regards,
Ramakrishna DTV.