Patent Description:
An overlay segmented transport network is a communication network on which at least one intermediate forwarding node (overlay node) segments a communication link during a long-distance cross-wide area network (Wide area network, WAN) communication transmission, to improve end-to-end transmission performance by guaranteeing link quality of each segment. As shown in <FIG>, a communication link between a transmit end and a receive end is divided, and intermediate nodes are set as an overlay node <NUM>, an overlay node <NUM>, and an overlay node <NUM>. Transmission between the overlay node <NUM> and the overlay node <NUM> and between the overlay node <NUM> and the overlay node <NUM> is segmented transmission. Current problems are how to resolve sequence number synchronization on the overlay segmented transport network, and how to implement packet loss detection and packet recovery between a transmit end and a receive end on the overlay segmented transport network.

A current sequence number synchronization method is mainly determined by using a transmission control protocol (Transmission Control Protocol, TCP). A transmit end and a receive end of the TCP negotiate a sequence number by using a synchronization sequence number (Synchronization Sequence Number, SYN) and exchange of an acknowledgement character (Acknowledgement character, ACK) packet, and then perform packet transmission.

However, the overlay segmented transport network between the intermediate nodes does not go through independent phases of establishing a connection and negotiating the sequence numbers. Consequently, a manner of performing sequence number synchronization by using TCP on the overlay segmented transport network affects forwarding of a data packet and causes a delay. This is not suitable for the overlay segmented transport network.

<CIT> discloses a method and an arrangement for resetting a communication connection between a first communication device and a second communication device in a cellular radio system. Firstly, there is detected the need for resetting the communication connection. There is transmitted from the first communication device to the second communication device a first piece of information indicating the need for resetting the communication connection. A resetting procedure is performed at the second communication device, and there is transmitted from the second communication device to the first communication device a second piece of information indicating the completion of the resetting procedure with respect to the second communication device. There is also inserted into a certain piece of information transmitted between the first communication device and the second communication device an indication of an effective number of certain resetting operations associated with a certain detected need for resetting the communication connection.

<CIT> discloses: A system and method for re-synchronizing or resetting packet sequence numbers including allowing a sender to send packets with a special sequence number pattern to cause convergence of the sequence numbers on a receiver side. In a preferred embodiment, no explicit routing protocol based sync-up between Sender and Receiver is required. One embodiment of the disclosure can provide for a maximum drop of two packets regardless of network bandwidth between sender and receiver, or of the processing power of the sender or receiver. In another embodiment, resynchronization can be achieved with no, or one, packets dropped. The implementation can be solely on a sending side of the transfer so that a receiver can operate according to standard protocols and sequencing rules without modification.

<CIT> discloses: A network authentication method, a method for a client to request authentication, a client, and a device are provided. The method includes: receiving synchronize (SYN) data sent by a client, where the SYN data includes a sequence number SEQ1 and a network parameter; sending synchronize acknowledge (SYN_ACK) data to the client in response to the SYN data, where the SYN_ACK data includes an acknowledgment number ACK2, and the value of ACK2 is a value obtained by carrying out a function transformation according to the network parameter of the SYN data; receiving RESET (RST) data sent by the client in response to the SYN_ACK data, where the RST data includes a sequence number SEQ3 or an acknowledgment number ACK3, and the value of SEQ3 or ACK3 is the same as that of ACK2, and the RST data further includes a network parameter the same as that of the SYN data; carrying out the function transformation according to the network parameter of the RST data to obtain a check value CHK; and passing the authentication of the client if CHK matches SEQ3 or ACK3. Therefore, the occupation of storage resources is reduced.

This application provides a sequence number synchronization method and apparatus, to resolve a problem of sequence number synchronization on an overlay segmented transport network, trigger a sequence number resynchronization procedure, and avoid a delay in forwarding a data packet.

The invention is defined by a sequence number synchronization method according to claim <NUM>, corresponding sequence synchronization method according to claim <NUM> and sequence number synchronization apparatus according to claim <NUM>. Further details are defined in claims <NUM>-<NUM>, <NUM> and <NUM>-<NUM>.

In the specification, claims, and accompanying drawings of this application, the terms "first", "second", "third" and the like are intended to distinguish different objects but do not limit a particular sequence. In embodiments of this application, the word "example" or "for example" is used to represent giving an example, an illustration, or a description. Any embodiment or design scheme described as "example" or "for example" in the embodiments of this application should not be explained as being more preferred or having more advantages than another embodiment or design scheme. Specifically, use of the word such as "example" or "for example" is intended to present a related concept in a specific manner.

The following clearly describes the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. It is clear that the described embodiments are merely some but not all of the embodiments of this application.

