Packet receiving method, packet forwarding method and device
By employing flexible flow specification sorting methods, including skip sorting, sorting by reception order, or hit rate sorting, the problem of efficient sorting and security of network devices under multiple flow specifications is solved, thereby improving traffic forwarding efficiency and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-12-03
- Publication Date
- 2026-06-05
AI Technical Summary
When processing multiple flow specifications, existing network devices consume a lot of system resources and take a long time in sorting. Moreover, the sorting behavior is predictable, which increases the risk of being attacked and reduces traffic forwarding efficiency.
By skipping sorting processes, sorting according to receiving order or hit rate, or sorting the stream according to a specified message method, the sorting flexibility is improved, computational resource consumption is reduced, and the risk of attacks is lowered.
It improves the efficiency and flexibility of flow ordering, reduces system load, lowers the risk of network device attacks, and enhances traffic forwarding efficiency.
Smart Images

Figure CN122160445A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a message receiving method, a message forwarding method, and an apparatus. Background Technology
[0002] Streaming specifications are crucial rules and standards for ensuring the efficient, orderly, and secure transmission of data streams within a network. By adhering to these specifications, interoperability between different devices can be achieved, network communication performance can be optimized, and high-quality streaming media services can be provided. With the development of network technologies and the increase in the types of services, numerous streaming specifications also need to be configured in network devices.
[0003] When forwarding packets, network devices need to match the appropriate flow specification for the packet. Since there are many flow specifications in a network device, a data flow can be matched with multiple flow specifications. Therefore, it is necessary to sort the flow specifications.
[0004] However, due to the large number of flow specifications, the current flow specification sorting method consumes network device system resources, increases system load, and takes a long time to sort. Summary of the Invention
[0005] This application provides a message receiving method, a message forwarding method, and an apparatus that can improve the flexibility of flow specification sequencing, reduce the system sequencing burden, and improve sequencing efficiency, thereby improving the forwarding efficiency of traffic.
[0006] In a first aspect, embodiments of this application provide a message receiving method, applied to a network device, the method comprising:
[0007] Retrieve the message, which includes the flow specification;
[0008] The flow specification is processed, and the flow specification processing methods include at least one of the following:
[0009] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0010] Sort according to the receiving order of the stream specification;
[0011] Sort by hit rate according to flow specification; or,
[0012] Sort according to the sorting method specified in the message.
[0013] According to this solution, compared with existing sorting processes, network devices can improve the flexibility of flow specification sorting by processing flow specifications through these methods. For example, in some scenarios, skipping the sorting process for flow specifications can improve the effectiveness of flow specifications, thereby improving traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting according to the sorting method specified by the packet, specifically, for example, skipping the sorting process for flow specifications in the first set and sorting by reception order for flow specifications in the second set, can reduce the system sorting burden and improve sorting efficiency. Furthermore, since the sorting behavior of network devices is not fixed, the behavior of network devices is unpredictable, thereby reducing the risk of attacks on traffic forwarded by network devices through flow specifications. Furthermore, when network devices have multiple sorting methods, the time and resources consumed by flow specification sorting can be reduced. At the same time, the sorting behavior of network devices is not fixed, and the behavior of network devices is unpredictable. Thus, the risk of network devices being attacked by traffic forwarded through flow specifications can be reduced.
[0014] In one possible implementation, the message includes indication information that indicates the sorting method specified by the message.
[0015] This increases the flexibility of flow specification ordering and makes the ordering behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0016] In one possible implementation, the network device includes flow specification groups, with different flow specification groups corresponding to different sorting methods. The packets are sorted according to the sorting method specified in the protocol, including:
[0017] After adding the flow specifications to the target flow specification group, they are sorted. The sorting method of the target flow specification group is the same as the sorting method indicated by the instruction information.
[0018] In this way, different flow specification groups have different sorting methods, thereby improving the flexibility of flow specification sorting. When network devices include multiple sorting methods, the time and resources consumed by flow specification sorting can be reduced. At the same time, it also makes the sorting behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0019] In one possible implementation, the flow specification groups have priorities, and the method also includes:
[0020] Match the flow specification of the forwarded data packet according to the priority of the flow specification group.
[0021] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0022] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0023] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0024] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0025] In one possible implementation, the sorting method for the indication information includes:
[0026] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0027] Sort according to the receiving order of the stream specification;
[0028] Sort by hit rate according to flow specification; or,
[0029] Sort the quintuples according to the flow specification.
[0030] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0031] In one possible implementation, the method also includes:
[0032] Calculate and store the hit rate for each flow specification.
[0033] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0034] In one possible implementation, the hit rate for each stream specification is counted and stored, including:
[0035] The hit rate of each flow specification is statistically analyzed and stored according to a preset period.
[0036] In one possible implementation, the hit rate refers to the forwarding rate of packets or the number of times a flow specification is matched.
[0037] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0038] In one possible implementation, the priority of the first-order specification is higher than that of the second-order specification, and the hit rate of the first-order specification is higher than that of the second-order specification.
[0039] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0040] In one possible implementation, the message carries indication information that indicates the hit rate sorting according to the flow specification.
[0041] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0042] In one possible implementation, the stream is ordered according to the receiving order of the stream specification, including:
[0043] Based on the order in which the flow specifications are received, an index number is assigned to each flow specification. The index number is used to indicate the position of the flow specification.
[0044] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0045] In one possible implementation, the order of receiving the stream specifications is sorted, including: in the event that the third stream specification is revoked, assigning the index code of the third stream specification to the stream specification.
[0046] This reduces the computational resources and time consumed by flow specification sorting, improves the efficiency of flow specification implementation, and thus improves traffic forwarding efficiency.
[0047] In one possible implementation, the message includes indication information that indicates the order of reception according to the flow specification.
[0048] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0049] In one possible implementation, the flow specification includes matching elements and the action corresponding to each matching element.
[0050] Secondly, embodiments of this application provide a message forwarding method applied at a sending end, the method comprising:
[0051] A message is sent to the network device. The message includes flow specifications and indication information. The indication information is used to indicate the sorting method specified in the message, so that the network device can sort the flow specifications according to the sorting method.
[0052] According to this scheme, by specifying the sorting method for the messages, the sorting behavior of network devices is not fixed, and thus the behavior of network devices is unpredictable. This reduces the risk of attacks on traffic forwarded by network devices according to flow specifications.
[0053] In one possible implementation, the sorting methods include:
[0054] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0055] Sort according to the receiving order of the stream specification;
[0056] Sort by hit rate according to flow specification; or,
[0057] Sort the quintuples according to the flow specification.
[0058] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0059] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0060] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0061] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0062] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0063] In one possible implementation, the sender is a network controller or a network device.
[0064] Thirdly, embodiments of this application provide a message receiving apparatus applied to a network device, the apparatus comprising:
[0065] The acquisition module is used to acquire messages, including flow specifications;
[0066] The processing module is used to process the flow specifications, and the flow specification processing methods include at least one of the following:
[0067] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0068] Sort according to the receiving order of the stream specification;
[0069] Sort by hit rate according to flow specification; or,
[0070] Sort according to the sorting method specified in the message.
[0071] According to this solution, compared with existing sorting processes, network devices can improve the flexibility of flow specification sorting by processing flow specifications through these methods. For example, in some scenarios, skipping the sorting process for flow specifications can improve the effectiveness of flow specifications, thereby improving traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting according to the specified sorting method for packets makes the sorting behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications. Furthermore, when network devices employ multiple sorting methods, the time and resources consumed by flow specification sorting can be reduced. Simultaneously, the unpredictable sorting behavior of network devices further reduces the risk of attacks on traffic forwarded by network devices through flow specifications.
[0072] In one possible implementation, the message includes indication information that indicates the sorting method specified by the message.
[0073] This increases the flexibility of flow specification ordering and makes the ordering behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0074] In one possible implementation, the network device includes flow specification groups, with different flow specification groups corresponding to different sorting methods. The processing module is used to add flow specifications to the target flow specification group and then sort them. The sorting method of the target flow specification group is the same as the sorting method indicated by the indication information.
[0075] In this way, different flow specification groups have different sorting methods, thereby improving the flexibility of flow specification sorting. When network devices include multiple sorting methods, the time and resources consumed by flow specification sorting can be reduced. At the same time, it also makes the sorting behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0076] In one possible implementation, the flow specification groups have priorities, and the apparatus further includes:
[0077] The matching module is used to match the flow specifications of forwarded data packets according to the priority of the flow specification group.
[0078] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0079] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0080] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0081] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0082] In one possible implementation, the sorting method for the indication information includes:
[0083] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0084] Sort according to the receiving order of the stream specification;
[0085] Sort by hit rate according to flow specification; or,
[0086] Sort the quintuples according to the flow specification.
[0087] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0088] In one possible implementation, the device further includes:
[0089] The statistics module is used to count and store the hit rate of each flow specification.
[0090] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0091] In one possible implementation, the statistics module is used to count and store the hit rate of each flow specification according to a preset period.
[0092] In one possible implementation, the hit rate refers to the forwarding rate of packets or the number of times a flow specification is matched.
[0093] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0094] In one possible implementation, the priority of the first-order specification is higher than that of the second-order specification, and the hit rate of the first-order specification is higher than that of the second-order specification.
[0095] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0096] In one possible implementation, the message carries indication information that indicates the hit rate sorting according to the flow specification.
[0097] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0098] In one possible implementation, the processing module is used to assign an index number to the stream specification according to the order in which the stream specifications are received. The index number is used to indicate the position of the stream specification.
[0099] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0100] In one possible implementation, the processing module is used to assign the index code of the third stream specification to the stream specification in the event that the third stream specification is revoked.
[0101] This reduces the computational resources and time consumed by flow specification sorting, improves the efficiency of flow specification implementation, and thus improves traffic forwarding efficiency.
[0102] In one possible implementation, the message includes indication information that indicates the order of reception according to the flow specification.
[0103] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0104] In one possible implementation, the flow specification includes matching elements and the action corresponding to each matching element.
[0105] Fourthly, embodiments of this application provide a message forwarding device applied at a sending end, the device comprising:
[0106] The sending module is used to send messages to network devices. The messages include flow specifications and indication information. The indication information is used to indicate the sorting method specified in the messages, so that the network devices can sort the flow specifications according to the sorting method.
[0107] According to this scheme, by specifying the sorting method for the messages, the sorting behavior of network devices is not fixed, and thus the behavior of network devices is unpredictable. This reduces the risk of attacks on traffic forwarded by network devices according to flow specifications.
[0108] In one possible implementation, the sorting methods include:
[0109] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0110] Sort according to the receiving order of the stream specification;
[0111] Sort by hit rate according to flow specification; or,
[0112] Sort the quintuples according to the flow specification.
[0113] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0114] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0115] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0116] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0117] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0118] In one possible implementation, the sender is a network controller or a network device.
[0119] Fifthly, embodiments of this application provide a network device, including: at least one memory for storing a program; and at least one processor for executing the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method provided in the first aspect or the method provided in the second aspect.
[0120] In a sixth aspect, embodiments of this application provide a network controller, including: at least one memory for storing a program; and at least one processor for executing the program stored in the memory, wherein when the program stored in the memory is executed, the processor is used to execute the method provided in the second aspect.
[0121] In a seventh aspect, embodiments of this application provide a network device that executes computer program instructions to perform the method provided in the first aspect or the method provided in the second aspect. For example, the device may be a chip or a processor.
[0122] In one example, the device may include a processor that may be coupled to memory, read instructions from the memory and execute the methods provided in the first aspect or the methods provided in the second aspect according to those instructions. The memory may be integrated into the chip or processor, or it may be independent of the chip or processor.
[0123] In an eighth aspect, embodiments of this application provide a network controller that executes computer program instructions to perform the method provided in the second aspect. Exemplarily, the device may be a chip or a processor.
[0124] In one example, the device may include a processor that can be coupled to memory, read instructions from the memory, and execute the methods provided in the second aspect according to those instructions. The memory may be integrated into the chip or processor, or it may be independent of the chip or processor.
[0125] Ninthly, embodiments of this application provide a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method provided in the first aspect or the method provided in the second aspect.
[0126] In a tenth aspect, embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method provided in the first aspect or the method provided in the second aspect. Attached Figure Description
[0127] Figure 1 This is a schematic diagram of a flow specification provided in an embodiment of this application;
[0128] Figure 2 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application;
[0129] Figure 3 This is a schematic diagram illustrating a use case of a flow specification provided in an embodiment of this application;
[0130] Figure 4 This is a flowchart illustrating a message receiving method provided in an embodiment of this application;
[0131] Figure 5 This is an exemplary schematic diagram of a message receiving method provided in an embodiment of this application;
[0132] Figure 6 This is a schematic diagram of a message format provided in an embodiment of this application;
[0133] Figure 7 This is a schematic diagram of another message format provided in an embodiment of this application;
[0134] Figure 8 This is a schematic diagram of the flow specification grouping provided in an embodiment of this application;
[0135] Figure 9 This is a flowchart illustrating a message forwarding method provided in an embodiment of this application;
[0136] Figure 10 This is a schematic diagram of the structure of a message receiving device provided in an embodiment of this application;
[0137] Figure 11 This is a schematic diagram of the structure of a message forwarding device provided in an embodiment of this application;
[0138] Figure 12 This is a schematic diagram of the structure of a network device provided in an embodiment of this application;
[0139] Figure 13 This is a schematic diagram of the structure of a network controller provided in an embodiment of this application. Detailed Implementation
[0140] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0141] As the demand for processing business messages increases, so too do the methods of message processing. For example, flow specifications can be applied when processing business messages. A flow specification is an N-tuple containing multiple rules and corresponding actions. If a message matches all the rules, it means that the message matches a flow specification. Request for Comments (RFC) 8955 and RFC 8956 define the rules and actions for flow specifications in Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6), respectively. Rules can also be called matching components, and actions can be called policies. Figure 1As shown, this N-tuple is placed in the Network Layer Reachability Information (NLRI) field of the Border Gateway Protocol (BGP). The NLRI field defines the length of the N-tuple and its specific content, i.e., the NLRI value. The NLRI value is a variable. This application does not limit the content of the rules and actions. For example, the elements matched in the rules include, but are not limited to, DestinationPrefix / Destination Internet Protocol (IP) address, SourcePrefix / Source IP address, Protocol Number, Port Number, Destination Port Number, Internet Control Message Protocol (ICMP) Type, ICMP Code, Transmission Control Protocol (TCP) Flags, Packet Length, Diffserv Code Point (DSCP), and Fragment Flag.
[0142] For example, the action or policy being executed is placed in the extended community attribute. For instance, traffic filtering actions include, but are not limited to, the following actions:
[0143] 1. Traffic Rate in Bytes (traffic-rate-bytes) sub-type 0x06;
[0144] 2. Data packet rate subtype 0x0c;
[0145] 3. Traffic-action subtype 0x07;
[0146] 4. RT Redirect sub-type 0x08 (RT Redirect(rt-redirect)sub-type 0x08);
[0147] 5. Traffic Marking (traffic-marking) sub-type 0x09;
[0148] 6. Interaction with other filtering mechanisms in routers;
[0149] 7. Considerations on Traffic Filtering Action Interference.
[0150] Different traffic types require different flow specifications, and as business volume increases, the number of flow specifications also increases. Furthermore, multiple flow specifications can match a specific type of traffic; therefore, it is necessary to define the matching order of flow specifications. Currently, there are several ways to sort flow specifications, such as lexicographical sorting and user-defined sorting.
[0151] In this context, lexicographical sorting refers to the relative order of different flow specifications determined by comparing their individual components. Lexicographical sorting begins with the leftmost matching element (the smallest matching element type value) of the flow specifications. If the types differ, the flow specification with the lowest numeric type value has higher priority than a flow specification that does not contain that component type. If the types are equal, the comparison continues to the next matching element.
[0152] For example, the flow specifications in network devices are shown in Table 1, where Table 1 is the flow specifications to be sorted in network devices.
[0153] Table 1
[0154]
[0155]
[0156] According to RFC 8955, the priority of matching elements is as follows: Destination IP address > Source IP address > Protocol number > Destination port number > Source port number. The flow specifications in Table 1 are sorted according to the set of matching elements contained in each flow specification. Specifically, comparing flow specification 1 and flow specification 2, we can see that the leftmost element of flow specification 1 is a type 4 port number, while the leftmost element of flow specification 2 is a type 1 destination IP address. Since 1 < 4, the smaller type value has higher priority; therefore, flow specification 2 is ranked before flow specification 1.
[0157] Comparing Flow Specification 3 and Flow Specification 2: The leftmost element of Flow Specification 3 is the source IP address of type 2, while the leftmost element of Flow Specification 2 is the destination IP address of type 1. Since 1 < 2, the smaller type value has higher priority, therefore Flow Specification 2 is ranked before Flow Specification 3. Comparing Flow Specification 2 and Flow Specification 6: The leftmost elements of both Flow Specification 2 and Flow Specification 6 are the destination IP addresses of type 1, so we compare the next element; the second matching element of both Flow Specification 2 and Flow Specification 6 is the protocol number of type 3, so we compare the next element; the third matching element of Flow Specification 2 is the source port number of type 6, while the third matching element of Flow Specification 6 is the destination port number of type 5. Since 5 < 6, the smaller type value has higher priority, therefore Flow Specification 6 is ranked before Flow Specification 2. And so on, the order of the various flow specifications in Table 1 in the current implementation is shown in Table 2.
[0158] Table 2
[0159]
[0160] However, due to the large number of flow specifications in the system, and the frequent changes in these specifications, the system needs to continuously sort the existing flow specifications lexicographically, consuming significant system resources. Furthermore, sorting a large number of flow specifications takes considerable time, resulting in low efficiency when deploying flow specifications. Additionally, the lexicographical sorting method makes the network devices' communication predictable, thus making them vulnerable to attacks and data leaks, increasing the risk of packet forwarding errors. Finally, the large number of flow specifications in a network device also increases the matching time, reducing packet forwarding efficiency.
[0161] To allow for greater flexibility in the ordering of flow specifications, BGP flow specification version 2 defines an order field in NLRI. The order field indicates the priority of the flow specification; a smaller value indicates a higher priority.
[0162] For example, the order of the flow specifications shown in Table 1 is shown in Table 3.
[0163] Table 3
[0164] Flow Specification The set of matching elements included in the flow specification Order Flow Specification 1 Port number: 7001 3 Flow Specification 2 Destination IP address: 10.1.1.1; Protocol number: 6; Source port number: 6001 6 Flow Specification 3 Source IP address: 20.1.1.1 2 Flow Specification 4 Destination IP address: 10.1.1.1; Protocol number: 6; 4 Flow Specification 5 Protocol No.: 17 1 Flow Specification 6 Destination IP address: 10.1.1.1; Protocol number: 6; Destination port number: 5001 5 ……
[0165] The flow specifications are sorted according to the order of each flow specification in Table 3. The sorted flow specifications are shown in Table 4.
[0166] Table 4
[0167]
[0168]
[0169] However, when there are a large number of flow rules in the system, the order of flow rules can be cumbersome to manage when users define the order of flow rules. This can lead to longer activation times for flow rules and reduce the efficiency of traffic forwarding.
[0170] Furthermore, the aforementioned flow specification sorting method requires a considerable amount of time to sort the flow specifications, thus reducing the efficiency of their effectiveness. However, technologies for preventing Distributed Denial of Service (DDoS) attacks place high demands on the efficiency of flow specification effectiveness. Therefore, the time-consuming sorting method of the aforementioned flow specifications results in insufficient effectiveness to prevent DDoS attacks.
[0171] Based on this, embodiments of this application provide a message receiving method, a message forwarding method, and an apparatus. In this method, network devices process flow specifications through these processing methods, which improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process of flow specifications can improve the effectiveness of flow specifications, thereby improving traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thereby improving traffic forwarding efficiency. In still other scenarios, sorting according to the specified sorting method of the message makes the sorting behavior of the network device unpredictable, thus reducing the risk of attacks on traffic forwarded by the network device through flow specifications. Furthermore, when the network device includes multiple sorting methods, the time and resources consumed in flow specification sorting can be reduced. Simultaneously, the unpredictable sorting behavior of the network device further reduces the risk of attacks on traffic forwarded by the network device through flow specifications.
[0172] The technical solution of this application is described below. First, the application scenarios of the embodiments of this application are introduced.
[0173] Figure 2 This is a schematic diagram of an application scenario provided in an embodiment of this application. For example... Figure 2 As shown in the illustration, this application provides a communication network as an application scenario. This communication network includes multiple network devices. These network devices include, but are not limited to, servers, switches, routers, and network controllers. This application does not limit the type of network devices.
[0174] For example, such as Figure 2As shown, the communication network includes network devices 201, 202, 203, 204, 205, 206, and 207. Network device 201 can be a network controller, while devices 206 and 207 can be terminal devices or servers, etc. Specifically, network device 201 can send flow specifications to network devices 202, 203, 204, and 205. Alternatively, network devices 202, 203, 204, and 205 can forward flow specifications to each other.
[0175] Taking network device 201 as the network controller, network device 201 as the destination device of the flow specification, and device 1 as the sender of data traffic as an example, the use cases of the flow specification are explained. Figure 3 As shown, the use cases of flow specifications include the following steps 1 to 5.
[0176] Step 1: The network controller generates the flow specifications for the destination device based on user input or local configuration.
[0177] Step 2: The network controller sends the flow specifications to the destination device via a BGP session.
[0178] Step 3: The destination device sorts the received flow specifications to obtain flow specification entries. Flow specification entries are used to indicate the order in which each flow specification is processed.
[0179] Step 4: The destination device receives the data traffic sent by the terminal device.
[0180] Step 5: The destination device matches the flow specification of the forwarded data traffic from the flow specification table entry and forwards the data traffic according to the flow specification.
[0181] The above is an introduction to the application scenarios of this application. The following describes the method embodiments of this application.
[0182] Figure 4 This is a flowchart illustrating a message forwarding method provided in an embodiment of this application. The message forwarding method provided in this embodiment is applied to... Figure 2 The network device shown can be any network device in the communication network. For example... Figure 3 As shown, the message forwarding method provided in this application embodiment includes steps S401 to S402.
[0183] S401, retrieve message, the message includes flow specifications.
[0184] Network devices can obtain packets from the network controller or from neighboring network devices. These packets carry flow specifications. Flow specifications include matching elements and the corresponding action for each matching element.
[0185] In some embodiments, the message transmission protocol includes BGP or the Path Computation Element Communication Protocol (PCEP).
[0186] S402, processing of convection specifications.
[0187] In this application embodiment, there are multiple ways to process flow specifications. The way network devices process flow specifications can be pre-deployed in the network devices, or it can be determined through the indication information in the flow specifications.
[0188] Specifically, the processing method for flow specifications in this application includes at least one of the following: skipping the sorting process of flow specifications and sending the flow specifications to the traffic forwarding table, sorting according to the receiving order of flow specifications, sorting according to the hit rate of flow specifications, or sorting according to the sorting method specified by the message.
[0189] Next, we will describe in detail the various processing flow specifications provided in the embodiments of this application.
[0190] In some embodiments, in order to improve the efficiency of flow specification activation and thus improve traffic forwarding efficiency, after receiving the flow specification, the network device can skip the sorting process of the flow specification and directly add the flow specification to the traffic forwarding table to activate it, thereby saving the time consumed by sorting the flow specification and improving the efficiency of flow specification activation.
[0191] One possible implementation is that after receiving the flow specifications, the network device skips the sorting process for the flow specifications. At this point, the multiple flow specifications can be considered unordered, and the flow specifications can be directly added to the traffic forwarding table to take effect. This saves the time spent sorting the flow specifications, improves the efficiency of flow specification activation, and thus improves traffic forwarding efficiency.
[0192] In other embodiments, after receiving the flow specifications, the network device stores them in the order they were received, thus skipping the flow specification sorting process. For example, the network device receives flow specifications f1 to f6 sequentially from the network controller. The network device assigns an index to each flow specification in the order they were received. Table 5 shows the storage order of flow specifications f1 to f6. Here, the index number only indicates the specific position of the flow specification in the flow specification table entry and does not indicate the priority of the flow specification.
[0193] Table 5
[0194] Index code Flow Specification 1 Flow specification f1 2 Flow specification f2 3 Flow specification f3 4 Flow specification f4 5 Flow specification f5 6 Flow specification f6
[0195] In another example, the storage order of flow specifications in the network device is shown in Table 5. After receiving the instruction from the network controller to cancel flow specification f3, the network device directly cancels flow specification f3 and does not reorder the remaining flow specifications. After canceling flow specification f3 in Table 5, the storage order of flow specifications is shown in Table 6. This reduces the consumption of computing resources of the network device.
[0196] Table 6
[0197] Index code Flow Specification 1 Flow specification f1 2 Flow specification f2 3 4 Flow specification f4 5 Flow specification f5 6 Flow specification f6
[0198] As another example, in a network device, if there are any empty positions in the flow specification table, upon receiving a new flow specification, the network device can directly insert the flow specification into the empty position. For instance, in a network device, the flow specification table entries are as shown in Table 6. The network controller sends a message to the network device carrying flow specification f7. The network device does not need to sort the flow specifications; it directly assigns index code 3 to flow specification f7. The flow specification table entries after adding flow specification f7 are shown in Table 7.
[0199] Table 7
[0200] Index code Flow Specification 1 Flow specification f1 2 Flow specification f2 3 Flow specification f7 4 Flow specification f4 5 Flow specification f5 6 Flow specification f6
[0201] When there are no empty spaces in the flow specification table, a new flow specification is added to the end of the flow specification table entry. For example, the current flow specification entries of the network device are shown in Table 7. The network device receives a packet sent by the network controller, which carries flow specification f8. The network device assigns index number 7 to flow specification f8. The flow specification after adding flow specification f8 is shown in Table 8.
[0202] Table 8
[0203] Index code Flow Specification 1 Flow specification f1 2 Flow specification f2 3 Flow specification f7 4 Flow specification f4 5 Flow specification f5 6 Flow specification f6 7 Flow specification f8
[0204] Thus, skipping the sorting process of flow specifications can improve the efficiency of flow specification activation, thereby improving the efficiency of traffic forwarding.
[0205] In some embodiments, flow specifications are sorted according to their hit rate. The flow specification hit rate refers to the packet forwarding rate, the number of times a flow specification is matched, or the byte forwarding rate. Specifically, the packet forwarding rate refers to the forwarding rate of packets matched by the flow specification. For example, the network device can count the number of packets matching flow specification f1 to determine the hit rate of flow specification f1. The byte forwarding rate refers to the number of bytes forwarded per second according to the flow specification or the number of bits forwarded per second. For example, the network device can count the number of bytes or bits of traffic forwarded via flow specification f1.
[0206] For example, a flow specification table is deployed in the network device. As shown in Table 9, the flow specification table includes an index code, a flow specification identifier, and a flow specification match rate. After statistically analyzing the match rates of flow specifications f1 to f6, the match rate of each flow specification is obtained, as shown in Table 9.
[0207] Table 9
[0208] Index code Flow Specification Hit rate (match) 1 Flow specification f1 200 2 Flow specification f2 300 3 Flow specification f3 500 4 Flow specification f4 100 5 Flow specification f5 50 6 Flow specification f6 600
[0209] After sorting the flow specifications according to the hit rate of each flow specification in Table 9, the flow specification items are obtained as shown in Table 10.
[0210] Table 10
[0211] Index code Flow Specification Hit rate (match) 1 Flow specification f6 600 2 Flow specification f3 500 3 Flow specification f2 300 4 Flow specification f1 200 5 Flow specification f4 100 6 Flow specification f5 50
[0212] When the hit rate of the first flow specification is greater than that of the second flow specification, the first flow specification has a higher priority than the second flow specification. For example, if the flow specifications that match the traffic include both the first and second flow specifications, the network device forwards the traffic using the first flow specification because the first flow specification has a higher priority than the second flow specification. For instance, traffic A can be matched with flow specifications f6 and f2. Since the hit rate of flow specification f6 is greater than that of flow specification f2, the priority of flow specification f6 is higher than that of flow specification f2, and the network device forwards traffic A using flow specification f6.
[0213] As one possible implementation, network devices are configured with a period, and the network devices statistically analyze the hit rate of each flow specification according to the period.
[0214] Therefore, sorting flow specifications according to their hit rate allows flow specifications with higher hit rates to be prioritized for traffic matching, increasing the rate at which traffic matches flow specifications. This improves the effectiveness of flow specifications, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources.
[0215] It should be noted that, in the embodiments of this application, the index code is used to indicate the specific position of the flow specification in the flow specification table, and after the initial hit rate of the non-attacked flow specification, the smaller the value of the index code, the more times the flow specification matches the traffic.
[0216] In other embodiments, the network device sorts the packets according to a sorting method indicated by the packets. For example, such as... Figure 5 As shown, taking the example of a network controller sending flow specifications to a destination device, the network controller generates a message carrying the flow specifications and indicating the sorting method for the flow specifications. After receiving the message, the network device sorts the flow specifications according to the sorting method indicated in the message. The sorting method indicated in the message includes at least one of the following: skipping the sorting process for flow specifications and sending the flow specifications to the traffic forwarding table; sorting according to the received order of flow specifications; sorting according to the hit rate of flow specifications; sorting according to the five-tuple of flow specifications; or user-defined sorting. These sorting methods are the same as those described above; please refer to the detailed explanation of each sorting method above for further details, which will not be repeated here.
[0217] The indication information can be identified by characters. For example, "1" indicates skipping the sorting process of the flow specification and sending the flow specification to the traffic forwarding table; "2" indicates sorting according to the receiving order of the flow specification; "3" indicates sorting according to the hit rate of the flow specification; "4" indicates sorting according to the five-tuple of the flow specification; and "5" indicates user-defined sorting.
[0218] This increases the flexibility of flow specification ordering and makes the ordering behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0219] As one possible implementation, when the message transport protocol is BGP, the indication information can be carried in the extended community attribute field, the BGP extended community field, or the BGP path attribute field. For example, taking the indication information carried in the extended community attribute field as an example... Figure 6As shown, the extended community attribute field includes a high-byte type value (Typehigh) and a low-byte type value (Typelow(*)). The high-byte and low-byte type values can be determined based on the specific situation. To carry indication information, the extended community attribute field defines an Order Type field, where the information is the indication information. Additionally, the extended community attribute field can define a Period field for sorting; the Period field is optional. When the indication information in the Order Type field indicates sorting based on the hit rate of the flow specification, the Period field can be used to specify the period for calculating the flow specification hit rate. The remaining fields of the extended community attribute field are reserved.
[0220] As another possible implementation, when the message transmission protocol is PCEP, the indication information can be carried in the request parameter field of the stateful path computation element. Specifically, in the request parameter field of the stateful path computation element, such as... Figure 7 As shown, the request parameter fields for the stateful path computation element include optional type-length-value fields (Optional TLVs). These optional type-length-value fields define the type, length, reserved field, order type, and period. The type value can be determined based on the specific requirements. The length indicates the sum of the lengths of the reserved field, order type, and period.
[0221] The order type indicates the sorting method. The period field is optional. When the information in the order type field indicates sorting based on the hit rate of the flow specification, the period field can be used to specify the period for calculating the hit rate of the flow specification.
[0222] In some embodiments, the network device may include multiple flow specification groups, with different flow specification groups corresponding to different sorting methods. After receiving a packet, the network device adds the flow specification to the flow specification group indicated by the indication information in the packet. For example, such as... Figure 8As shown, the network device includes flow specification group 1, flow specification group 2, and flow specification group 3. Flow specification group 1 uses the sorting method of "skipping the sorting process for flow specifications and sending the flow specifications to the traffic forwarding table," with an identifier of 1. Flow specification group 2 uses the sorting method of "sorting according to the receiving order of flow specifications," with an identifier of 2. Flow specification group 3 uses the sorting method of "sorting according to the hit rate of flow specifications," with an identifier of 3. The network controller sends a message to the network device carrying flow specification A, and the message carries an identifier of 1. The network device adds flow specification A to flow specification group 1 based on the identifier.
[0223] As one possible implementation, different flow specification groups have different priorities. Network devices match the flow specification used to forward data packets according to the priority of different flow specification groups. For example, ... Figure 8 As shown, the priority of flow specification group 1 is higher than that of flow specification group 2, and the priority of flow specification group 2 is higher than that of flow specification group 3. After the network device receives a data packet, it matches the data packet against the flow specification in flow specification group 1. If no flow specification of the data packet is matched in flow specification group 1, the flow specification of the data packet is matched against that in flow specification group 2.
[0224] Thus, different flow specification groups have different sorting methods, thereby improving the flexibility of flow specification sorting. In some cases, network devices can skip the sorting process of flow specifications and directly add the flow specifications to the traffic forwarding table for effect, which can improve the efficiency of flow specification activation and thus improve traffic forwarding efficiency. In other cases, sorting according to the hit rate of flow specifications can prioritize flow specifications with high hit rates for traffic matching, improving traffic forwarding efficiency. Moreover, when network devices have multiple sorting methods, the time and resources consumed by flow specification sorting are reduced, and the sorting behavior of network devices is not fixed, making the behavior of network devices unpredictable. This reduces the risk of attacks on traffic forwarded by network devices through flow specifications.
[0225] Figure 9 This is a flowchart illustrating a message forwarding method provided in an embodiment of this application. The message forwarding method provided in this embodiment is applied to a sending end, which can be a network controller or a network device. Figure 9 As shown, the message forwarding method provided in this application embodiment includes:
[0226] S901 sends a message to the network device. The message includes flow specifications and indication information. The indication information is used to indicate the sorting method specified in the message, so that the network device can sort the flow specifications according to the sorting method.
[0227] When the sending end needs to send flow specifications to the network device, the sending end can carry indication information in the message to specify the ordering method of the flow specifications.
[0228] According to this scheme, by specifying the sorting method for the messages, the sorting behavior of network devices is not fixed, and thus the behavior of network devices is unpredictable. This reduces the risk of attacks on traffic forwarded by network devices according to flow specifications.
[0229] In this embodiment of the application, the sorting method indicated by the indication information includes: skipping the sorting process of the flow specifications and sending the flow specifications to the traffic forwarding table, sorting according to the receiving order of the flow specifications, sorting according to the hit rate of the flow specifications, or sorting according to the five-tuple of the flow specifications.
[0230] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0231] In some embodiments, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Element Communication Protocol (PCEP). When the message transmission protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field; when the message transmission protocol is PCEP, the indication information is located in the Stateful Path Computing Element Request Parameter field.
[0232] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0233] Based on the same concept as the message receiving method embodiments of this application, this application also provides a message receiving device. The message receiving device includes several modules, each module being used to execute various steps in the message receiving method provided in this application. The division of modules is not limited here. Those skilled in the art will clearly understand that in practical applications, the various steps in the message receiving method provided in this application can be assigned to different modules as needed, that is, the internal structure of the device can be divided into different modules to complete all or part of the functions described above. The modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more modules can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0234] For example, the message receiving device is used to execute the message receiving method provided in the embodiments of this application. Figure 10 This is a schematic diagram of the structure of the message receiving device provided in the embodiments of this application. Figure 10 As shown, the message receiving device provided in this application embodiment includes:
[0235] Acquisition module 1001 is used to acquire messages, including flow specifications;
[0236] Processing module 1002 is used to process flow specifications, and the flow specification processing methods include at least one of the following:
[0237] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0238] Sort according to the receiving order of the stream specification;
[0239] Sort by hit rate according to flow specification; or,
[0240] Sort according to the sorting method specified in the message.
[0241] According to this solution, network devices process flow specifications using these methods, which improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the effectiveness of flow specifications, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting according to the specified sorting method for packets makes the sorting behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications. Furthermore, when network devices employ multiple sorting methods, the time and resources consumed in flow specification sorting can be reduced. Simultaneously, the unpredictable sorting behavior of network devices further reduces the risk of attacks on traffic forwarded by network devices through flow specifications.
[0242] In one possible implementation, the message includes indication information that indicates the sorting method specified by the message.
[0243] This increases the flexibility of flow specification ordering and makes the ordering behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0244] In one possible implementation, the network device includes flow specification groups, with different flow specification groups corresponding to different sorting methods. The processing module is used to add flow specifications to the target flow specification group and then sort them. The sorting method of the target flow specification group is the same as the sorting method indicated by the indication information.
[0245] In this way, different flow specification groups have different sorting methods, thereby improving the flexibility of flow specification sorting. When network devices include multiple sorting methods, the time and resources consumed by flow specification sorting can be reduced. At the same time, it also makes the sorting behavior of network devices unpredictable, thus reducing the risk of attacks on traffic forwarded by network devices through flow specifications.
[0246] In one possible implementation, the flow specification groups have priorities, and the apparatus further includes:
[0247] The matching module is used to match the flow specifications of forwarded data packets according to the priority of the flow specification group.
[0248] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0249] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0250] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0251] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0252] In one possible implementation, the sorting method for the indication information includes:
[0253] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0254] Sort according to the receiving order of the stream specification;
[0255] Sort by hit rate according to flow specification; or,
[0256] Sort the quintuples according to the flow specification.
[0257] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0258] In one possible implementation, the device further includes:
[0259] The statistics module is used to count and store the hit rate of each flow specification.
[0260] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0261] In one possible implementation, the statistics module is used to count and store the hit rate of each flow specification according to a preset period.
[0262] In one possible implementation, the hit rate refers to the forwarding rate of packets or the number of times a flow specification is matched.
[0263] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0264] In one possible implementation, the priority of the first-order specification is higher than that of the second-order specification, and the hit rate of the first-order specification is higher than that of the second-order specification.
[0265] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0266] In one possible implementation, the message carries indication information that indicates the hit rate sorting according to the flow specification.
[0267] Thus, sorting flow specifications by hit rate is a simple method that reduces the computational resources and time consumed by flow specification sorting, improves the effectiveness of flow specifications, and thus improves the forwarding efficiency of traffic.
[0268] In one possible implementation, the processing module is used to assign an index number to the stream specification according to the order in which the stream specifications are received. The index number is used to indicate the position of the stream specification.
[0269] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0270] In one possible implementation, the processing module is used to assign the index code of the third stream specification to the stream specification in the event that the third stream specification is revoked.
[0271] This reduces the computational resources and time consumed by flow specification sorting, improves the efficiency of flow specification implementation, and thus improves traffic forwarding efficiency.
[0272] In one possible implementation, the message includes indication information that indicates the order of reception according to the flow specification.
[0273] In this way, the flow specification sorting method is simple, which can reduce the computing resources and time consumed by flow specification sorting, improve the efficiency of flow specification implementation, and thus improve the forwarding efficiency of traffic.
[0274] In one possible implementation, the flow specification includes matching elements and the action corresponding to each matching element.
[0275] Based on the same concept as the message forwarding method embodiments of this application, this application also provides a message forwarding method apparatus. The message forwarding method apparatus includes several modules, each module being used to execute various steps in the message forwarding method provided in the embodiments of this application. The division of modules is not limited here. Those skilled in the art will clearly understand that in practical applications, the various steps in the message forwarding method provided in the embodiments of this application can be assigned to different modules as needed, that is, the internal structure of the apparatus can be divided into different modules to complete all or part of the functions described above. The modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more modules can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the modules in the above apparatus can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0276] For example, the message forwarding device is used to execute the message forwarding method provided in the embodiments of this application. Figure 11 This is a schematic diagram of the message forwarding device provided in the embodiments of this application. Figure 11 As shown, the message forwarding apparatus provided in this application embodiment includes:
[0277] The sending module 1101 is used to send a message to the network device. The message includes flow specifications and indication information. The indication information is used to indicate the sorting method specified in the message so that the network device can sort the flow specifications according to the sorting method.
[0278] According to this scheme, by specifying the sorting method for the messages, the sorting behavior of network devices is not fixed, and thus the behavior of network devices is unpredictable. This reduces the risk of attacks on traffic forwarded by network devices according to flow specifications.
[0279] In one possible implementation, the sorting methods include:
[0280] Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table;
[0281] Sort according to the receiving order of the stream specification;
[0282] Sort by hit rate according to flow specification; or,
[0283] Sort the quintuples according to the flow specification.
[0284] This improves the flexibility of flow specification sorting. For example, in some scenarios, skipping the sorting process for flow specifications can improve the efficiency of flow specification activation, thereby increasing traffic forwarding efficiency and reducing the consumption of network device computing resources. In other scenarios, sorting by flow specification hit rate allows flow specifications with high hit rates to be prioritized for traffic matching, thus improving traffic forwarding efficiency. In still other scenarios, sorting by the order in which flow specifications are received simplifies the sorting method and reduces the consumption of network device computing resources.
[0285] In one possible implementation, the message transmission protocol includes Border Gateway Protocol (BGP) or Path Computing Unit Communication Protocol (PCEP).
[0286] When the message's transport protocol is BGP, the indication information is located in the Extended Community Attribute field, the BGP Extended Community field, or the BGP Path Attribute field;
[0287] When the message transmission protocol is PCEP, the indication information is located in the request parameter field of the stateful path calculation element.
[0288] In this way, flow specifications can be transmitted through different protocols, which improves the efficiency and effectiveness of flow specification transmission and enables the sorting method of flow specifications to support a variety of network services and applications.
[0289] In one possible implementation, the sender is a network controller or a network device.
[0290] Based on the same concept as the method embodiments of this application, this application also provides a network device. This network device can be a data forwarding device such as a switch or router.
[0291] like Figure 12 As shown, the network device 1200 provided in this application embodiment includes a processor 1201, a memory 1202, and a communication interface 1203.
[0292] In this embodiment, the processor 1201 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0293] The memory 1202 may include a large-capacity memory for data or instructions, thereby providing storage space for the network device's operating system and executable program code, which may include, but is not limited to: Windows system (an operating system), Linux system (an operating system), HarmonyOS system (an operating system), etc., without limitation.
[0294] For example, and not as a limitation, memory 1202 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1202 may include removable or non-removable (or fixed) media. Where appropriate, memory 1202 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 1202 is non-volatile solid-state memory.
[0295] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory may include one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software that may include computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the message receiving or message forwarding methods according to this application.
[0296] For example, a computer program may be stored in the memory 1202, and the processor 1201 executes the computer program to implement the steps in the above method embodiments. Alternatively, the processor 1201 executes the computer program to implement the functions of each module in the above-described message receiving device or message forwarding device embodiments. Exemplarily, the computer program may be divided into one or more modules / units, which may be a series of computer program instruction segments capable of performing a specific function. One or more modules / units are stored in the memory 1202 and executed by the processor 1201 to complete this application. For example, the computer program may be divided into multiple modules, such as the modules in the message receiving device or message forwarding device described above.
[0297] The communication interface 1203 is used to send and receive data, for example, to send data processed by the processor 1201 to other network devices, or to receive data sent by other devices.
[0298] Of course, for the sake of simplicity, Figure 12 Only some of the components of the network device 1200 relevant to this application are shown, omitting components such as buses, input / output interfaces, etc. In addition, the network device 1200 may include any other suitable components depending on the specific application. Furthermore, the network device may be a desktop router, switch, or other network device. Those skilled in the art will understand that... Figure 12 This is merely an example of network device 1200 and does not constitute a limitation on network devices. It may include more or fewer components than shown, or combine certain components, or use different components.
[0299] Based on the same concept as the method embodiments of this application, embodiments of this application also provide a network controller.
[0300] like Figure 13 As shown, the network controller 1300 provided in this application embodiment includes a processor 1301, a memory 1302, and a communication interface 1303.
[0301] In this embodiment, the processor 1301 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0302] The memory 1302 may include a large-capacity memory for data or instructions, thereby providing storage space for the network controller's operating system and executable program code, which may include, but is not limited to: Windows (an operating system), Linux (an operating system), HarmonyOS (an operating system), etc., without limitation.
[0303] For example, and not as a limitation, memory 1302 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1302 may include removable or non-removable (or fixed) media. Where appropriate, memory 1302 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 1302 is non-volatile solid-state memory.
[0304] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory may include one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software that may include computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the message forwarding method according to this application.
[0305] For example, a computer program may be stored on the memory 1302, and the processor 1301 executes the computer program to implement the steps in the above method embodiments. Alternatively, the processor 1301 executes the computer program to implement the functions of each module in the above message forwarding device embodiments. Exemplarily, the computer program may be divided into one or more modules / units, which may be a series of computer program instruction segments capable of performing a specific function. The one or more modules / units are stored in the memory 1302 and executed by the processor 1301 to complete this application. For example, the computer program may be divided into multiple modules, such as the modules in the device described above.
[0306] The communication interface 1303 is used to send and receive data, for example, to send data processed by the processor 1301 to a network device, or to receive data sent by other devices.
[0307] Of course, for the sake of simplicity, Figure 13 This document only shows some of the components of the network controller 1300 relevant to this application, omitting components such as buses, input / output interfaces, etc. In addition, the network controller 1300 may include any other suitable components depending on the specific application. Furthermore, the network controller can be a network controller for desktop computers, laptops, handheld computers, and cloud servers, etc. Those skilled in the art will understand that... Figure 13 This is merely an example of network controller 1300 and does not constitute a limitation on the network controller. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the network controller may also include input devices, output devices, network access devices, buses, etc. For example, the input device may include, for example, a keyboard, mouse, etc. For example, the output device may output various information to the outside, including, for example, a display, a communication network, and its connected remote output devices, etc.
[0308] In addition to the methods, apparatus, and computing devices described above, embodiments of this application may also provide a computer program product, comprising computer program instructions. When executed by a processor, these computer program instructions cause the processor to perform the steps of the methods in the various embodiments of this application described in the "Method" section of this specification. The computer program product may be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The computer program code may be in source code form, object code form, executable file, or some intermediate form. The computer program code may be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0309] Furthermore, embodiments of this application may also provide a computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the display control method according to various embodiments of this disclosure as described in the "Method" section above. The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable 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. It should be noted that the content contained in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, a computer-readable medium may not include electrical carrier signals and telecommunication signals.
[0310] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.
[0311] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. It should be understood that in the embodiments of this application, the order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0312] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.
Claims
1. A message receiving method, characterized in that, Applied to network devices, the method includes: Obtain a message, the message including flow specifications; The flow specification is processed, and the processing method of the flow specification includes at least one of the following: Skip the sorting process for flow specifications and send the flow specifications to the flow forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort according to the sorting method specified in the message.
2. The method according to claim 1, characterized in that, The message includes indication information, which is used to indicate the sorting method specified in the message.
3. The method according to claim 2, characterized in that, The network device includes flow specification groups, and different flow specification groups correspond to different sorting methods. The sorting according to the sorting method specified for the packets includes: The flow specifications are added to the target flow specification group and then sorted, wherein the sorting method of the target flow specification group is the same as the sorting method indicated by the indication information.
4. The method according to claim 3, characterized in that, The flow specification group has a priority, and the method further includes: Match the flow specification of the forwarded data packet according to the priority of the flow specification group.
5. The method according to any one of claims 2-4, characterized in that, The transmission protocol of the message includes Border Gateway Protocol (BGP) or Path Calculation Unit Communication Protocol (PCEP). When the transmission protocol of the message is BGP, the indication information is located in the extended community attribute field, the BGP extended community field, or the BGP path attribute field; When the transmission protocol of the message is PCEP, the indication information is located in the Stateful Path Calculation Element Request Parameter field.
6. The method according to any one of claims 2-5, characterized in that, The sorting method indicated by the instruction information includes: Skip the sorting process for the flow specifications and send the flow specifications to the traffic forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort the quintuples according to the flow specification.
7. The method according to claim 1, characterized in that, The method further includes: Calculate and store the hit rate for each flow specification.
8. The method according to claim 7, characterized in that, The process of statistically analyzing and storing the hit rate for each flow specification includes: The hit rate of each flow specification is statistically analyzed and stored according to a preset period.
9. The method according to claim 1, 7 or 8, characterized in that, The hit rate refers to the forwarding rate of the packet or the number of times the packet matches the flow specification.
10. The method according to any one of claims 1, 7-9, characterized in that, First-order specifications have a higher priority than second-order specifications, and the hit rate of first-order specifications is higher than that of second-order specifications.
11. The method according to any one of claims 7-10, characterized in that, The message carries indication information, which is used to indicate the order of hit rates according to the flow specification.
12. The method according to claim 1, characterized in that, The ordering according to the receiving order of the stream specification includes: Based on the order in which the flow specifications are received, an index number is assigned to each flow specification, and the index number is used to indicate the position of the flow specification.
13. The method according to claim 12, characterized in that, The sorting according to the receiving order of the flow specification includes: in the event that the third flow specification is revoked, assigning the index code of the third flow specification to the flow specification.
14. The method according to claim 12 or 13, characterized in that, The message includes indication information, which is used to indicate the order of reception according to the flow specification.
15. The method according to any one of claims 1-14, characterized in that, The flow specification includes matching elements and actions corresponding to each matching element.
16. A message forwarding method, characterized in that, Applied to the sending end, the method includes: A message is sent to a network device, the message including flow specifications and indication information, the indication information being used to indicate a sorting method specified in the message, so that the network device can sort the flow specifications according to the sorting method.
17. The method according to claim 16, characterized in that, The sorting methods include: Skip the sorting process for the flow specifications and send the flow specifications to the traffic forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort the quintuples according to the flow specification.
18. The method according to claim 16 or 17, characterized in that, The transmission protocol of the message includes Border Gateway Protocol (BGP) or Path Calculation Unit Communication Protocol (PCEP). When the transmission protocol of the message is BGP, the indication information is located in the extended community attribute field, the BGP extended community field, or the BGP path attribute field; When the transmission protocol of the message is PCEP, the indication information is located in the Stateful Path Calculation Element Request Parameter field.
19. The method according to any one of claims 16-18, characterized in that, The sending end is a network controller or network device.
20. A message receiving device, characterized in that, Applied to network devices, the device includes: The acquisition module is used to acquire messages, the messages including flow specifications; The processing module is used to process the flow specification, and the processing method of the flow specification includes at least one of the following: Skip the sorting process for the flow specifications and send the flow specifications to the traffic forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort according to the sorting method specified in the message.
21. The apparatus according to claim 20, characterized in that, The message includes indication information, which is used to indicate the sorting method specified in the message.
22. The apparatus according to claim 21, characterized in that, The network device includes flow specification groups, and different flow specification groups correspond to different sorting methods. The processing module is used to add the flow specifications to the target flow specification group and then sort them. The sorting method of the target flow specification group is the same as the sorting method indicated by the indication information.
23. The apparatus according to claim 22, characterized in that, The flow specification group has a priority, and the device further includes: The matching module matches the flow specifications of the forwarded data packets according to the priority of the flow specification group.
24. The apparatus according to any one of claims 21-23, characterized in that, The transmission protocol of the message includes Border Gateway Protocol (BGP) or Path Calculation Unit Communication Protocol (PCEP). When the transmission protocol of the message is BGP, the indication information is located in the extended community attribute field, the BGP extended community field, or the BGP path attribute field; When the transmission protocol of the message is PCEP, the indication information is located in the Stateful Path Calculation Element Request Parameter field.
25. The apparatus according to any one of claims 21-24, characterized in that, The sorting method indicated by the instruction information includes: Skip the sorting process for the flow specifications and send the flow specifications to the traffic forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort the quintuples according to the flow specification.
26. The apparatus according to claim 20, characterized in that, The device further includes: The statistics module is used to count and store the hit rate of each flow specification.
27. The apparatus according to claim 26, characterized in that, The statistics module is used to count and store the hit rate of each flow specification according to a preset period.
28. The apparatus according to claim 20, 26 or 27, characterized in that, The hit rate refers to the forwarding rate of the packet or the number of times the packet matches the flow specification.
29. The apparatus according to any one of claims 20, 26-28, characterized in that, First-order specifications have a higher priority than second-order specifications, and the hit rate of first-order specifications is higher than that of second-order specifications.
30. The apparatus according to any one of claims 26-29, characterized in that, The message carries indication information, which is used to indicate the order of hit rates according to the flow specification.
31. The apparatus according to claim 20, characterized in that, The processing module is used to assign an index number to the flow specification according to the order in which the flow specification is received, and the index number is used to indicate the position of the flow specification.
32. The apparatus according to claim 31, characterized in that, The processing module is used to assign the index code of the third stream specification to the stream specification in the event that the third stream specification is revoked.
33. The apparatus according to claim 31 or 32, characterized in that, The message includes indication information, which is used to indicate the order of reception according to the flow specification.
34. The apparatus according to any one of claims 20-33, characterized in that, The flow specification includes matching elements and actions corresponding to each matching element.
35. A message forwarding device, characterized in that, Applied to the transmitting end, the device includes: A sending module is used to send a message to a network device. The message includes a flow specification and indication information. The indication information is used to indicate a sorting method specified in the message, so that the network device can sort the flow specification according to the sorting method.
36. The apparatus according to claim 35, characterized in that, The sorting methods include: Skip the sorting process for the flow specifications and send the flow specifications to the traffic forwarding table; Sort according to the receiving order of the stream specification; Sort by hit rate according to flow specification; or, Sort the quintuples according to the flow specification.
37. The apparatus according to claim 35 or 36, characterized in that, The transmission protocol of the message includes Border Gateway Protocol (BGP) or Path Calculation Unit Communication Protocol (PCEP). When the transmission protocol of the message is BGP, the indication information is located in the extended community attribute field, the BGP extended community field, or the BGP path attribute field; When the transmission protocol of the message is PCEP, the indication information is located in the Stateful Path Calculation Element Request Parameter field.
38. The apparatus according to any one of claims 35-37, characterized in that, The sending end is a network controller or network device.
39. A network device, characterized in that, include: Memory, used to store executable code; A processor, configured to, when executing the executable code, implement the method of any one of claims 1-15, or implement the method of any one of claims 16-19.
40. A network controller, characterized in that, include: Memory, used to store executable code; A processor, configured to implement the method of any one of claims 1-15 when executing the executable code.
41. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed in a computer, causes the computer to perform the method according to any one of claims 1-15, or the method according to any one of claims 16-19.
42. A computer program product containing instructions, characterized in that, When the instructions are executed on a computer, the computer performs the method of any one of claims 1-15, or the method of any one of claims 16-19.