Method of data transmission based on transport layer and computer program product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING LINX SOFTWARE CORP
- Filing Date
- 2026-07-10
- Publication Date
- 2026-08-07
AI Technical Summary
在主备模式下,通过将多个物理网卡绑定为一个逻辑网卡实现了链路冗余,但在活跃接口故障时存在时间窗口,切换时间窗口内本端无可用出接口导致发送丢包、对端未感知故障导致接收丢包,导致双向流量丢失,无法满足零丢包要求;在广播模式下,接收端内核协议栈收到重复流量,传输控制协议(Transmission Control Protocol,TCP)协议因重复段干扰拥塞控制机制导致吞吐量下降,用户数据报协议(User Datagram Protocol,UDP)协议因内核缺乏去重能力导致重复报文上送应用层,在高速流量下易引发缓冲区溢出
[0016] This application provides a data transmission method and computer program product based on the transport layer. The data transmission method based on the transport layer adds a packet header containing a cyclic redundancy flag to the traffic data through a first transport layer. A first virtual interface selects a first slave interface from the list of active slave interfaces to send a copy packet, and a second slave interface sends the original traffic packet. This completes the creation of a virtual high-availability interface in the Linux kernel. A high-availability flag is injected into the transport layer protocol header at the sending end, and redundant transmission is implemented on the virtual high-availability interface. This avoids the time window during the failover of the master/slave mode and solves the packet loss problem during failover.
Smart Images