Before the embodiments of this application are described, a design technology is briefly described first.

A best effort service is a service model that provides a minimum performance guarantee. This service model is a unitary and simplest service model. Applications under the best effort service can send any quantity of packets at any time without prior approval or notification to a network. For the best effort service, the network makes best efforts to send a packet, but does not ensure performance such as delay and reliability.

Forward error correction (Forward Error Correction, FEC) is a method used to increase data communication reliability. In a one-way communication channel, once an error is detected, a receiver cannot request transmission again. FEC is a method of transmitting redundant information by using data. If an error occurs during transmission, the receiver may be allowed to re-establish the data.

A tunnel is a mechanism that makes payload transmission feasible on incompatible transport networks. The tunnel allows network users to gain access to denied or insecure networks. The tunnel can use data encryption for payload transmission, to ensure that encapsulated user network data is displayed as public data even if the user network data is private and ensure that the user network data can easily pass through an insecure network.

The embodiments of this application may be applied to a communication network, specifically, an overlay segmented transport network architecture. For example, the overlay segmented transport network architecture may be applied between intermediate forwarding nodes shown in <FIG>, such as between an overlay node <NUM> and an overlay node <NUM>. Overlay in network technology field refers to a virtualization technology mode overlaid on network structures. Overlay realizes carrying applications on networks and separating the applications from another network service without large-scale modification of network infrastructures. Overlay mainly involves internet-based basic network technologies. The overlay technology constructs a virtual network on top of an existing physical network. Upper-layer applications are related only to the virtual network. An overlay network mainly includes the following three parts:.

It should be noted that only best effort packet loss detection and recovery are performed between forwarding nodes on the overlay segmented transport network. To be specific, there is no <NUM>% reliability guarantee for data transmission between the overlay node <NUM> and the overlay node <NUM> shown in <FIG>. The intermediate forwarding node makes best efforts to send a packet, detect a missed packet, and retransmit the packet. A TCP between a transmit end and a receive end ensures <NUM>% reliability of data transmission on the network. The transmit end may be a client, and the receive end may be a server. A TCP connection is established between the transmit end and the receive end at a transport layer, an overlay segmented transport network is established at a network layer between the transmit end and the receive end, and forwarding and detection of a data packet are implemented via a plurality of overlay nodes and routers.

Further, the intermediate node on the overlay segmented transport network is configured to forward a packet, and needs to ensure continuity of packet forwarding. Therefore, the overlay nodes have no concept of establishing a connection, and consequently there is no independent phase of establishing a connection and negotiating a sequence number. Therefore, this application proposes an in-line sequence number synchronization method. A sequence number synchronization operation is carried in a forwarded data packet, that is, the sequence number synchronization operation between overlay nodes is completed by using an in-band sequence number synchronization method, so that continuity of data packet forwarding is not affected, and a delay in forwarding a data packet is avoided.

The intermediate forwarding node in the foregoing embodiments of this application may be a virtual machine, a router, a switch, a physical server, an x86 virtualized forwarding device, or the like. This is not specifically limited in this application.

Optionally, each network element in <FIG> in the embodiments of this application, for example, the overlay node <NUM>, may be a functional module in a device. It may be understood that the functional module may be a network element in a hardware device, for example, a communication chip in a mobile phone, may be a software function running on dedicated hardware, or may be a virtual function instantiated on a platform (for example, a cloud platform).

For example, each network element in <FIG> may be implemented by using the network device <NUM> in <FIG> is a schematic diagram of a hardware structure of a network device applicable to the embodiments of this application. The network device <NUM> may include at least one processor <NUM>, a communication line <NUM>, a memory <NUM>, and at least one communication interface <NUM>.

The processor <NUM> may be a general-purpose central processing unit (central processing unit, CPU), a microprocessor, an application-specific integrated circuit (application-specific integrated circuit, ASIC), or one or more integrated circuits configured to control execution of programs in the solutions in this application.

The communication line <NUM> may include a path such as a bus for transmitting information between the foregoing components.

The communication interface <NUM> is configured to communicate with another device or a communication network by using any apparatus such as a transceiver, and is, for example, an Ethernet interface, a radio access network (radio access network, RAN) interface, or a wireless local area network (wireless local area network, WLAN) interface.

