摘要 |
The embodiments of the present invention provide a method and an apparatus for compressing a label stack, and the method includes that: a network device obtains a first label stack corresponding to a transferring path, and the first label stack includes a node label corresponding to each node on the transferring path; the network device selects a first node label from the firs label stack, and the node corresponding to the first node label can encapsulates a message with at least two layers of labels when transferring the message; the network device replaces at least two adjacent labels after the first node label in the first label stack with a first compression label to generate a second label stack; the network device instructs a source node on the transferring path to process the message according to the second label stack. Therefore, when the transferring node transfers the message, the length of the label stack compressed with the message can be shortened, and thus the total length of the message is shortened, which can help transmit messages in the network. Accordingly, the embodiments of the present invention also provide a method and an apparatus for decompressing the label stack. |