The MPLS-OPS Archive

Cell Relay Retreat>MPLS-OPS Archive>month:2002-Jul> msg00052



[Date Prev][Date Next][Thread Prev][Thread Next]  
  [Date Index][Thread Index][Author Index][Subject Index]

Re: BGP-4 Label Encoding

  • From: Rajiv Asati <rajiva@cisco.com>
  • Date: Tue, 16 Jul 2002 11:07:02 -0400
  • Cc: <mpls-ops@mplsrc.com>
  • Resent-Date: Tue, 16 Jul 2002 12:19:44 -0400
  • To: "David Mechsner" <david_mechsner@web.de>
  • X-Sender: rajiva@dingdong.cisco.com

David,

At 03:31 AM 7/16/2002, David Mechsner wrote:
Hello Mr. Asati,
 
The hex file you see is just my invention. This is not a capture from any router. I have wrote it as text file. After this I compiled it with text2pcap to an Ethereal *.cap file. Maybe I should describe my question a little bit better. I am looking for the coding of a BGP UPDATE Message with a MPLS Label in the NLRI. Is is possible that a BGP UPDATE Message transport Label information with no presence of the SNPA field?

Yes. And you could make SNPA = 0, meaning the absence of SNPA.
(Otherwise you are required to fill up the SNPA fields as per the RFC2858.)

c0      =       flag
0e      =       MP_REACH_NLRI
ff      =       Length is 255B
00 01   =       Address-family is IPv4
04      =       SAFI is 4 i.e. MPLS labeled prefix
04      =       length of NEXT_HOP address is 4B
0a 00 00 03
        =       10.0.0.3/32
00      =       SNPA    <<<<=====change here

And then you can have the NLRI field. Remember that the length is the first octet, then the label (3 octets), and then the actual prefix. Also remember that the length field refers to number of bits (not in bytes).
So if you had a 1.1.1.1/32 prefix along with the label of 17, then total no of bytes consumed=4+3=7B, i.e. 56bits i.e 0x38.

38              :       length
00 01 11        :       Label=17, bottom
01 01 01 01     :       1.1.1.1/32


Make sure to comply with the MP_REACH_NLRI attribute which is given in the RFC2858.

Hope this helps.

Rajiv


 
Thanks
 
David
----- Original Message -----
From: Rajiv Asati
To: David Mechsner
Cc: mpls-ops@mplsrc.com
Sent: Monday, July 15, 2002 8:17 PM
Subject: Re: [MPLS-OPS]: BGP-4 Label Encoding

David,

Please see inline..

At 07:05 AM 7/12/2002, David Mechsner wrote:
Hy guys,
 
I'm a student and want to learn how BGP-4 transport MPLS Label values. (RFC 3107 / RFC 2283)
I use the Ethereal  tool 'text2pcap' for generating a sample cature file.
 
Until now I generated a file for this hex code:

0000 00 01 63 44 47 81 00 05 00 f3 c4 1c 88 47 18 6f ................
0010 1d ff 45 c0 ff 3b 1e 9f 00 00 ff 06 fd 1c 0a 00 ................
0020 00 01 0a 00 00 02 00 b3 2a fb 39 7b f7 bd a5 43 ................
0030 e4 50 50 18 3e 38 e7 b1 00 00 ff ff ff ff ff ff ................
0040 ff ff ff ff ff ff ff ff ff ff 00 ff 02 00 00 00 ................
0050 ff 40 01 01 00 40 02 00 40 03 04 0a 00 00 04 c0 ................
0060 0e ff 00 01 04 04 0a 00 00 03 01 01 0a 04 00 01 ................
0070 11 00                                          ................
 
Decoding MP_REACH_NLRI:

c0 0e ff 00 01 04 04 0a 00 00 03 01 01 0a 04 00 01 11 00

c0      =       flag
0e      =       MP_REACH_NLRI
ff      =       Length is 255B
00 01   =       Address-family is IPv4
04      =       SAFI is 4 i.e. MPLS labeled prefix
04      =       length of NEXT_HOP address is 4B
0a 00 00 03
        =       10.0.0.3/32
01      =       SNPA    <<<<=====
01      =       SNPA length
0a 04 00 01 11 00

Curious about the presence of a SNPA field ? How come you have it ?

I have seen that to be typically 00.
is it a cisco router sending this BGP update ?

Would you please send me the complete message (in hex)?

Rajiv

This is a BGP UPDATE Message with Path Attributes: ORIGIN, AS_PATH, NEXT_HOP, MP_REACH_NLRI
 
MP_REACH_NLRI includes the NLRI where the label is positioned:
 
+---------------------------+
| Length (1 octet)          |
+---------------------------+
| Label (3 octets)          |
+---------------------------+
.............................
+---------------------------+
| Prefix (variable)         |
+---------------------------+
 
My NLRI is 0x 04 00 01 11 00  but Ethereal doesn't visible that.
 
legth             = 4 octet
label             = 17 (dec)
bottom of stack   = 1
prefix            = 0
 
What do I wrong?
 
Thanks David