The memory <NUM> may be a read-only memory (read-only memory, ROM) or another type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or another type of dynamic storage device that can store information and instructions, or may be an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a compact disc read-only memory (compact disc read-only memory, CD-ROM) or another optical disc storage, an optical disc storage (including a compressed optical disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, or the like), a magnetic disk storage medium or another magnetic storage device, or any other medium that can be configured to carry or store expected program code in a form of an instruction or a data structure and that can be accessed by a computer, but is not limited thereto. The memory may exist independently, and is connected to the processor through the communication line <NUM>. The memory may alternatively be integrated with the processor. The memory provided in this embodiment of this application may usually be non-volatile. The memory <NUM> is configured to store computer-executable instructions for executing the solutions in this application, and execution is controlled by the processor <NUM>. The processor <NUM> is configured to execute the computer-executable instructions stored in the memory <NUM>, to implement the method provided in the embodiments of this application.

In some embodiments, the computer-executable instructions in the embodiments of this application may also be referred to as application program code. This is not specifically limited in this embodiment of this application.

During specific implementation, in an embodiment, the processor <NUM> may include one or more CPUs, for example, the CPU <NUM> and the CPU <NUM> in <FIG>.

During specific implementation, in an embodiment, the communication device <NUM> may include a plurality of processors, for example, the processor <NUM> and a processor <NUM> in <FIG>. Each of the processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor herein may be one or more devices, circuits, and/or processing cores configured to process data (for example, computer program instructions).

During specific implementation, in an embodiment, the communication device <NUM> may further include an output device <NUM> and an input device <NUM>. The output device <NUM> communicates with the processor <NUM>, and may display information in a plurality of manners. For example, the output device <NUM> may be a liquid crystal display (liquid crystal display, LCD), a light emitting diode (light emitting diode, LED) display device, a cathode ray tube (cathode ray tube, CRT) display device, or a projector (projector). The input device <NUM> communicates with the processor <NUM>, and may receive a user input in a plurality of manners. For example, the input device <NUM> may be a mouse, a keyboard, a touchscreen device, or a sensing device.