Figure CN122534014A_ABST
Abstract
Description
Technical Field
[0001] This disclosure generally relates to the field of network communication technology, and in particular to a data transmission method and computer program product based on the transport layer. Background Technology
[0002] With the increasing reliance on networks in critical sectors such as finance, power, and industrial control, network communication reliability has become a core requirement for ensuring business continuity. Currently, existing technologies achieve high-availability network transmission through Linux bonding and industrial redundant Ethernet protocols (Parallel Redundancy Protocol (PRP) / High-availability Seamless Redundancy (HSR)).
[0003] The main operating modes of Linux Bonding technology are primary / standby mode and broadcast mode. In primary / standby mode, link redundancy is achieved by binding multiple physical network cards into a single logical network card. However, when the active interface fails, there is a time window during the switchover. During this time window, the local end has no available outgoing interface, leading to packet loss during transmission, and the remote end is unaware of the failure, resulting in packet loss during reception. This causes bidirectional traffic loss and fails to meet the zero-packet-loss requirement. In broadcast mode, the receiving end's kernel protocol stack receives duplicate traffic. The Transmission Control Protocol (TCP) experiences a decrease in throughput due to congestion control mechanisms caused by duplicate segments, and the User Datagram Protocol (UDP) suffers from duplicate packets being sent to the application layer due to the kernel's lack of deduplication capabilities. Under high-speed traffic, this can easily lead to buffer overflows.
[0004] Therefore, existing high-availability network transmission schemes have at least the following technical problems: packet loss during primary / backup switching, high protocol stack processing burden in broadcast mode, and lack of deduplication at the transport layer. Summary of the Invention
[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a data transmission method and computer program product based on the transport layer. The method involves adding a message header containing a redundancy flag to the traffic data through a first transport layer. A first virtual interface selects a first slave interface from the list of active slave interfaces to send a copy message, and a second slave interface sends the traffic message. This completes the injection of a high availability flag into the transport layer protocol header at the sending end in the Linux kernel, achieving redundant transmission through the virtual high availability interface. The receiving end replaces the message receiving device with the second virtual interface. The second transport layer extracts the traffic data and uploads it to user space only when it determines that the target message has not been received based on the redundancy flag. This completes the traffic redirection at the receiving end through the virtual high availability interface, sending redundant traffic to the protocol stack through the virtual high availability interface. At the transport layer, precise deduplication is performed based on the redundancy flag, achieving kernel-level zero-packet-loss switching and kernel-level precise deduplication.
[0006] Firstly, this application provides a data transmission method based on the transport layer, applied to a first network protocol processing unit in the kernel of a sending end operating system and a second network protocol processing unit in the kernel of a receiving end operating system. The first network protocol processing unit includes a first transport layer and a first virtual interface, and the second network protocol processing unit includes a second transport layer, a second virtual interface, and an underlying physical network interface card (NIC). The method includes: The first transport layer determines the destination IP address and the first virtual interface based on the received traffic data, and adds a packet header including a cyclic redundancy flag to the traffic data to obtain a traffic packet; the cyclic redundancy flag is used to confirm the packet reception status. The first virtual interface obtains a list of currently active slave interfaces, selects a first slave interface from the list to send a copy of the traffic packet, and a second slave interface to send the traffic packet to the destination IP address. If the underlying physical network interface card receives a packet, the second virtual interface replaces the receiving device of the packet from the underlying physical network interface card with the second virtual interface to obtain the target packet; the target packet is the copy packet or the traffic packet. If the second transport layer determines that the target message has not been received based on the cyclic redundancy flag carried by the target message, it extracts the traffic data from the target message and transmits the traffic data to the user space corresponding to the kernel of the receiving end operating system.
[0007] In conjunction with the first aspect, in one possible implementation where the message header also includes a system timestamp, the method further includes: If the system timestamp carried by the target message is equal to the base timestamp, and it is determined that the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded. If the system timestamp carried by the target message is equal to the base timestamp, and it is determined that the target message has not been received based on the cyclic redundancy flag carried by the target message, then the traffic data is extracted from the target message.
[0008] In conjunction with the first aspect, in one possible implementation, the method further includes: If the system timestamp carried by the target message is less than the reference timestamp, the time difference is less than or equal to the preset grace period, and it is determined that the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded; the time difference is the difference between the reference timestamp and the system timestamp carried by the target message. If the system timestamp carried by the target message is less than the reference timestamp, the time difference is less than or equal to the preset grace period, and it is determined that the target message has not been received according to the cyclic redundancy flag carried by the target message, then the traffic data is extracted from the target message. If the system timestamp carried by the target message is less than the base timestamp and the time difference is greater than the preset grace period, then the target message is discarded.
[0009] In conjunction with the first aspect, in one possible implementation, the traffic message is a Transmission Control Protocol (TCP) message; The Partially Reliable Transport Protocol (PRTP) option field of the TCP packet includes: a first length field for identifying the length of the option field, a first type field for identifying the protocol type of the packet header, a first magic number field for identifying the protocol identifier, a first timestamp field for carrying the system timestamp, and a first redundancy identifier field for carrying the cyclic redundancy identifier; the TCP payload of the TCP packet carries the traffic data.
[0010] In conjunction with the first aspect, in one possible implementation, the traffic message is a User Datagram Protocol (UDP) message; The PRTP available header fields of the UDP packet include: a second length field for identifying the length of the header fields, a second type field for identifying the protocol type of the packet header, a second magic number field for identifying the protocol identifier, a second timestamp field for carrying the system timestamp, and a second redundancy identifier field for carrying the cyclic redundancy identifier; the PRTP available header fields are after the UDP header of the UDP packet and before the UDP payload; the UDP payload carries the traffic data.
[0011] In conjunction with the first aspect, in one possible implementation, the step of selecting a first subordinate interface from the subordinate interface list to send a copy of the traffic packet, and a second subordinate interface to send the traffic packet to the destination IP address, includes: If it is determined from the destination IP address that the copied packet and the traffic packet need to be forwarded through the gateway, then the destination MAC address of the copied packet and the traffic packet is replaced with the MAC address of the gateway; The duplicated packet and the traffic packet, with the destination MAC address replaced, are sent to the gateway through the first slave interface and the second slave interface, respectively. The gateway then forwards the duplicated packet and the traffic packet to the destination IP address.
[0012] In conjunction with the first aspect, in one possible implementation, the first network protocol processing unit further includes an event-aware processing unit, and the method further includes: If the event sensing and processing unit detects a change in the physical network card status, or detects a change in the link status through timer monitoring, then the following debouncing processing is performed: If the link is disconnected, wait for a first preset time to confirm the link is disconnected; or if the link is restored, wait for a second preset time to confirm the link is restored, and then update the list of subordinate interfaces.
[0013] In conjunction with the first aspect, in one possible implementation, the method further includes: The event awareness processing unit periodically detects the packet sending rate of the third and fourth slave interfaces in the slave interface list. If the packet transmission rate difference between the third slave interface and the fourth slave interface is detected to exceed the preset normal packet transmission rate threshold M times consecutively, the anti-jitter processing will be performed in advance; M is a positive integer.
[0014] In conjunction with the first aspect, in one possible implementation, the step of selecting a first subordinate interface from the subordinate interface list to send a copy of the traffic packet, and a second subordinate interface to send the traffic packet to the destination IP address, includes: All slave interfaces in the slave interface list except the last slave interface are designated as the first slave interface, and the last slave interface in the slave interface list is designated as the second slave interface. The replication message is sent to the destination IP address through each of the first slave interfaces, and the traffic message is sent to the destination IP address through the second slave interface.
[0015] Secondly, this application also provides a computer program product. This computer program product stores a computer program, which, when executed by a processor, implements the data transmission method described in the first aspect.
[0016] This application provides a data transmission method and computer program product based on the transport layer. The data transmission method based on the transport layer adds a packet header containing a cyclic redundancy flag to the traffic data through a first transport layer. A first virtual interface selects a first slave interface from the list of active slave interfaces to send a copy packet, and a second slave interface sends the original traffic packet. This completes the creation of a virtual high-availability interface in the Linux kernel. A high-availability flag is injected into the transport layer protocol header at the sending end, and redundant transmission is implemented on the virtual high-availability interface. This avoids the time window during the failover of the master / slave mode and solves the packet loss problem during failover.
[0017] The receiving end replaces the receiving device of the target packet with the second virtual interface through the second virtual interface. The second transport layer extracts traffic data and uploads it to user space only when it determines that the target packet has not been received based on the cyclic redundancy flag. This completes the traffic redirection of the receiving end through the virtual high-availability interface in the Linux kernel, and sends redundant traffic to the protocol stack through the virtual high-availability interface. The transport layer performs accurate deduplication based on the redundancy flag, thereby completing the identification and filtering of duplicate packets at the transport layer. This avoids the interference of duplicate traffic in broadcast mode on the TCP congestion control mechanism and the processing burden caused by sending duplicate UDP packets to the application layer. It solves the problems of high protocol stack burden and missing deduplication at the transport layer, thereby achieving kernel-level zero packet loss switching and kernel-level accurate deduplication. Attached Figure Description
[0018] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is one of the flowcharts illustrating a data transmission method based on the transport layer in one embodiment; Figure 2 This is a three-plane architecture diagram of a data transmission system in one embodiment; Figure 3 This is a schematic diagram of the message processing and deduplication process at the receiving end in one embodiment. Figure 4 This is a schematic diagram of a TCP-UDP high-availability packet encapsulation format in one embodiment; Figure 5 This is a second flowchart illustrating a data transmission method based on the transport layer in one embodiment; Figure 6 This is the third flowchart of a data transmission method based on the transport layer in one embodiment; Figure 7 This is a schematic diagram of event perception and observation surface data output in one embodiment; Figure 8 This is a flowchart of a data transmission method based on the transport layer in one embodiment; Figure 9 This is a flowchart of the data packet processing at the sending end in one embodiment; Figure 10 This is the fifth flowchart of a data transmission method based on the transport layer in one embodiment. Detailed Implementation
[0019] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0020] It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this invention can be combined with each other. The invention will now be described in detail with reference to the accompanying drawings and embodiments. Furthermore, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The terms "first" and "second," etc., in the specification and claims of the embodiments of this invention are used to distinguish different objects, not to describe a specific order of objects.
[0021] With the increasing reliance on networks in critical sectors such as finance, power, industrial control, and rail transportation, network communication reliability has become a core requirement for ensuring business continuity. Any momentary network outage or data loss can lead to serious production accidents or economic losses. Therefore, how to achieve high-availability network transmission and ensure uninterrupted service and no data loss during link failures has always been a core problem that those skilled in the art urgently need to solve.
[0022] Currently, the main solutions for achieving high network availability in existing technologies include Linux Bonding technology and PRP / HSR.
[0023] Linux Bonding technology achieves link aggregation or redundancy by binding multiple physical network interface cards (NICs) into a single logical NIC. In master-slave mode, only one active interface is responsible for data transmission and reception at any given time. When the active interface fails, it requires fault detection, state synchronization, and master-slave failover. During this failover window, data packets are dropped due to the lack of available outgoing interfaces, leading to bidirectional momentary interruptions and packet loss, failing to meet the stringent requirements of zero-packet-loss for real-time services. In broadcast mode, the system sends the same data packets simultaneously through all bound physical NICs. However, the receiving kernel protocol stack receives completely duplicate traffic: for TCP, duplicate segments trigger numerous duplicate acknowledgment characters (ACKs) and erroneously interfere with congestion control mechanisms, causing a sharp drop in connection throughput; for UDP, duplicate packets are sent to the application layer as is, requiring applications to implement complex deduplication logic, which can easily lead to buffer overflows or processing errors under high-speed traffic.
[0024] Industrial Redundant Ethernet Protocol (PRP / HSR) uses special encapsulation at the data link layer to achieve redundant transmission and deduplication. However, its deep reliance on Layer 2 mechanisms leads to two problems: First, PRP / HSR packets cannot penetrate standard Layer 3 routers. Once they cross an IP network (Layer 3 routing), their redundant labels are stripped or discarded, rendering the high availability mechanism ineffective and making it difficult to apply to complex large-scale Internet Protocol (IP) networks that cross network segments and routes. Second, implementing PRP / HSR usually requires dedicated hardware network cards or non-standard modifications to standard network card drivers, resulting in high deployment costs and poor versatility.
[0025] In view of the above-mentioned defects in the existing technology, this application aims to solve the following technical problems: the packet loss problem during switching in the existing primary and backup redundancy mechanism; the problem of the processing burden of the receiving end protocol stack and the lack of transport layer deduplication capability caused by the existing broadcast redundancy transmission mechanism; and the problem that the existing layer 2 redundancy protocol cannot be deployed across layer 3 networks.
[0026] To address the aforementioned technical issues, this application provides a data transmission method and computer program product based on the transport layer. By creating a virtual high-availability interface in the Linux kernel, injecting a high-availability identifier into the TCP / UDP transport layer protocol header at the sending end, and implementing redundant transmission on the virtual high-availability interface, the receiving end in the Linux kernel redirects the redundant traffic through the virtual high-availability interface to the protocol stack. At the transport layer, precise deduplication is performed based on this redundancy identifier, thereby achieving zero-packet-loss switching and kernel-level precise deduplication in cross-layer three network deployments.
[0027] The following is combined with Figures 1 to 10This application describes a data transmission method and computer program product based on the transport layer, wherein the data transmission method based on the transport layer is applied to a first network protocol processing unit in the kernel of the sending end operating system and a second network protocol processing unit in the kernel of the receiving end operating system. The first network protocol processing unit includes a first transport layer and a first virtual interface, and the second network protocol processing unit includes a second transport layer, a second virtual interface, and an underlying physical network interface card.
[0028] Reference Figure 1 This is a flowchart illustrating the data transmission method based on the transport layer provided in an embodiment of this application, as shown below. Figure 1 As shown, the data transmission method based on the transport layer includes the following steps 101 to 104.
[0029] Step 101: The first transport layer determines the destination IP address and the first virtual interface based on the received traffic data, and adds a header including a cyclic redundancy flag to the traffic data to obtain a traffic packet.
[0030] Both the sending and receiving operating system kernels are Linux kernel network protocol stacks. Cyclic redundancy flags are used to confirm message reception status.
[0031] Both the first and second transport layers include the TCP and UDP protocols.
[0032] Specifically, the user-space (or application layer) corresponding to the sending operating system kernel enters the sending operating system kernel via a system call and sends traffic data to the first transport layer. This traffic data carries the destination IP address, instructing the first transport layer to forward it to the destination receiver. Furthermore, the routing table is queried based on the IP address carried in the traffic data. If the queried entry corresponds to a highly available virtual interface, the first virtual interface for redundant data transmission is determined, and the traffic data is then sent to the first transport layer for interception and tagging. That is, the first transport layer adds a header including a cyclic redundancy flag to the traffic data, obtaining the traffic packet, and then sends the traffic packet to the first virtual interface.
[0033] For example, the first transport layer calls the peer state management module to query the peer state node with the destination IP address, performs an atomic increment operation on the identifier counter in the node to obtain a unique redundant identifier, which is the cyclic redundancy identifier; at the same time, it reads the current system time as the system timestamp, fills it into the high availability header, and then encapsulates the traffic data as the payload to obtain the traffic packet.
[0034] Step 102: The first virtual interface obtains the list of currently active slave interfaces, selects the copy packet of the traffic packet sent by the first slave interface and the traffic packet sent by the second slave interface to the destination IP address from the slave interface list.
[0035] Specifically, the first virtual interface performs a redundant transmission process for the received traffic packets. This redundant transmission process requires the first virtual interface to first obtain a list of currently active slave interfaces. In one specific embodiment, the first virtual interface internally maintains a slave interface list, which records information about all slave interfaces bound to the first virtual interface, including real-time status parameters such as the link status, packet transmission and reception rates, and packet loss rate of each slave interface.
[0036] Based on this, the first virtual interface can first traverse each slave interface in its maintained slave interface list and read the link status flag of each traversed slave interface. Each link status flag is maintained and updated in real time by the corresponding underlying network card driver or Linux operating system kernel based on the physical link connection status, carrier detection results, and network card working status. For slave interfaces with the link status flag set to UP, the first virtual interface further detects whether the slave interface has frequent start-stop behavior to exclude slave interfaces with normal physical connections but are actually unusable, and determines the slave interfaces that have recently shown packet sending and receiving behavior and whose link status flag is UP as candidate slave interfaces that are currently in an active state.
[0037] The first virtual interface can also obtain packet error rate and packet loss rate statistics for each candidate slave interface. When a candidate slave interface is in UP state, but its packet error rate or packet loss rate continuously exceeds the corresponding preset threshold, the first virtual interface marks the candidate slave interface as inactive. The first virtual interface determines all slave interfaces that meet preset conditions as currently active slave interfaces. The preset conditions include: link state is UP, there is no frequent start-stop behavior, and both packet error rate and packet loss rate do not exceed the corresponding preset threshold.
[0038] The first virtual interface can further select Q slave interfaces from the list of currently active slave interfaces according to a preset selection strategy. Q is a positive integer greater than or equal to 2, and Q does not exceed the total number of slave interfaces in the list. The preset selection strategy includes: selecting the first Q slave interfaces according to their order in the list, selecting the first Q slave interfaces according to their link speed from high to low, selecting the first Q slave interfaces according to their current load from low to high, selecting the first Q slave interfaces according to their preset priority from high to low, or selecting Q slave interfaces sequentially in a round-robin manner.
[0039] For the selected Q slave interfaces, the first virtual interface designates Q-1 slave interfaces as the first slave interface and the remaining slave interface as the second slave interface. Then, the first virtual interface copies the traffic packets from the first slave interface and sends the copied packets to the destination IP address; and it directly sends the original traffic packets from the second slave interface to the destination IP address, achieving zero packet loss redundancy.
[0040] It should be noted that, referring to Figure 2 The data transmission system three-plane architecture diagram shown is as follows: Figure 2 As shown, both the sending end operating system kernel and the receiving end operating system kernel can be divided into a data plane, a control plane, and an observation plane. The data plane runs on the high-speed path of the kernel and is responsible for the real-time processing of high-availability traffic data. It includes: a high-availability virtual interface layer (such as the first virtual interface and the second virtual interface), a transport layer high-availability processing module (such as the first transport layer and the second transport layer), and a peer state management module.
[0041] The high-availability virtual interface layer is used to create virtual network devices. It presents a single logical exit to receive traffic packets from the protocol stack and binds multiple physical slave interfaces to the network. It is responsible for redundant copying and sending of traffic packets and intercepting and redirecting received traffic data.
[0042] The transport layer high availability module is used to attach to the transport protocol's transmit and receive paths. During transmission, a high availability identifier (such as a cyclic redundancy identifier) is injected into the transport protocol header area; during reception, the high availability identifier is parsed and deduplication is performed.
[0043] The peer status management module is used to maintain a hash mapping table indexed by the peer IP address and peer status nodes, as well as to provide the first transport layer with a cyclic redundancy identifier generation service independent of each peer IP address, and a fast deduplication query service based on deduplication bitmap and timestamp window.
[0044] The control plane is responsible for policy management of data plane behavior. It interacts with the kernel through user-space tools (such as ip link / netlink / sysfs), including the namespace management layer, link type and configuration layer, and underlying event awareness layer.
[0045] The namespace management layer is used to independently initialize device lists and monitoring directories for each network namespace, supporting containerized isolation. The link type and configuration layer receives user-space commands through the kernel's standard communication interface to create / destroy virtual devices, bind / unbind slave interfaces, and dynamically configure runtime parameters such as monitoring intervals and latency. The underlying event awareness layer listens for status change events of the underlying physical network interface cards and, combined with a timer monitoring mechanism, dynamically updates the list of currently active slave interfaces on the data plane.
[0046] The observation plane independently collects status data from each module of the data plane, providing end-to-end data processing status monitoring and supporting the standard operation and maintenance ecosystem, including: Simple Network Management Protocol (SNMP) standard counting module, Ethtool driver statistics, and kernel trace points.
[0047] SNMP Standard Counts: Data is provided by the transport layer high availability processing module and the high availability virtual interface layer, recording key indicators such as deduplication hit count, total number of redundant sent packets, and interface drop count. Ethtool Driver Statistics: Data is provided by the network card drivers of physical slave interface A and physical slave interface B, providing underlying statistics such as physical port packet sending rate and driver-level packet loss count. Kernel Trace Points: Embedded in the critical path of the transport layer high availability processing module and the high availability virtual interface layer, supporting dynamic tracing of packet processing flow and latency.
[0048] Regarding the redundant transmission process mentioned in step 102, each time the first virtual interface distributes a packet to the selected virtual interface, the redundant transmission packet counter is incremented. This counter is collected and output in real time by the SNMP standard counting module of the observation surface, reflecting the total amount of additional traffic generated by the system due to the redundancy mechanism. When copying packets or sending traffic packets to the underlying physical network card, the Ethtool driver statistics module of the observation surface synchronously collects the driver layer packet loss count (such as tx_dropped, carrier_errors, etc.) of each physical slave interface. When the driver layer drops packets due to insufficient buffer or hardware failure, this statistic is updated immediately, helping maintenance personnel to distinguish whether packet loss occurs at the higher levels of the protocol stack or the lower levels of the driver layer.
[0049] Step 103: If the underlying physical network card receives the packet, the second virtual interface replaces the receiving device of the packet from the underlying physical network card with the second virtual interface to obtain the target packet; the target packet is a copy packet or a traffic packet.
[0050] Specifically, the receiving end uses the destination IP address of the redundantly sent packets from the first virtual interface. The underlying physical network interface card (NIC) of the receiving end receives the duplicate packets or traffic packets sent by the first virtual interface. When the underlying physical NIC of the receiving end receives the duplicate packets or traffic packets, it sends the received duplicate packets or traffic packets as the destination packets to the second virtual interface.
[0051] The second virtual interface intercepts and redirects the target packet. That is, it updates the receiving device of the target packet from the underlying physical network card to the second virtual interface, obtains the target packet, and then sends the target packet to the second transport layer protocol stack.
[0052] Step 104: If the second transport layer determines that the target message has not been received based on the cyclic redundancy flag carried by the target message, then it extracts the traffic data from the target message and transmits the traffic data to the user space corresponding to the kernel of the receiving end operating system.
[0053] Specifically, when the second transport layer receives a target message, it parses its message header, extracts the cyclic redundancy flag (CRQ), and queries the deduplication bitmap based on the extracted CRQ. If the extracted CRQ indicates that the target message is being received for the first time, meaning the query result is not set, then the target message is confirmed to be received and the bitmap is set. Furthermore, traffic data is extracted from the target message and transmitted to the user space corresponding to the kernel of the receiving operating system. The transmission method can be based on a pre-defined protocol. For example, the extracted traffic data can be placed in a buffer first, and then the user space can be notified to retrieve it.
[0054] A data transmission protocol is pre-established between the second transport layer and the user space. The second transport layer writes the extracted traffic data into a shared buffer between kernel space and user space, or sends a data arrival notification to the user space through the kernel notification mechanism to inform the user space to read the traffic data from the shared buffer.
[0055] In this way, the second transport layer only uploads the first received, deduplicated traffic data to the user space, avoiding the sending of duplicate packets to the user space, reducing the processing burden on user space applications, and preventing duplicate data from interfering with application layer logic.
[0056] It should be noted that if the deduplication bitmap is queried based on the extracted cyclic redundancy identifier, and the query result has been set, that is, the extracted redundancy identifier indicates that the target message is not received for the first time, then if the system timestamp is also included in the message header, the timestamp grouping and grace period mechanism are combined to determine whether the target message is a new packet with identifier wrapping or a late duplicate packet.
[0057] Furthermore, it should be noted that, besides creating a first virtual interface as a virtual master device to redundantly transmit packets at the link layer and intercepting redirected traffic by registering the underlying physical network interface card's receive processing callback (rx_handler), in the sending direction, instead of creating a virtual master device, one can utilize Linux kernel traffic control (TC) rules or the extended Berkeley Packet Filter (eBPF) program mounted on the physical network interface card's sending anchor point to intercept and duplicate packets that need to be redundantly transmitted to other physical network interfaces. In the receiving direction, using an eBPF program mounted on the receiving anchor point, high availability indicators (such as cyclic redundancy indicators) can be identified in advance and deduplication can be performed, discarding duplicate packets directly at the underlying layer without sending them to the protocol stack. This scheme can achieve earlier interception.
[0058] The data transmission method based on the transport layer provided in this application adds a packet header containing a cyclic redundancy flag to the traffic data through the first transport layer. A first virtual interface selects a first slave interface from the list of active slave interfaces to send a copy packet, and a second slave interface sends the original traffic packet. This completes the creation of a virtual high-availability interface in the Linux kernel. A high-availability flag is injected into the transport layer protocol header at the sending end, and redundant transmission is implemented on the virtual high-availability interface, avoiding the time window during failover in master / slave mode and solving the packet loss problem during failover. The receiving end replaces the receiving device of the target packet with the second virtual interface through the second virtual interface, and the receiving device is then... The transport layer extracts traffic data and uploads it to user space only when the target packet has not been received, based on the cyclic redundancy flag. This completes the traffic redirection at the receiving end in the Linux kernel through the virtual high availability interface, sending redundant traffic to the protocol stack through the virtual high availability interface. At the transport layer, precise deduplication is performed based on the redundancy flag, thus completing the identification and filtering of duplicate packets at the transport layer. This avoids the interference of duplicate traffic in broadcast mode on the TCP congestion control mechanism and the processing burden caused by sending duplicate UDP packets to the application layer. It solves the problems of high protocol stack burden and missing deduplication at the transport layer, thereby achieving kernel-level zero packet loss switching and kernel-level precise deduplication.
[0059] In one embodiment, the first transport layer may also add a header including a cyclic redundancy flag and a system timestamp to the traffic data. This allows the second transport layer to perform deduplication by combining the cyclic redundancy flag and timestamp carried in the target packet. This application can achieve deduplication by the following steps.
[0060] If the system timestamp carried by the target message is equal to the base timestamp, and the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded.
[0061] Alternatively, if the system timestamp carried by the target message is equal to the base timestamp, and it is determined from the cyclic redundancy flag carried by the target message that the target message has not been received, then traffic data is extracted from the target message.
[0062] Specifically, when the second transport layer receives a target message carrying a system timestamp and a cyclic redundancy flag, it can first query the deduplication bitmap based on the cyclic redundancy flag carried in the target message. This deduplication bitmap is an N-bit binary array, where each bit's value indicates whether the corresponding bit of the message has been received, and N is a positive integer. Furthermore, the N-bit deduplication bitmap is divided into bitmap groups, with each group corresponding to a reference timestamp in the timestamp array. Each reference timestamp is used for group location in timestamp comparison and determination.
[0063] For example, when N is 65536, the 65536-bit deduplication bitmap can be divided into 256 groups, each group being 256 bits.
[0064] The deduplication bitmap is queried based on the Cyclic Redundancy Mark (CRD) flag carried in the target packet. The base timestamp of the corresponding packet is determined, and the timestamp carried in the target packet is compared with the base timestamp. If the system timestamp carried in the target packet is equal to the base timestamp, a bitmap determination is performed, that is, checking whether the value of the corresponding bit of the CRD flag in the deduplication bitmap is 0. If the value of the corresponding bit of the CRD flag in the deduplication bitmap is 0, it indicates that the target packet has not been received. In this case, the target packet is received, traffic data is extracted from the target packet, and 0 is set to 1. Conversely, if the value of the corresponding bit of the CRD flag in the deduplication bitmap is 1, it indicates that the target packet has been received (i.e., the target packet has been received repeatedly), and the target packet is discarded.
[0065] For example, if the target message carries a cyclic redundancy flag of 257 and the system timestamp carried by the target message is equal to the base timestamp of packet 1, then the value of the 257th bit in the deduplication bitmap is directly queried. If the value of the 257th bit is 0, the target message is received and the bit is set. If the value of the 257th bit is 1, it is determined that the target message is received repeatedly and the target message is discarded.
[0066] It should be noted that, in addition to maintaining a hash mapping table with the peer's IP address as the key, using a 65536-bit deduplication bitmap for each node to perform O(1) deduplication, and combining timestamp grouping for wraparound, flow table nodes can also be maintained based on the network 5-tuple (source IP, destination IP, source port, destination port, protocol number) instead of managing by the peer's IP address alone. This scheme has finer state granularity and can be accurate to each connection. Alternatively, in ultra-high-speed traffic scenarios, a Bloom filter can be used instead of a bitmap for deduplication judgment, trading fast filtering for extremely low memory overhead. Although there is a very low probability of misjudgment (misjudging new packets as duplicate packets and discarding them), it can be used as a trade-off solution in extreme performance scenarios.
[0067] In one embodiment, when the second transport layer performs deduplication determination using cyclic redundancy flags and timestamps, if the target packet is a late old packet, a grace period mechanism is then used to determine whether the target packet is a new packet with a wraparound flag or a late duplicate packet. This application can also achieve deduplication determination through the following steps.
[0068] If the system timestamp carried by the target message is less than the base timestamp, the time difference is less than or equal to the preset grace period, and the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded; the time difference is the difference between the base timestamp and the system timestamp carried by the target message.
[0069] Alternatively, if the system timestamp carried by the target message is less than the base timestamp, the time difference is less than or equal to the preset grace period, and it is determined that the target message has not been received based on the cyclic redundancy flag carried by the target message, then traffic data is extracted from the target message.
[0070] Alternatively, if the system timestamp carried by the target message is less than the base timestamp and the time difference is greater than the preset grace period, the target message is discarded.
[0071] Specifically, the second transport layer queries the deduplication bitmap based on the cyclic redundancy identifier carried in the target message to determine the reference timestamp of the packet corresponding to the cyclic redundancy identifier, and compares the system timestamp carried in the target message with the reference timestamp. If the system timestamp carried in the target message is less than the reference timestamp, the relationship between the time difference and the preset grace period is determined.
[0072] If the time difference is less than or equal to the preset grace period, a bitmap determination is performed, which involves checking whether the value of the corresponding bit of the cyclic redundancy flag in the deduplication bitmap is 0. When the value of the corresponding bit of the cyclic redundancy flag in the deduplication bitmap is 0, it indicates that the target packet has not been received. In this case, the target packet is received, traffic data is extracted from the target packet, and the 0 is set to 1. Conversely, if the value of the corresponding bit of the cyclic redundancy flag in the deduplication bitmap is 1, it indicates that the target packet has been received. In this case, the target packet is discarded.
[0073] Conversely, if the time difference exceeds the preset grace period, the target packet is discarded directly without bitmap determination. For target packets that need to be discarded, they can be released directly to prevent interference with TCP congestion or UDP application layer repackaging.
[0074] For example, if the target message carries a cyclic redundancy flag of 257 and the system timestamp carried by the target message is less than the base timestamp of packet 1, then the 257th bit of the deduplication bitmap is queried. If the time difference is less than or equal to the preset grace period, then the bitmap is entered for judgment (if it is 0, the target message is received and set to 1; if it is 1, the target message is discarded). If the time difference is greater than the preset grace period, the target message is directly discarded without bitmap judgment.
[0075] It should be noted that if the system timestamp carried by the target packet is greater than the base timestamp, it indicates that the target packet is a new packet generated after wrapping around. In this case, the bitmap of the packet is cleared, the base timestamp of the corresponding packet is updated to the system timestamp carried by the target packet, and the bitmap determination is performed again. Since the bit has been cleared, its value must be 0, so the target packet is received and the bit is set. This ensures the accuracy of data transmission under extreme network latency and high-speed traffic.
[0076] For example, refer to Figure 3 The diagram shown illustrates the message processing and deduplication process at the receiving end. Figure 3 As shown, message TS is the system timestamp carried by the target message, and packet TS is the base timestamp. Figure 3 The timestamp comparison and determination process involved can be referred to the aforementioned embodiments. It will not be repeated here.
[0077] In one embodiment, when a message is encapsulated according to the TCP protocol, the traffic message obtained in step 101 is a TCP message.
[0078] The PRTP options field in a TCP packet includes: a first length field to identify the length of the options field, a first type field to identify the protocol type of the packet header, a first magic number field to identify the protocol identifier, a first timestamp field to carry the system timestamp, and a first redundancy flag field to carry the cyclic redundancy flag; the TCP payload of the TCP packet carries the traffic data.
[0079] Specifically, the first transport layer encapsulates traffic data, cyclic redundancy flags, and system timestamps according to the preset TCP packet extension structure to obtain TCP packets.
[0080] The preset TCP packet extension structure includes: [Ethernet Header] [IP Header] [TCP Header (including standard Options)] [PRTP High Availability Options (16 bytes)] [TCP Payload]; PRTP option internal structure: [Kind=12 (1 byte)] [Len=16 (1 byte)] [Magic number (4 bytes)] [Timestamp (8 bytes)] [Redundancy ID (2 bytes)].
[0081] In the above TCP packet extended structure, [Kind=12 (1 byte)] is the first type field, [Len=16 (1 byte)] is the first length field, [Magic number (4 bytes)] is the first magic number field, [TimeStamp (8 bytes)] is the first timestamp field, and [Redundancy ID (2 bytes)] is the first redundancy identifier field.
[0082] In one embodiment, when a message is encapsulated according to the UDP protocol, the traffic message obtained in step 101 is a UDP message.
[0083] The PRTP available header fields of a UDP packet include: a second length field to identify the length of the header fields, a second type field to identify the protocol type of the packet header, a second magic number field to identify the protocol identifier, a second timestamp field to carry the system timestamp, and a second redundancy flag field to carry the cyclic redundancy flag. The PRTP available header fields are located after the UDP header and before the UDP payload of the UDP packet. The UDP payload carries the traffic data.
[0084] Specifically, the first transport layer encapsulates traffic data, cyclic redundancy flags, and system timestamps according to the preset UDP packet extension structure to obtain UDP packets.
[0085] The preset UDP packet extension structure includes: [Ethernet Header] [IP Header] [UDP Header] [PRTP High Availability Header (16 bytes)] [UDP Payload].
[0086] The internal structure of the PRTP high availability header is as follows: [Type (1 byte)] [Len (1 byte)] [Magic number (4 bytes)] [Timestamp (8 bytes)] [Redundancy ID (2 bytes)].
[0087] In the above UDP packet extended structure, [Type (1 byte)] is the second type field, [Len (1 byte)] is the second length field, [Magic (4 bytes)] is the second magic number field, [TimeStamp (8 bytes)] is the second timestamp field, and [Redundancy ID (2 bytes)] is the second redundancy identifier field.
[0088] For example, refer to Figure 4 The diagram shown illustrates the TCP-UDP high availability packet encapsulation format, as follows: Figure 4 As shown, the existing standard TCP packet format consists of an Ethernet header, an IP header, a TCP header (including standard options), and a TCP payload in sequence. The existing standard UDP packet format consists of an Ethernet header, an IP header, a UDP header, and a UDP payload in sequence. Neither of them contains any identification information for high-availability redundant transmission. However, this application embeds a 16-byte PRTP high-availability option (containing type, length, magic number, timestamp, and redundancy flag fields) in the TCP header options area of the standard TCP packet format, and embeds a 16-byte PRTP high-availability header (containing the same field structure) between the UDP header and the UDP payload of the standard UDP packet format. Thus, without changing the overall framework of the standard packet, it adds cyclic redundancy flag and timestamp information to the packet.
[0089] from Figure 4 As can be seen, compared with the existing standard TCP / UDP packet formats, this application embeds PRTP high availability options or headers to enable packets to carry cyclic redundancy flags and timestamp information. This allows the receiving end to identify and filter duplicate packets at the transport layer, avoiding interference from duplicate packets in broadcast mode on the TCP congestion control mechanism and the processing burden caused by sending duplicate UDP packets to the application layer. At the same time, since the redundancy flag is embedded in the transport layer packet header, the extended packet is still a standard IP packet and can be forwarded normally by a Layer 3 router, breaking through the limitation that traditional Layer 2 redundancy protocols cannot be deployed across networks. In addition, the 8-byte high-precision timestamp allows the receiving end to perform time window filtering on packets and discard expired packets without relying on dedicated hardware, reducing deployment costs.
[0090] It should be noted that, in addition to embedding high availability identifiers (such as cyclic redundancy indicators) after the TCP options or UDP header, in a pure Internet Protocol version 6 (IPv6) network environment, high availability identifiers (magic number, system timestamp, cyclic redundancy indicator) can also be carried using IPv6 extension headers (such as the Destination Options Header, DOH) without modifying the transport layer header. This scheme can also achieve transparent transmission across three layers of routing without occupying transport layer protocol space.
[0091] Furthermore, in Internet Protocol version 4 (IPv4) networks, the high availability identifier can be placed in the IP options instead of the transport layer.
[0092] In one embodiment, the process of "extracting traffic data from the target packet" involved in step 104 can be implemented by... Figure 5 Steps 201 and 202 are implemented.
[0093] Step 201: If the target packet is a TCP packet, extract the traffic data from the TCP payload of the TCP packet.
[0094] Step 202: If the target packet is a UDP packet, modify the UDP protocol length field and the move data pointer of the UDP packet, and strip the PRTP available header fields to extract the traffic data in the UDP payload.
[0095] Specifically, when the target packet is a TCP packet, it can be sent normally, that is, the clean traffic data is directly extracted from the target packet and sent to the destination IP address. However, when the target packet is a UDP packet, the protocol field length needs to be modified and the data pointer needs to be moved in the kernel to strip the available PRTP header fields and extract the standard clean traffic data to send to the application layer; thus achieving complete transparency to the upper-layer application.
[0096] It should be noted that when the deduplication process determines that the target packet is a duplicate packet, TCP packets are discarded directly to avoid duplicate ACKs interfering with congestion control, and UDP packets are discarded directly to prevent the application layer from receiving duplicate packets. When the deduplication process determines that the target packet is a non-duplicate packet, TCP packets are sent normally, while UDP packets have their protocol length field modified in the kernel and the data pointer moved. The kernel strips the available header fields of PRTP and sends the standard, clean traffic data to the application layer, achieving complete transparency to the upper-layer application.
[0097] In one embodiment, when the event listening module of the control plane detects a physical network interface card (NIC) status change event or a link status change event, it can update the slave interface list after the status change is confirmed. To this end, this embodiment of the application implements the list update through the following steps.
[0098] If the first network protocol processing unit also includes an event-aware processing unit, and the event-aware processing unit detects a physical network interface card (NIC) status change event or detects a link status change through timer monitoring, then the following debouncing processing is performed: If the link is disconnected, wait for a first preset time before confirming the link is disconnected; or if the link is restored, wait for a second preset time before confirming the link is restored, and then update the list of subordinate interfaces.
[0099] Among them, the event perception and processing unit is set in Figure 2 In the control plane shown, for example, the event perception processing unit is specifically the bottom event perception layer in the control plane, or the event perception processing unit is set in the bottom event perception layer.
[0100] Physical network interface card (NIC) status change events are notifications captured and reported by the driver or kernel when the NIC link status (connection / disconnection) changes at the hardware level, used to detect the connectivity of the physical link in real time.
[0101] Specifically, the event awareness processing unit listens for physical network interface card (NIC) status change events. During initialization, it can register a listening callback with the kernel to receive notifications of these events. After registration, the event awareness processing unit enters listening mode, waiting for kernel notifications.
[0102] When the hardware detection circuit of a certain underlying physical network card detects a change in the link state (e.g., the network card is unplugged or re-inserted), an interrupt is triggered. After the underlying physical network card driver captures the interrupt, it reads the physical layer (PHY) status register, obtains the changed link state, and reports the physical network card status change event of the underlying physical network card to the registered event awareness processing unit through the kernel notification mechanism.
[0103] After the event awareness processing unit detects a physical network interface card (NIC) status change event, it parses the changed NIC identifier and the changed link status (link disconnected or link restored) from the event. Based on the parsing result, it triggers subsequent debouncing processing; that is, link disconnection requires confirmation after a first preset time, and link restoration requires confirmation after a second preset time. After confirming the status change, it updates the list of currently active slave interfaces on the data plane and updates the device status in real time through the monitoring interface on the observation plane, recording fault handover events through a counter.
[0104] The first network protocol processing unit can also start a timer that periodically triggers a link state detection task at a preset time interval (e.g., every 100 milliseconds).
[0105] Whenever the timer is triggered, the first network protocol processing unit traverses each slave interface in the slave interface list and reads the link status of each slave interface. This link status is maintained in real time by the underlying network card driver. When the physical link is normally connected and can send and receive data normally, the link status is set to the enabled state; when the physical link is disconnected, the network cable is unplugged, the switch port is closed, or the carrier signal is lost, the link status is set to the disabled state.
[0106] The first network protocol processing unit compares the current detected link status with the previous detected link status. If the link status of a slave interface changes from enabled to disabled, it is determined that a link disconnection event has occurred on the slave interface; if it changes from disabled to enabled, it is determined that a link recovery event has occurred, and anti-jitter processing is triggered in advance.
[0107] In one embodiment, during the underlying event sensing process, the Ethtool-driven statistics module on the observation plane collects the number of frames sent by each physical slave interface in real time, and calculates the physical port packet transmission rate by combining it with a time window, which is then used by the control plane to determine the actual data transmission capacity of the link. When an abnormal drop in the packet transmission rate of a slave interface is detected, a handover warning can be triggered in advance even if the link status is still UP. To this end, this application... Figure 6 The steps 301 and 302 shown trigger the anti-shake processing in advance.
[0108] Step 301: The event awareness processing unit periodically detects the packet sending rate of the third and fourth slave interfaces in the slave interface list.
[0109] Step 302: If the difference in packet transmission rate between the third slave interface and the fourth slave interface is detected to exceed the preset normal packet transmission rate threshold for M consecutive times, then anti-jitter processing is performed in advance; M is a positive integer.
[0110] Where M is a positive integer greater than or equal to 3.
[0111] It should be noted that, in addition to listening to physical network card status change events and monitoring link status through timers, the event awareness processing unit further detects the packet sending rate of each slave interface in the active slave interface list (i.e., the list of slave interfaces that are currently active) to identify the load balancing status between the two interfaces.
[0112] Specifically, the event-aware processing unit selects two slave interfaces from the list of active slave interfaces, denoted as the third slave interface and the fourth slave interface, respectively. The third slave interface and the fourth slave interface can be any two different slave interfaces in the list of active slave interfaces, such as the first slave interface and the second slave interface; or, they can be two other slave interfaces that are different from the first slave interface and the second slave interface.
[0113] The event-aware processing unit starts a timer to periodically detect the packet transmission rate of the third and fourth slave interfaces within a unit of time at preset time intervals (e.g., every 10 milliseconds). After each detection, the event-aware processing unit calculates the difference in packet transmission rates between the third and fourth slave interfaces; that is, each detection result is a packet transmission rate difference.
[0114] The event-aware processing unit records the packet rate difference obtained from each detection in a cache and statistically analyzes the results of multiple consecutive detections. If the packet rate difference detected M times consecutively exceeds the preset normal packet rate threshold, it is determined that the load between the third and fourth slave interfaces is severely unbalanced, and there is a significant difference in the sending capabilities of the two interfaces. Here, M is a positive integer, and its specific value can be configured according to the actual application scenario, for example, M is 3 or 5; the preset normal packet rate threshold is used to measure the maximum allowable load difference between the two interfaces, for example, it can be set to 20% of the maximum packet rate.
[0115] When the packet transmission rate difference exceeds the preset normal packet transmission rate threshold M times consecutively, the event awareness processing unit determines that there is an anomaly in the current transmission path of the third and fourth slave interfaces. Possible causes include a decrease in the actual available bandwidth of one of the links, uneven receiving and processing capabilities at the peer end, or performance bottlenecks in intermediate network devices. At this time, the event awareness processing unit performs anti-jitter processing in advance.
[0116] Through the packet transmission rate detection mechanism, the event awareness processing unit can promptly detect load imbalance problems caused by factors such as network congestion and differences in processing capabilities of the peer end without relying on changes in the physical link status. It can also dynamically adjust the transmission path through anti-jitter processing and list updates, further improving the efficiency and reliability of redundant transmission.
[0117] It should be noted that the event-aware processing unit does not necessarily rely on hardware interrupts. It can obtain link state changes by polling the MII register through a software timer, thus eliminating its dependence on specific hardware features. In addition to combining the kernel network device notification chain and the MII timer polling mechanism to ensure link state awareness, it is also possible to bypass MII timer polling and instead register a hardware interrupt handling function in the network card driver. When the network card physical layer detects a link state change and generates an interrupt, it directly triggers the state switching logic of the high-availability module.
[0118] For example, refer to Figure 7 The diagram shown illustrates the data output of the event perception and observation surface, as follows: Figure 7 As shown, after the list of active slave interfaces on the data plane is updated, the device status displayed on the observation plane will be updated in real time. Moreover, during the underlying event perception process, the Ethtool driver statistics module of the observation plane collects the number of frames sent by each physical slave interface in real time, and calculates the physical port packet sending rate in combination with the time window, so as to help the control plane judge the actual data transmission capacity of the link.
[0119] Furthermore, in the observation surface data extraction mechanism, the Ethtool driver statistics module reads the underlying statistical information of the physical slave interface's network card through the kernel standard ethtool interface. This includes the physical port packet sending rate and driver layer packet loss counts (including tx_dropped, rx_dropped, carrier_errors, rx_missed_errors, etc.). These underlying metrics complement the SNMP standard counts: SNMP counts are provided by the transport layer high availability processing module and the high availability virtual interface layer, reflecting the behavioral statistics at the high availability protocol layer; Ethtool statistics are provided by the physical slave interface's network card driver, reflecting the actual working status of the physical network card driver; the combination of the two enables end-to-end packet loss localization from the application layer to the physical layer.
[0120] Real-time status monitoring: When operations and maintenance personnel access the Proc monitoring directory, the kernel traverses the peer status hash mapping table maintained by the peer status management module, and combines the running data of the transport layer high availability processing module and the high availability virtual interface layer to dynamically format and output the peer IP connection status, packet sending and receiving statistics, bitmap occupancy rate, etc., to achieve fault location.
[0121] Dynamic process tracing: When investigating occasional packet loss, maintenance personnel activate tracing points embedded in the high availability processing module of the transport layer and the critical path of the high availability virtual interface layer to record the flow trajectory of packets at redundant transmission and deduplication determination points without loss, for post-event analysis.
[0122] In one embodiment, the specific process of "selecting a copy of the traffic packet from the first subordinate interface in the subordinate interface list and sending the traffic packet to the destination IP address from the second subordinate interface" in step 102 can be described in this embodiment through... Figure 8 Steps 401 and 402 shown are implemented.
[0123] Step 401: Determine all slave interfaces in the slave interface list except the last slave interface as the first slave interface, and determine the last slave interface in the slave interface list as the second slave interface.
[0124] Step 402: Send replication packets to the destination IP address through each of the first slave interfaces, and send traffic packets to the destination IP address through the second slave interface.
[0125] Specifically, if the list of currently active slave interfaces contains N slave interfaces, where N is a positive integer greater than or equal to 2, then the first virtual interface determines all slave interfaces in the list except the last one as the first slave interface, and determines the last slave interface in the list as the second slave interface. That is, the number of first slave interfaces is N-1, and the number of second slave interfaces is 1.
[0126] For example, when the list of active slave interfaces contains three slave interfaces, the first virtual interface designates the first two slave interfaces as the first slave interface and the last slave interface as the second slave interface. When the list of active slave interfaces contains two slave interfaces, the first virtual interface designates the first slave interface as the first slave interface and the second slave interface as the second slave interface.
[0127] After determining the first slave interface and the second slave interface, the first virtual interface sends a copy of the traffic packet to the destination IP address through each of the first slave interfaces, and sends the traffic packet itself to the destination IP address through the second slave interface.
[0128] Reference Figure 9 The flowchart shown below illustrates the sending end processing flow. Figure 9In the process, it is determined whether the interface is a high-availability virtual interface, specifically whether it is the first virtual interface. When the interface is determined to be the first virtual interface, the first transport layer intercepts and tags the received traffic data, that is, it encapsulates the received traffic data and adds TCP high availability options (i.e., adds the PRTP high availability option in the TCP packet extension structure) to generate traffic packets according to the TCP protocol, or adds UDP high availability headers (i.e., adds the PRTP high availability option in the UDP packet extension structure) to generate traffic packets. Then, it enters the high-availability virtual interface (i.e., the first virtual interface) for redundant transmission. The specific process involved can be referred to the aforementioned embodiment. It will not be repeated here.
[0129] Using the aforementioned message transmission method, multiple first slave interfaces simultaneously send the same replicated message, allowing the same replicated message to be sent to the receiving end via multiple different physical links. Even if some links fail, as long as at least one link remains operational, the replicated message on that link can reach the receiving end, thus avoiding data loss due to a single link failure. Simultaneously, the second slave interface sends the original traffic message, maintaining the diversity of transmission paths and further enhancing the reliability of redundant transmission.
[0130] It should be noted that the order of the slave interfaces in the currently active slave interface list can be pre-configured or dynamically sorted based on the link speed, current load, or priority of each slave interface. This embodiment does not limit the specific sorting method of the slave interfaces, as long as the last slave interface can be determined. Furthermore, the value of N depends on the number of currently active slave interfaces; when the number of active slave interfaces changes, the determination of the first and second slave interfaces is also dynamically updated accordingly.
[0131] Furthermore, it should be noted that the user spaces corresponding to the sending and receiving operating system kernels respectively include the user space application layer and standard network configuration commands (such as the IP command). This application can extend the kernel's standard network device configuration interface (such as Netlink) by registering a custom set of high-availability link type operations with the Linux kernel. This allows the system's original standard network configuration commands (such as the IP command) to natively support the creation, destruction, slave NIC binding, and runtime parameter configuration of high-availability virtual interfaces without installing private configuration tools or modifying the source code, greatly reducing the complexity of operation and maintenance.
[0132] In one embodiment, the specific process of "selecting a copy of the traffic packet from the first slave interface in the slave interface list and sending the traffic packet to the destination IP address from the second slave interface" in step 102 can also be achieved through [further details needed]. Figure 10Steps 501 and 502 shown are implemented.
[0133] Step 501: If it is determined from the destination IP address that the copy packet and traffic packet need to be forwarded through the gateway, then replace the destination MAC address of the copy packet and traffic packet with the MAC address of the gateway.
[0134] Step 502: Send the copy packet and traffic packet with the destination MAC address replaced to the gateway through the first slave interface and the second slave interface respectively. The gateway then forwards the copy packet and traffic packet to the destination IP address.
[0135] Specifically, the first virtual interface selects a first slave interface and a second slave interface from the list of currently active slave interfaces for redundant replication and transmission. That is, it sends a replicated traffic packet through the first slave interface and a traffic packet through the second slave interface.
[0136] Before sending, the first virtual interface performs a route lookup based on the destination IP address to determine whether the copy packet and traffic packet need to be forwarded to the destination IP address via the gateway. When the route lookup result determines that the packet transmission needs to be forwarded via the gateway, the first virtual interface obtains the gateway's Media Access Control Address (MAC address) and replaces the destination MAC address of the copy packet and traffic packet with the gateway's MAC address.
[0137] Subsequently, the first virtual interface layer sends the copy packet and traffic packet with the destination MAC address replaced to the gateway through the first slave interface and the second slave interface, respectively. The gateway then forwards the copy packet and traffic packet to the destination IP address.
[0138] For example, the gateway's MAC address can be obtained by: requesting the gateway to query the corresponding MAC address through the Address Resolution Protocol (ARP), or obtaining it from the local ARP cache table. If the corresponding entry does not exist locally, the ARP resolution process is triggered.
[0139] Unlike existing technologies where the PRP / HSR protocol relies on special Layer 2 labels and cannot be deployed across Layer 3 networks, this application's embodiment replaces the destination MAC address of redundant packets with the gateway MAC address, enabling the redundant packets to be recognized as standard IP packets and forwarded normally by the Layer 3 gateway. This achieves zero-packet-loss switching and kernel-level precise deduplication for deployment across Layer 3 networks.
[0140] This application also allows user space to configure high-availability interface parameters and bind slave interfaces by creating property files under / sys / class / net / or / proc / net / prtp / and using standard file read / write operations (such as echo 100>miimon).
[0141] As can be seen from the above embodiments, compared with the existing Bonding master / standby / broadcast mode and PRP / HSR two-layer redundancy protocol, this application has the following significant advantages: First, it achieves seamless switching with zero packet loss and eliminates the switching window period: Unlike the existing Bonding master-slave mode, which suffers from packet loss due to logical switching delays, this application uses multi-path redundancy transmission through the link layer virtual interface to ensure that data packets can still reach the other end from other active links when any link fails. This fundamentally eliminates the time window for master-slave switching and meets the stringent requirements of real-time services for zero packet loss.
[0142] Second, it achieves kernel-level precise deduplication, eliminating protocol stack interference and application layer burden: Unlike existing Bonding broadcast modes that lack deduplication capabilities, this application performs precise interception at the receiving end transport layer based on a high availability flag and bitmap mechanism. For TCP, duplicate packets are discarded before entering congestion control logic, avoiding a sharp drop in throughput caused by duplicate ACKs; for UDP (especially unfragmented small packets), deduplication and flag removal are completed in kernel mode, ensuring that the application layer receives only one clean copy of the data, completely eliminating the complex logic and buffer overflow risk of application layer deduplication.
[0143] Third, it naturally supports deployment across three-layer networks and is applicable to a wide range of scenarios: Unlike existing Layer 2 redundancy protocols such as PRP / HSR that rely on special encapsulation at the data link layer and cannot penetrate standard routers, this application embeds the high availability identifier in the transport layer (TCP option or UDP header). Its redundant traffic is fully compatible with standard IP networks and can seamlessly penetrate Layer 3 routing devices, achieving end-to-end high availability transmission across network segments and routes.
[0144] Fourth, seamless integration into the standard operation and maintenance ecosystem reduces deployment and operation and maintenance costs: Unlike solutions that require dedicated configuration tools or in-depth modification of application code, this application extends the kernel standard communication interface and registers custom link types, so that the system's original standard network configuration commands (such as IP commands) can directly create, configure and manage highly available virtual interfaces without any modification. This achieves complete transparency to upper-layer applications and operation and maintenance systems, greatly reducing the deployment threshold and learning cost.
[0145] This application is primarily used in scenarios with extremely high requirements for network reliability and real-time performance, including but not limited to the following scenarios: (1) Power system wide area measurement (Phasor Measurement Unit, PMU): requires millisecond-level data transmission, and any packet loss will lead to misjudgment of the power grid status. (2) Industrial Internet / Rail Transit Control: The workshop network not only requires no packet loss, but also requires cross-routing deployment. The Layer 2 Parallel Redundancy Protocol (PRP) cannot meet the cross-network segment requirements.
[0146] (3) High-frequency financial transactions: are extremely sensitive to the throughput and low latency of TCP connections. The repeated TCP ACK caused by the traditional Bonding broadcast mode will seriously interfere with the transaction speed.
[0147] It should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0148] On the other hand, this application also provides a computer-readable storage medium, which may be included in the computer device described in the above embodiments, or may exist independently and not assembled into the computer device. The aforementioned computer-readable storage medium stores one or more programs that, when used by one or more processors, execute the methods described in this application. For example, it may execute... Figure 1 The steps of the method shown are as follows.
[0149] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0150] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0151] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor. The names of these units or modules do not, in certain circumstances, constitute a limitation on the unit or module itself.
[0152] This application provides a computer program product including instructions that, when executed, cause the method described in this application to be performed. For example, it can execute... Figure 1 The steps of the method shown are as follows.
[0153] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0154] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A data transmission method based on the transport layer, characterized in that, A first network protocol processing unit is applied in the kernel of the sending end's operating system, and a second network protocol processing unit is applied in the kernel of the receiving end's operating system. The first network protocol processing unit includes a first transport layer and a first virtual interface, and the second network protocol processing unit includes a second transport layer, a second virtual interface, and an underlying physical network interface card (NIC). The method includes: The first transport layer determines the destination IP address and the first virtual interface based on the received traffic data, and adds a packet header including a cyclic redundancy flag to the traffic data to obtain a traffic packet; the cyclic redundancy flag is used to confirm the packet reception status. The first virtual interface obtains a list of currently active slave interfaces, selects a first slave interface from the list to send a copy of the traffic packet, and a second slave interface to send the traffic packet to the destination IP address. If the underlying physical network interface card receives a packet, the second virtual interface replaces the receiving device of the packet from the underlying physical network interface card with the second virtual interface to obtain the target packet; the target packet is the copy packet or the traffic packet. If the second transport layer determines that the target message has not been received based on the cyclic redundancy flag carried by the target message, it extracts the traffic data from the target message and transmits the traffic data to the user space corresponding to the kernel of the receiving end operating system.
2. The method according to claim 1, characterized in that, When the message header also includes a system timestamp, the method further includes: If the system timestamp carried by the target message is equal to the base timestamp, and it is determined that the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded. If the system timestamp carried by the target message is equal to the base timestamp, and it is determined that the target message has not been received based on the cyclic redundancy flag carried by the target message, then the traffic data is extracted from the target message.
3. The method according to claim 2, characterized in that, The method further includes: If the system timestamp carried by the target message is less than the reference timestamp, the time difference is less than or equal to the preset grace period, and it is determined that the target message has been received based on the cyclic redundancy flag carried by the target message, then the target message is discarded; the time difference is the difference between the reference timestamp and the system timestamp carried by the target message. If the system timestamp carried by the target message is less than the reference timestamp, the time difference is less than or equal to the preset grace period, and it is determined that the target message has not been received according to the cyclic redundancy flag carried by the target message, then the traffic data is extracted from the target message. If the system timestamp carried by the target message is less than the base timestamp and the time difference is greater than the preset grace period, then the target message is discarded.
4. The method according to claim 1, characterized in that, The traffic packets are Transmission Control Protocol (TCP) packets; The Partially Reliable Transport Protocol (PRTP) option field of the TCP packet includes: a first length field for identifying the length of the option field, a first type field for identifying the protocol type of the packet header, a first magic number field for identifying the protocol identifier, a first timestamp field for carrying the system timestamp, and a first redundancy identifier field for carrying the cyclic redundancy identifier; the TCP payload of the TCP packet carries the traffic data.
5. The method according to claim 1, characterized in that, The traffic packets are User Datagram Protocol (UDP) packets; The PRTP available header fields of the UDP packet include: a second length field for identifying the length of the header fields, a second type field for identifying the protocol type of the packet header, a second magic number field for identifying the protocol identifier, a second timestamp field for carrying the system timestamp, and a second redundancy identifier field for carrying the cyclic redundancy identifier; the PRTP available header fields are after the UDP header of the UDP packet and before the UDP payload; the UDP payload carries the traffic data.
6. The method according to claim 1, characterized in that, The step of selecting a first slave interface from the slave interface list to send a copy of the traffic packet, and a second slave interface to send the traffic packet to the destination IP address, includes: If it is determined from the destination IP address that the copied packet and the traffic packet need to be forwarded through the gateway, then the destination MAC address of the copied packet and the traffic packet is replaced with the MAC address of the gateway; The duplicated packet and the traffic packet, with the destination MAC address replaced, are sent to the gateway through the first slave interface and the second slave interface, respectively. The gateway then forwards the duplicated packet and the traffic packet to the destination IP address.
7. The method according to claim 1, characterized in that, The first network protocol processing unit further includes an event-aware processing unit, and the method further includes: If the event sensing and processing unit detects a change in the physical network card status, or detects a change in the link status through timer monitoring, then the following debouncing processing is performed: If the link is disconnected, wait for a first preset time to confirm the link is disconnected; or if the link is restored, wait for a second preset time to confirm the link is restored, and then update the list of subordinate interfaces.
8. The method according to claim 7, characterized in that, The method further includes: The event awareness processing unit periodically detects the packet sending rate of the third and fourth slave interfaces in the slave interface list. If the packet transmission rate difference between the third slave interface and the fourth slave interface is detected to exceed the preset normal packet transmission rate threshold M times consecutively, the anti-jitter processing will be performed in advance; M is a positive integer.
9. The method according to claim 1, characterized in that, The step of selecting a first slave interface from the slave interface list to send a copy of the traffic packet, and a second slave interface to send the traffic packet to the destination IP address, includes: All slave interfaces in the slave interface list except the last slave interface are designated as the first slave interface, and the last slave interface in the slave interface list is designated as the second slave interface. The replication message is sent to the destination IP address through each of the first slave interfaces, and the traffic message is sent to the destination IP address through the second slave interface.
10. A computer program product having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data transmission method according to any one of claims 1 to 9.