During specific implementation, the communication device <NUM> may be a desktop computer, a portable computer, a network server, a palmtop computer (personal digital assistant, PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device, or a device with a structure similar to that in <FIG>. A type of the communication device <NUM> is not limited in the embodiments of this application.

The following specifically describes the sequence number synchronization method provided in the embodiments of this application with reference to <FIG> and <FIG>. The network device in the following embodiments may include the components shown in <FIG>.

It should be noted that in the following embodiments of this application, names of messages forwarded between network devices, names of parameters in messages, or the like are merely examples, and there may be other names during specific implementation. This is not specifically limited in the embodiments of this application.

It may be understood that, in the embodiments of this application, a network device may perform some or all of steps in the embodiments of this application. The steps are merely examples. In the embodiments of this application, other steps or variations of various steps may further be performed. In addition, the steps may be performed in a sequence different from a sequence presented in the embodiments of this application, and not all steps in the embodiments of this application need to be performed.

An embodiment of this application provides a sequence number synchronization method. When a transmit end needs to resynchronize a sequence number, a synchronization indication bit indicating to perform a sequence number synchronization operation is set in a forwarded data packet, so that a sequence number negotiation process does not need to be performed separately. This resolves a problem of sequence number synchronization on an overlay segmented transport network, and avoids a delay in forwarding a data packet. As shown in <FIG>, a first network device is used as a transmit end, a second network device is used as a receive end, and the first network device forwards a data packet to the second network device. The embodiments of this application may include the following steps.

<NUM>: The first network device sends the data packet including a first synchronization indication to the second network device, where the first synchronization indication is used to indicate the second network device and the first network device to perform a sequence number synchronization operation.

It should be noted that the sequence number synchronization operation may be performed by the first network device and the second network device after the first network device and the second network device are initialized, after the first network device restarts and is powered on again, after a network between the first network device and the second network device is recovered from a network error or network disconnection, or the like. In the foregoing several cases, the first network device may trigger the sequence number synchronization operation with the second network device. Different processing in the different cases in the embodiments of this application is separately described below.

The data packet may be a data packet that is to be forwarded by the first network device and that includes a user payload, and is different from a packet used to only perform a specific request or indication between devices in another transport network.

Further, the data packet sent by the first network device to the second network device may be a data packet including an overlay tunnel header generated after a to-be-forwarded data packet is encapsulated. The first synchronization indication and a sequence number are encapsulated in the overlay tunnel header of the data packet. Specifically, after receiving the to-be-forwarded data packet from a previous node, the first network device processes the to-be-forwarded data packet according to an overlay tunnel transmission protocol, encapsulates the first synchronization indication and the sequence number into the overlay tunnel header of the to-be-forwarded data packet, and forwards the to-be-forwarded data packet to the second network device.

The first synchronization indication may be carried in at least one bit. For example, the first synchronization indication may be carried in one bit. A value of the bit is set to <NUM>, indicating that the first network device initiates a sequence number resynchronization operation to the second network device. The value of the bit is set to <NUM>, indicating that the first network device and the second network device end the sequence number synchronization operation. A specific form of the first synchronization indication and a corresponding embodiment are described in detail below.

<NUM>: The second network device sends a response packet to the first network device, where the response packet includes a second synchronization indication, and the second synchronization indication is used to indicate that the second network device receives the data packet including the first synchronization indication.

The second synchronization indication corresponds to the first synchronization indication. The second synchronization indication may be carried in a bit that is the same as the bit in which the first synchronization indication in the data packet is carried, or may be carried in a different bit. The second synchronization indication and the first synchronization indication may be preset to a same value, or may be separately set to different values. This is not specifically limited in this embodiment of this application. Any indication that can indicate the first network device and the second network device to perform the sequence number synchronization operation falls within the protection scope of this application.

It should be noted that the response packet sent by the second network device to the first network device may be a simple response packet, for example, an acknowledgement (Acknowledgement, ACK) character or a negative acknowledgement (Negative Acknowledgement, NACK) character packet, used to indicate that the second network device receives the data packet sent by the first network device, or that the second network device receives no data packet sent by the first network device. In addition, the ACK/NACK packet may carry a sequence number of a received data packet, a sequence number of a next data packet expected to be received, or may alternatively include a list of sequence numbers of a data packet that is not received, which is also referred to as a NACK list. In addition, the response packet sent by the second network device to the first network device may alternatively be a data packet in which an ACK/NACK is encapsulated and that is sent by the second network device to the first network device. This is not specifically limited in this embodiment of this application. For ease of describing principles of this application, for example, all response packets in the following embodiments are simple response packets, namely, ACK/NACK packets. Details are not described below.

Further, the response packet may one-to-one correspond to the data packet, or one response packet may correspond to a plurality of data packets. For example, the second network device may be configured to send a corresponding response packet to the first network device immediately after receiving a data packet sent by the first network device, where the response packet includes a sequence number of the received data packet. Alternatively, the second network device may be configured to reply to the first network device with one response packet after receiving two data packets sent by the first network device, where the response packet includes sequence numbers of the received data packets. Alternatively, the second network device may be preconfigured to reply to the first network device with a response packet within a specific time, where the response packet includes a sequence number of the data packet received by the second network device and sent by the first network device within the specific time. A specific implementation may be preset by a person skilled in the art based on a requirement.

In some embodiments, the second network device performs packet loss detection based on a synchronized sequence number. If a sequence number of a data packet sent by the first network device and received by the second network device is greater than a sequence number expected by the second network device, the second network device detects a data packet loss. In this case, the second network device sends a NACK response packet to the first network device, where the NACK response packet carries a NACK list, namely, inconsecutive sequence numbers of the received data packet. When receiving the NACK response packet sent by the second network device, the first network device may retransmit a lost data packet based on the NACK list in the NACK response packet.

It should be noted that, on an overlay segmented transport network, a forwarding node performs only a best effort retransmission service. To be specific, if a data packet whose sequence number is in the NACK list is in a retransmission queue of the first network device, the first network device performs a retransmission operation, and if there is no data packet whose sequence number is in the NACK list in the retransmission queue of the first network device, the first network device does not perform the retransmission operation, and continues forwarding a subsequent data packet.

Further, before the first network device receives a <NUM>st response packet including the second synchronization indication, the first network device sets the first synchronization indications in all data packets sent to the second network device.

In other words, the first network device keeps setting the first synchronization indications in the data packets forwarded to the second network device until the first network device receives the <NUM>st response packet that is sent by the second network device and that includes the second synchronization indication. In this way, it can be ensured that the second network device receives the data packet including the first synchronization indication, that is, the second network device receives a sequence number resynchronization operation performed by the first network device. This avoids that a sequence number cannot be synchronized due to a data packet loss.

Specifically, the first network device sets a sequence number in a <NUM>st data packet including the first synchronization indication to a preset sequence number or a random sequence number. The first network device continues sending a data packet until the first network device performs a next sequence number synchronization operation, where sequence numbers in the data packet that is continued to be sent are consecutive; and resets the sequence number in the data packet that is continued to be sent.

The preset sequence number indicates a start sequence number that exists when a sequence number resynchronization operation is performed. For example, the preset sequence number may be set to <NUM> or <NUM>, or may be set to any value. As long as the first network device and the second network device come to an agreement in which when the sequence number resynchronization operation is performed, a sequence number of a data packet sent by the first network device to the second network device starts from the preset sequence number, and a sequence number that is expected by the second network device and that is of the data packet received by the second network device also starts from the preset sequence number. In this case, the second network device may perform packet loss detection based on the expected sequence number.

In addition, a random sequence number may be used to indicate the start sequence number when the sequence number resynchronization operation is performed. The random sequence number may be a random number generated by the first network device, or a sequence number generated by the first network device based on a parameter of the first network device such as a current moment, an internet protocol (Internet Protocol, IP) address, or a media access control (Media Access Control, MAC) address. Therefore, this can effectively avoid a loss, tampering, or malicious attack of a data packet caused by maliciously embezzling of the preset sequence number of the communication network, to improve data transmission security.

When a sequence number set by the first network device to perform the sequence number synchronization operation starts from a random sequence number, the second network device may not restart sequence number synchronization and packet loss detection from the random sequence number, but from a sequence number included in a <NUM>st received data packet including the first synchronization indication. For example, the random sequence number is <NUM>. The first network device sends data packets <NUM>, <NUM>, <NUM>, and. to the second network device, where the data packet includes the first synchronization indication. The second network device receives the data packet <NUM> including the first synchronization indication. In this case, the second network device starts sequence number synchronization and packet loss detection from the sequence number <NUM>.

In some possible embodiments, when the first network device determines to perform the sequence number synchronization operation, the first network device may send a preset quantity of data packets including the first synchronization indications to the second network device; and a data packet does not include the first synchronization indication when a quantity of data packets exceeds the preset quantity. Alternatively, the first network device may continuously send data packets including the first synchronization indications to the second network device within a preset time range; and a data packet does not include the first synchronization indication when the preset time range is exceeded. The preset quantity and the preset time range may be manually set by a person skilled in the art based on a feature of a network device and a network status between network devices, to ensure that the second network device can receive at least one data packet that includes the first synchronization indication and that is sent by the first network device.

In this embodiment of this application, an implementation is described by using an example in which before the first network device receives a <NUM>st response packet including the second synchronization indication, the first network device sets the first synchronization indications in all data packets sent to the second network device. Alternatively, the first network device may send the preset quantity of data packets including the first synchronization indication to the second network device, or send the data packet including the first synchronization indication to the second network device within the preset time range. This does not impose a specific limitation on the protection scope of this application. Details are not described below.

Further, when the second network device consecutively receives at least two data packets that are sent by the first network device and that include the first synchronization indications, and sequence numbers included in the data packets are different, corresponding response packets sent by the second network device to the first network device include the second synchronization indications, where the response packet further includes a sequence number corresponding to the data packet.

For example, when the second network device receives a first data packet that is sent by the first network device and that includes the first synchronization indication, and a sequence number of the first data packet is x, the second network device sends a first response packet corresponding to the first data packet to the first network device. The first response packet includes the second synchronization indication, and may further include the received sequence number x or a next sequence number x+<NUM> expected to be received. Then, the second network device further receives a second data packet that is sent by the first network device and that includes the first synchronization indication, and a sequence number of the second data packet is x+<NUM>, the second network device sends a second response packet corresponding to the second data packet to the first network device. The second response packet includes the second synchronization indication, and may further include the received sequence number x+<NUM> or a next sequence number x+<NUM> expected to be received.

In the embodiments of this application, the first synchronization indication is added to at least one data packet forwarded by the first network device to the second network device, to indicate the first network device and the second network device to perform the sequence number resynchronization operation. After the second network device receives the data packet including the first synchronization indication, the response packet sent to the first network device includes the second synchronization indication, so that the second network device starts packet loss detection from the preset sequence number or the random sequence number. The sequence number of the data packet is synchronized in an in-band mode. This avoids an impact of an extra sequence number synchronization negotiation phase on data packet forwarding. In addition, the second network device only needs to write back a specific bit indicating synchronization to complete a sequence number synchronization procedure. This is easy to implement, and effectively resolves problems of sequence number synchronization and data packet loss.

In some embodiments, as shown in <FIG>, after step <NUM>, this embodiment of this application may further include the following steps.

<NUM>: When the first network device receives the <NUM>st response packet including the second synchronization indication, the first network device continues sending a data packet that does not include the first synchronization indication to the second network device.

<NUM>: The second network device sends a response packet that does not include the second synchronization indication to the first network device when the second network device receives a data packet that is sent by the first network device and that does not include the first synchronization indication.

The first synchronization indication is carried in at least one bit, and is set to a preset value. The second synchronization indication corresponds to the first synchronization indication. The data packet that is continued to be sent by the first network device to the second network device does not include the first synchronization indication in the following two implementations. One is to delete the bit of the first synchronization indication, that is, a subsequently sent data packet does not include the bit. The other is to set the bit corresponding to the first synchronization indication to another value, indicating that a sequence number synchronization operation is not currently performed. The following further describes these two cases in detail:.

In a first implementation, for example, the first synchronization indication is carried in a first bit, and a value is not limited. The second synchronization indication is also carried in the first bit, and a value is not limited. When the first network device receives a <NUM>st response packet including the first bit, the data packet that is continued to be sent by the first network device to the second network device does not include the first bit. When the second network device receives a data packet that does not include the first bit, a corresponding response packet sent by the second network device to the first network device also does not include the first bit.

As shown in <FIG>, for example, the first bit of the first synchronization indication is set to <NUM>, the first synchronization indication is represented by S, and a sequence number is represented by Seq. The first network device sends more than one data packet including the first synchronization indication S=<NUM> to the second network device, where the sequence number Seq of the data packet starts from <NUM>. If receiving a data packet that is sent by the first network device and that includes the first synchronization indication S=<NUM> and Seq=<NUM>, the second network device writes back the first synchronization indication S=<NUM> in a corresponding response packet, and the second network device starts packet loss detection from the sequence number <NUM>. When the first network device receives the response packet that is sent by the second network device and that includes the first synchronization indication S= <NUM>, a subsequently forwarded data packet no longer includes the first synchronization indication S=<NUM>. In this case, when the second network device receives a data packet that is sent by the first network device and that does not include the first synchronization indication S=<NUM>, the first synchronization indication S=<NUM> is removed from a corresponding response packet.

In a second implementation, for example, the first synchronization indication is carried in one bit and the bit is set to <NUM>. The bit in the second synchronization indication is also set to <NUM>. When the first network device receives a <NUM>st response packet including the second synchronization indication whose bit is <NUM>, in a data packet that is continued to be sent by the first network device to the second network device, the bit corresponding to the first synchronization indication is set to another value, for example, <NUM>. When the second network device receives a data packet that does not include the first synchronization indication whose bit is <NUM>, and detects the bit corresponding to the first synchronization indication is <NUM>, in a corresponding response packet sent by the second network device to the first network device, the bit corresponding to the second synchronization indication is also set to <NUM>.

As shown in <FIG>, for example, the first bit of the first synchronization indication is set to <NUM>. The first network device sends more than one data packet including the first synchronization indication S=<NUM> to the second network device, where the sequence number Seq of the data packet starts from <NUM>. If receiving a data packet that is sent by the first network device and that includes the first synchronization indication S= <NUM>, the second network device writes back the first synchronization indication S=<NUM> in a corresponding response packet. When the first network device receives the response packet that is sent by the second network device and that includes the first synchronization indication S=<NUM>, S in a subsequently forwarded data packet is set to <NUM>. In this case, when the second network device receives the data packet that is sent by the first network device and that includes S=<NUM>, S included in a corresponding response packet is also set to <NUM>.

In some embodiments, the first synchronization indication in the embodiments of this application may be carried in a first field, and the first field includes at least one bit. In the foregoing embodiments, that the first network device sets the first synchronization indication in the data packet sent to the second network device may specifically include: The first network device sets a value of the first field to a first preset value.

In this case, after step <NUM>, the embodiments of this application may further include: The first network device updates the value of the first field when determining to perform a next sequence number synchronization operation.

The first network device may determine to perform a next sequence number synchronization operation after the first network device restarts and is powered on again, after a network between the first network device and the second network device is recovered from a network error or network disconnection, or the like. This is not specifically limited in this embodiment of this application.

In other words, before the first network device determines to perform the next sequence number synchronization operation, the value of the first synchronization indication in the data packet sent by the first network device to the second network device does not change until the first network device determines to perform the next sequence number synchronization operation.

In some embodiments, each sequence number synchronization operation may be distinguished by using a plurality of bits. For example, the first synchronization indication is carried in four bits, and may represent <NUM> to <NUM>, <NUM> different values in total. The <NUM> different values may be used to indicate a number of each sequence number synchronization operation, to identify each different sequence number synchronization operation. This prevents a receive end from missing receiving a packet of a sequence number synchronization operation.

For example, if the first synchronization indication is carried in four bits, and the first preset value is <NUM>, the first synchronization indication is <NUM>, and the second synchronization indication in a response packet may also be set to <NUM>. When the first network device determines to perform the next sequence number synchronization operation, the first network device may update a value of a first field in a next to-be-forwarded data packet to <NUM>, and send the data packet to the second network device. If the value of the first field in the data packet received by the second network device is <NUM>, a corresponding response packet sent by the second network device to the first network device also includes the first field whose value is <NUM>.

In some embodiments, when the first network device restarts or the first network device is powered on again after being powered off, a sequence number status between the first network device and the second network device is lost. In this case, the first network device directly initiates a sequence number synchronization procedure, and starts packet loss detection from the preset sequence number with the second network device. After receiving a data packet including the bit that is of the first synchronization indication and that is reset to an original value, the second network device sends a response packet to the first network device, where the sequence number synchronization indication is written back in the response packet. In addition, the second network device resets an expected sequence number, and resets or clears a sequence number list of lost packets, to indicate that the second network device starts to perform packet loss detection and retransmission from the preset sequence number again.

As shown in <FIG>, S in a data packet sent by the first network device to the second network device is <NUM>, and a sequence number Seq is n+<NUM>. The second network device receives the data packet, and S in a returned response packet is <NUM>. In this case, a sequence number of a next data packet that the second network device expects to receive is n+<NUM>. In this case, the first network device restarts and initiates the sequence number synchronization procedure, S in a data packet sent by the first network device to the second network device is reset to <NUM>, and a sequence number is Seq=<NUM>. After receiving the data packet of S=<NUM>, the second network device determines to currently perform a sequence number synchronization operation. In this case, the expected sequence number and a NACK list are reset, packet loss detection is started from the sequence number <NUM>, and S in a response packet sent to the first network device is also set to <NUM>.

In some embodiments, when the network between the first network device and the second network device is recovered from a network error, the first network device detects that the sequence number between the first network device and the second network device is abnormal, for example, in a severely out-of-order state. In this case, the first network device initiates a sequence number resynchronization procedure.

Specifically, the first network device determines to perform the sequence number synchronization operation when the first network device determines, based on a sequence number in the received response packet, that a sequence number of the data packet received by the second network device is greater than the sequence number in the data packet sent by the first network device. In other words, if the second network device feeds back that a sequence number of a data packet that has not been sent by the first network device is received, it is determined that a current sequence number is seriously out of order.

When a sequence number in a response packet indicates a received sequence number, and the sequence number in the response packet is greater than a sequence number in a data packet sent by the first network device, the first network device detects that the sequence number between the first network device and the second network device is in the seriously out-of-order state. When the sequence number in the response packet indicates a next sequence number expected to be received, and the sequence number in the response packet minus <NUM> is still greater than the sequence number in the data packet sent by the first network device, the first network device detects that the sequence number between the first network device and the second network device is in the seriously out-of-order state.

As shown in <FIG>, data packet forwarding and responding run normally between the first network device and the second network device. A data packet or a response packet is lost due to a network error between the first network device and the second network device. After the network recovers, the first network device continues forwarding a data packet to the second network device, and the first network device detects that the current sequence number is abnormal based on a received response packet sent by the second network device. For example, if the response packet indicates that a received sequence number is m, and m>n, the first network device sends a data packet including the first synchronization indication S=<NUM> and Seq=<NUM> to the second network device. When the second network device receives the data packet including S=<NUM>, the second network device determines to currently perform the sequence number synchronization operation, writes back S=<NUM> in a corresponding response packet, resets the expected sequence number and the NACK list, and starts packet loss detection from the sequence number <NUM>.

In the foregoing embodiments of this application, a sequence number synchronization operation between forwarding nodes is implemented by using an in-band synchronization indication. This avoids a separate sequence number synchronization negotiation and a delay in forwarding a data packet caused by the sequence number synchronization. In addition, a receive end needs to only write back a specific bit indicating synchronization to complete a sequence number synchronization procedure. This is easy to implement, and effectively resolves problems of sequence number synchronization and data packet loss.

An embodiment of this application further provides a sequence number synchronization apparatus. The apparatus may be a first network device, and may be configured to perform steps performed by the first network device in the foregoing sequence number synchronization method. The sequence number synchronization apparatus provided in this embodiment of this application may include modules corresponding to corresponding steps.

In the embodiments of this application, the sequence number synchronization apparatus may be divided into functional modules based on the foregoing method examples. For example, each functional module may be obtained through division based on each corresponding function, or two or more functions may be integrated into one processing module. The integrated module may be implemented in a form of hardware, or may be implemented in a form of a software functional module. In this embodiment of this application, division into the modules is an example, and is merely logical function division. There may be another division manner during actual implementation.

When each functional module is obtained through division corresponding to each function, <FIG> is a possible schematic diagram of a structure of a sequence number synchronization apparatus <NUM>. As shown in <FIG>, the apparatus includes a sending unit <NUM> and a receiving unit <NUM>.

The sending unit <NUM> may be configured to send a data packet including a first synchronization indication to a second network device, where the first synchronization indication is used to indicate the second network device and the first network device to perform a sequence number synchronization operation.

The receiving unit <NUM> may be configured to receive a response packet sent by the second network device, where the response packet includes a second synchronization indication, and the second synchronization indication is used to indicate that the second network device has received the packet including the first synchronization indication. Before the first network device receives a <NUM>st response packet including the second synchronization indication, the sending unit <NUM> is further configured to set the first synchronization indication in the data packet sent to the second network device.

Further, the apparatus <NUM> may be configured to perform another operation performed by the first network device in the foregoing method embodiments. Details are not described herein again in this embodiment of this application. For details, refer to related descriptions in the foregoing method embodiments.

Another embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions, and when the instructions are run on the apparatus <NUM>, the apparatus <NUM> performs the steps of the first network device according to the sequence number synchronization method in the foregoing embodiments.

In another embodiment of this application, a computer program product is further provided. The computer program product includes computer-executable instructions, and the computer-executable instructions are stored in the computer-readable storage medium. At least one processor of the apparatus <NUM> may read the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions, so that the apparatus <NUM> performs the steps of the first network device in sequence number synchronization in the foregoing embodiments.

An embodiment of this application further provides a sequence number synchronization apparatus. The apparatus may be a second network device. As shown in <FIG>, the apparatus <NUM> includes a receiving unit <NUM> and a sending unit <NUM>.

The receiving unit <NUM> is configured to receive a data packet including a first synchronization indication sent by the second network device, where the first synchronization indication is used to indicate a first network device and the second network device to perform sequence number synchronization.

The sending unit <NUM> is configured to send a response packet to the second network device, where the response packet includes a second synchronization indication, and the second synchronization indication is used to indicate that the first network device receives the data packet including the first synchronization indication, where the first synchronization indication corresponds to the second synchronization indication.

Further, the apparatus <NUM> may be configured to perform another operation performed by the second network device in the foregoing method embodiments. Details are not described herein again in this embodiment of this application. For details, refer to related descriptions in the foregoing method embodiments.

Another embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions, and when the instructions are run on the apparatus <NUM>, the apparatus <NUM> performs the steps of the second network device according to the sequence number synchronization method in the foregoing embodiments.

In another embodiment of this application, a computer program product is further provided. The computer program product includes computer-executable instructions, and the computer-executable instructions are stored in the computer-readable storage medium. At least one processor of the apparatus <NUM> may read the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions, so that the apparatus <NUM> performs the steps of the second network device in sequence number synchronization in the foregoing embodiments.

All or some of the foregoing embodiments may be implemented by software, hardware, firmware, or any combination thereof. When a software program is used to implement the embodiments, the embodiments may be implemented completely or partially in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of this application are completely or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a computer, or a data terminal device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive Solid-State Disk (SSD)), or the like.

The foregoing descriptions about the implementations allow a person skilled in the art to clearly understand that, for the purpose of convenient and brief description, division into only the foregoing functional modules is used as an example for description. During actual application, the foregoing functions can be allocated to different functional modules for implementation as required. In other words, an inner structure of an apparatus is divided into different functional modules to implement all or some of the functions described above.

In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the described apparatus embodiments are merely examples. For example, division into the modules or units is merely logical function division, and may be other division during actual implementation. For example, a plurality of units or components may be combined or may be integrated into another apparatus, or some features may be ignored or not performed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connections may be implemented through some interfaces. The indirect coupling or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.

The units described as separate components may or may not be physically separate, and components displayed as units may be one or more physical units, in other words, may be located in one place, or may be distributed on a plurality of different places. Some or all of the units may be selected depending on actual requirements to achieve the objectives of the solutions in the embodiments.

When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a readable storage medium. Based on such an understanding, the technical solutions of the embodiments of this application essentially, or the part contributing to the conventional technology, or all or some of the technical solutions may be implemented in a form of a software product. The software product is stored in a storage medium and includes several instructions for instructing a device (which may be a single-chip microcomputer, a chip, or the like) or a processor (processor) to perform all or some of the steps of the methods in the embodiments of this application. The foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disc.

Claim 1:
A sequence number synchronization method, applied to a first network device of an overlay segmented transport network, wherein the first network device is configured to forward a plurality of data packets, and the method comprises:
sending (<NUM>), by the first network device, a data packet comprising a first synchronization indication to a second network device, wherein the first synchronization indication is used to indicate the second network device and the first network device to perform a sequence number synchronization operation;
receiving (<NUM>), by the first network device, a response packet sent by the second network device, wherein the response packet comprises a second synchronization indication, and the second synchronization indication is used to indicate that the second network device has received the data packet comprising the first synchronization indication; and
before the first network device receives the response packet comprising the second synchronization indication, setting, by the first network device, the first synchronization indication in the plurality of data packets sent to the second network device.