Message matching method and device
By setting up address block sets in network devices and binding ACL rules, and using the dichotomy method to divide address blocks for matching, the problem of long packet matching caused by multiple ACL rules is solved and processing efficiency is significantly improved.
Patent Information
- Application Number
- CN202410976923.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-19
AI Technical Summary
In network devices, when there are many ACL rules, packet matching takes a long time, resulting in low processing efficiency.
By setting up a set of address blocks on the network device side, the source IP address and destination IP address are bound to the ACL rules of the message protocol, and the address blocks are divided using the dichotomy method to match the ACL rules one by one to shorten the matching time.
This greatly shortens the packet matching time and improves packet processing efficiency. Especially when there are a large number of ACL rules, the number of matches is reduced to a maximum of 24.
Smart Images

Figure CN118694602A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message matching method and device. Background Art
[0002] With the development of network technology, network security issues occur frequently. Users have higher and higher requirements for network control strategies. The most commonly used network control strategy is to match and filter messages. In the process of using Access Control List (ACL), the number of ACL rules configured by users is increasing, even reaching tens of thousands.
[0003] When users use network devices to match packets based on ACL rules, if there are many ACL rules, a large number of matches may be required to successfully match a packet. Even a large number of packets will successfully match the last ACL rule, resulting in a long packet matching time and low packet processing efficiency. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present application provides a message matching method and device.
[0005] According to a first aspect of an embodiment of the present application, a message matching method is provided, the method being applied to a network device, the method comprising:
[0006] Receive messages;
[0007] When it is necessary to match any IP address of the source IP address and the destination IP address of the message, determine a first address block corresponding to the IP address in a first address block set corresponding to a message protocol corresponding to the message, wherein the first address block set includes 24 address blocks;
[0008] If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rule is matched one by one;
[0009] If there is no first ACL rule matching the IP address, determining that the matching result of the message is that there is no ACL rule matching the IP address;
[0010] If there is a first ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0011] According to a second aspect of an embodiment of the present application, a message matching device is provided, the device being applied to a network device, the device comprising:
[0012] A receiving module, used for receiving messages;
[0013] A matching module, used for, when it is necessary to match any IP address of the source IP address and the destination IP address of the message, determining a first address block corresponding to the IP address in a first address block set corresponding to the message protocol corresponding to the message, wherein the first address block set includes 24 address blocks;
[0014] If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rules is matched one by one; if there is no first ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a first ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0015] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above-mentioned message matching method.
[0016] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of the above-mentioned message matching method are implemented.
[0017] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0018] In an embodiment of the present application, by setting a relevant address block set on the network device side, and binding the ACL rules corresponding to the message protocol that needs to use the source IP address and / or destination IP address for message matching to the relevant address blocks in these address block sets, after receiving the message, the network device can quickly match the source IP address and / or destination IP address of the message based on the relevant address blocks, thereby greatly shortening the message matching time and improving the message processing efficiency.
[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0021] Figure 1 A flowchart of a message matching method provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of an address block set provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of the structure of a message matching device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0025] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0026] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "at the time of" or "when...".
[0027] Next, the embodiments of the present application are described in detail.
[0028] The present application embodiment provides a message matching method, which is applied to a network device, such as Figure 1 As shown, the method may include the following steps:
[0029] S11. Receive message.
[0030] S12: When it is necessary to match any IP address among the source IP address and the destination IP address of the message, determine the first address block corresponding to the IP address in the first address block set corresponding to the message protocol corresponding to the message.
[0031] In this step, the first address block set includes 24 address blocks.
[0032] S13: If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rule is matched one by one.
[0033] S14: If there is no first ACL rule matching the IP address, determine that the matching result of the message is that there is no ACL rule matching the IP address.
[0034] S15. If there is a first ACL rule matching the IP address, determine that the matching result of the message is that there is an ACL rule matching the IP address.
[0035] Furthermore, in the embodiment of the present application, after executing the above step S12, the network device may further perform the following operations:
[0036] The first operation: if the first address block does not have a corresponding first ACL rule, determining that the matching result of the message is that there is no ACL rule matching the IP address.
[0037] Second operation:
[0038] If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is greater than 24, then determining the second address block corresponding to the IP address in the second address block set corresponding to the first address block;
[0039] If the second address block has a corresponding second ACL rule, and the second total number value of the second ACL rule is greater than 24, determining the third address block corresponding to the IP address in the third address block set corresponding to the second address block;
[0040] If the third address block has a corresponding third ACL rule and the third total number value of the third ACL rule is greater than 24, then determine the fourth address block corresponding to the IP address in the fourth address block set corresponding to the third address block;
[0041] If the fourth address block has a corresponding fourth ACL rule and the fourth total number value of the fourth ACL rule is greater than 8, then determine the fifth address block corresponding to the IP address in the fifth address block set corresponding to the fourth address block;
[0042] If the fifth address block has a corresponding fifth ACL rule and the fifth total number value of the fifth ACL rule is greater than 8, then determine the sixth address block corresponding to the IP address in the sixth address block set corresponding to the fifth address block;
[0043] If the sixth address block has a corresponding sixth ACL rule, and the sixth total number value of the sixth ACL rule is greater than 4, then determine the seventh address block corresponding to the IP address in the seventh address block set corresponding to the sixth address block, wherein each address block included in the seventh address block set corresponds to one ACL rule;
[0044] If the IP address does not match the seventh ACL rule corresponding to the seventh address block, determining that the matching result of the message is that there is no ACL rule matching the IP address;
[0045] If the IP address matches the seventh ACL rule, it is determined that the matching result of the message is that there is an ACL rule matching the IP address;
[0046] The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
[0047] It should be noted that, in the embodiment of the present application, for the network device, when there is no corresponding second ACL rule in the second address block, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0048] When the second address block has a corresponding second ACL rule and the second total number value is not greater than 24, each second ACL rule in the second ACL rules is matched one by one based on the IP address; if there is no second ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a second ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0049] When the third address block does not have a corresponding third ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0050] When the third address block has a corresponding third ACL rule and the third total number value is not greater than 24, each third ACL rule in the third ACL rules is matched one by one based on the IP address; if there is no third ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a third ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0051] When the fourth address block does not have a corresponding fourth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0052] When the fourth address block has a corresponding fourth ACL rule and the fourth total number value is not greater than 24, each fourth ACL rule in the fourth ACL rules is matched one by one based on the IP address; if there is no fourth ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a fourth ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0053] When the fifth address block does not have a corresponding fifth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0054] When the fifth address block has a corresponding fifth ACL rule and the fifth total number value is not greater than 24, each fifth ACL rule in the fifth ACL rule is matched one by one based on the IP address; if there is no fifth ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a fifth ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0055] When the sixth address block does not have a corresponding sixth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0056] When the sixth address block has a corresponding sixth ACL rule and the sixth total number value is not greater than 24, each sixth ACL rule in the sixth ACL rules is matched one by one based on the IP address; if there is no sixth ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a sixth ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0057] Furthermore, in the embodiment of the present application, after executing the above step S11, the network device may further perform the following operations:
[0058] When the source IP address and the destination IP address of the message need to be matched, determining an eighth address block corresponding to the source IP address in the first address block set;
[0059] If the eighth address block has a corresponding eighth ACL rule and the eighth total number value of the eighth ACL rule is not greater than 24, then each eighth ACL rule in the eighth ACL rule is matched one by one based on the source IP address;
[0060] If there is no eighth ACL rule matching the source IP address, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address;
[0061] If there is an eighth ACL rule that matches the source IP address, further determine whether the destination IP address matches the eighth ACL rule;
[0062] When the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address;
[0063] When the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0064] In this operation process, for network devices,
[0065] If the eighth address block has a corresponding eighth ACL rule, and the eighth total number value of the eighth ACL rule is greater than 24, then determine the ninth address block corresponding to the source IP address in the second address block set corresponding to the eighth address block;
[0066] If the ninth address block has a corresponding ninth ACL rule, and the ninth total number value of the ninth ACL rule is greater than 24, then determine the tenth address block corresponding to the source IP address in the third address block set corresponding to the ninth address block;
[0067] If the tenth address block has a corresponding tenth ACL rule, and the tenth total number value of the tenth ACL rule is greater than 24, then determine the eleventh address block corresponding to the source IP address in the fourth address block set corresponding to the tenth address block;
[0068] If the eleventh address block has a corresponding eleventh ACL rule, and the eleventh total quantity value of the eleventh ACL rule is greater than 8, then determine the twelfth address block corresponding to the source IP address in the fifth address block set corresponding to the eleventh address block;
[0069] If the twelfth address block has a corresponding twelfth ACL rule, and the twelfth total quantity value of the twelfth ACL rule is greater than 8, then determine the thirteenth address block corresponding to the source IP address in the sixth address block set corresponding to the twelfth address block;
[0070] If the thirteenth address block has a corresponding thirteenth ACL rule, and the thirteenth total quantity value of the thirteenth ACL rule is greater than 4, then in the seventh address block set corresponding to the thirteenth address block, determine the fourteenth address block corresponding to the source IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule;
[0071] If the source IP address does not match the fourteenth ACL rule corresponding to the fourteenth address block, it is determined that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address;
[0072] If the source IP address matches the fourteenth ACL rule, further determine whether the destination IP address matches the fourteenth ACL rule;
[0073] When the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address;
[0074] When the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address;
[0075] The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
[0076] Here, for network devices, you can also perform the following operations:
[0077] When the eighth address block does not have a corresponding eighth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0078] When the ninth address block has a corresponding ninth ACL rule and the ninth total number value is not greater than 24, each ninth ACL rule in the ninth ACL rule is matched one by one based on the source IP address; if there is no ninth ACL rule matching the source IP address, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; if there is a ninth ACL rule matching the source IP address, it is further determined whether the destination IP address matches the ninth ACL rule; when the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule matching the source IP address and the destination IP address; when the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0079] When the tenth address block does not have the corresponding tenth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0080] When the tenth address block has a corresponding tenth ACL rule and the tenth total number value is not greater than 24, each tenth ACL rule in the tenth ACL rule is matched one by one based on the source IP address; if there is no tenth ACL rule matching the source IP address, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; if there is a tenth ACL rule matching the source IP address, it is further determined whether the destination IP address matches the tenth ACL rule; when the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule matching the source IP address and the destination IP address; when the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0081] When the eleventh address block does not have a corresponding eleventh ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0082] When the eleventh address block has a corresponding eleventh ACL rule and the total number value of the eleventh is not greater than 24, each of the eleventh ACL rules in the eleventh ACL rules is matched one by one based on the source IP address; if there is no eleventh ACL rule matching the source IP address, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address; if there is an eleventh ACL rule matching the source IP address, it is further determined whether the destination IP address matches the eleventh ACL rule; when the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule matching the source IP address and the destination IP address; when the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0083] When there is no corresponding twelfth ACL rule for the twelfth address block, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0084] When there is a corresponding twelfth ACL rule for the twelfth address block and the twelfth total number value is not greater than 24, each twelfth ACL rule in the twelfth ACL rule is matched one by one based on the source IP address; if there is no twelfth ACL rule matching the source IP address, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; if there is a twelfth ACL rule matching the source IP address, it is further determined whether the destination IP address matches the twelfth ACL rule; when the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule matching the source IP address and the destination IP address; when the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0085] When the thirteenth address block does not have a corresponding thirteenth ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0086] When the thirteenth address block has a corresponding thirteenth ACL rule and the thirteenth total number value is not greater than 24, each of the thirteenth ACL rules in the thirteenth ACL rules is matched one by one based on the source IP address; if there is no thirteenth ACL rule that matches the source IP address, it is determined that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address; if there is a thirteenth ACL rule that matches the source IP address, it is further determined whether the destination IP address matches the thirteenth ACL rule; when the judgment result is yes, it is determined that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address; when the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address.
[0087] It should be noted that, in the embodiment of the present application, the network device may also perform the following operations:
[0088] After power-on, four groups of decimal numbers corresponding to the preset IP addresses are divided into two groups to obtain a first address block set, wherein the first address block set includes 24 address blocks;
[0089] For each address block in the first address block set, perform binary division on the address block to obtain a second address block set corresponding to the address block;
[0090] For each address block in the second address block set, perform binary division on the address block to obtain a third address block set corresponding to the address block;
[0091] For each address block in the third address block set, perform binary division on the address block to obtain a fourth address block set corresponding to the address block;
[0092] For each address block in the fourth address block set, perform binary division on the address block to obtain a fifth address block set corresponding to the address block;
[0093] For each address block in the fifth address block set, perform binary division on the address block to obtain a sixth address block set corresponding to the address block;
[0094] For each address block in the sixth address block set, perform binary division on the address block to obtain a seventh address block set corresponding to the address block;
[0095] If there are multiple first target ACL rules that need to match the source IP address of the message or need to match the source IP address and the destination IP address of the message in the ACL rules corresponding to the message protocol, then for each first target ACL rule, bind the first target ACL rule to the first target address block to which the target source IP address corresponding to the first target ACL rule belongs in the first address block set, the second target address block to which the target source IP address belongs in the second address block set corresponding to the first target address block, the third target address block to which the target source IP address belongs in the third address block set corresponding to the second target address block, the fourth target address block to which the target source IP address belongs in the fourth address block set corresponding to the third target address block, the fifth target address block to which the target source IP address belongs in the fifth address block set corresponding to the fourth target address block, the sixth target address block to which the target source IP address belongs in the sixth address block set corresponding to the fifth target address block, and the seventh address block to which the target source IP address belongs in the seventh address block set corresponding to the sixth target address block;
[0096] If there are multiple second target ACL rules that need to match the destination IP address of the message in the ACL rules corresponding to the message protocol, then for each second target ACL rule, the second target ACL rule is bound to the eighth target address block to which the target destination IP address corresponding to the second target ACL rule in the first address block set belongs, the ninth target address block to which the target destination IP address in the second address block set corresponding to the eighth target address block belongs, the tenth target address block to which the target destination IP address in the third address block set corresponding to the ninth target address block belongs, the eleventh target address block to which the target destination IP address in the fourth address block set corresponding to the tenth target address block belongs, the twelfth target address block to which the target destination IP address in the fifth address block set corresponding to the eleventh target address block belongs, the thirteenth target address block to which the target destination IP address in the sixth address block set corresponding to the twelfth target address block belongs, and the fourteenth address block to which the target destination IP address in the seventh address block set corresponding to the thirteenth target address block belongs.
[0097] In this operation process, when the network device performs binary division on the four groups of decimal numbers corresponding to the preset IP address, the binary division starts from the last group of decimal numbers corresponding to the preset IP address, and the binary division is performed in sequence forward.
[0098] For any address block in any of the second address block set, the third address block set, the fourth address block set, the fifth address block set and the sixth address block set, the network device obtains 24 new address blocks after performing binary division on the address block.
[0099] Here, the preset IP address can be 255.255.255.255.
[0100] It should be noted that in an embodiment of the present application, after the first address block set, the second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set are divided on the network device side, no matter which message protocol needs to use the source IP address and / or the destination IP address for message matching, the above-mentioned operation process can be used to bind the relevant address block to each ACL rule corresponding to the corresponding message protocol.
[0101] For any message protocol that needs to use the source IP address and / or destination IP address for message matching, no matter how many ACL rules it corresponds to, the maximum number of message matches is 24 (the maximum number of times to search for the address block to which the IP address belongs in an address block set) * 7 times, which greatly shortens the message matching time and thus improves the message processing efficiency.
[0102] Furthermore, during the operation of the network device, if a new message protocol is added that requires the use of source IP addresses and / or destination IP addresses for message matching, the network device can also use the above operation process to bind the relevant address block to the newly added ACL.
[0103] It should be further explained that, in the embodiment of the present application, for the network device, when determining the matching result of the above message, the corresponding relationship between the source IP address and the ACL rule that matches the above message can also be recorded, and the aging time of the corresponding relationship can also be set. In this way, when the network device receives the message with the source IP address again, if the source IP address is found in the corresponding relationship between the IP address and the ACL rule recorded locally, it is directly determined that the matching result of the message is that there is an ACL rule that matches the source IP address; if the source IP address is not found in the corresponding relationship between the IP address and the ACL rule recorded locally (because it is aged out due to reaching the aging time), it is determined that the source IP address of the message needs to be matched.
[0104] The above message matching method is described in detail below in conjunction with specific embodiments.
[0105] Assume that 200 ACL rules corresponding to the IP protocol are configured on the network device 1 side in a certain network, and the IP protocol needs to match the source IP address of the message.
[0106] After network device 1 is powered on, the four groups of decimal numbers corresponding to 255.255.255.255 are divided into two groups to obtain address block set 1.
[0107] For example, address block set 1 includes 24 address blocks, including address block 1 (e.g., 255.255.255.0-255.255.255.128), address block 2 (255.255.255.128-255.255.255.255), address block 3 (255.255.128.0-255.255.128.128), and address block 4 (255.255.128.128-255.255.128.255).
[0108] For each address block in the address set 1, the network device 1 performs binary division on the address block to obtain the address block set 2 corresponding to the address block.
[0109] For each address block in the address block set 2, the network device 1 performs binary division on the address block to obtain the address block set 3 corresponding to the address block.
[0110] For each address block in the address block set 3, the network device 1 performs binary division on the address block to obtain an address block set 4 corresponding to the address block;
[0111] For each address block in the address block set 4, the network device 1 performs binary division on the address block to obtain an address block set 5 corresponding to the address block;
[0112] For each address block in the address block set 5, the network device 1 performs binary division on the address block to obtain an address block set 6 corresponding to the address block;
[0113] For each address block in the address block set 6, the network device 1 performs binary division on the address block to obtain the address block set 7 corresponding to the address block.
[0114] Furthermore, for each of the 200 ACL rules, the network device 1 binds the ACL rule to the address block to which the source IP address corresponding to the ACL rule belongs in address block set 1 (for example, address block a), the address block to which the source IP address belongs in address block set 2 corresponding to address block a (for example, address block a1), the address block to which the source IP address belongs in address block set 3 corresponding to address block a1 (for example, address block a2), the address block to which the source IP address belongs in address block set 4 corresponding to address block a2 (for example, address block a3), the address block to which the source IP address belongs in address block set 5 corresponding to address block a3 (for example, address block a4), the address block to which the source IP address belongs in address block set 6 corresponding to address block a4 (for example, address block a5), and the address block to which the source IP address belongs in address block set 7 corresponding to address block a5 (for example, address block a6).
[0115] Assume that at a certain moment, network device 1 receives message 1 of the IP protocol. At this time, network device 1 determines the address block corresponding to the source IP address of message 1 in address block set 1.
[0116] Assume that the determined address block is address block 11, and assume that address block 1 has a corresponding ACL rule, and the total number of corresponding ACL rules is greater than 24. In this case, network device 1 determines the address block corresponding to the source IP address in address block set 2 corresponding to address block 1.
[0117] Assuming that the address block determined this time is address block 12 and address block 12 has a corresponding ACL rule, and assuming that the total number of corresponding ACL rules is less than 24, then network device 1 matches each ACL rule in the ACL rules corresponding to the address block determined this time one by one based on the source IP address, such as Figure 2 shown.
[0118] Assuming that there is an ACL rule that matches the source IP address, the network device 1 determines that the matching result of the message 1 is that there is an ACL rule that matches the source IP address. Subsequently, the network device 1 continues to process the message 1 in the existing manner.
[0119] It can be seen from the above technical solution that in an embodiment of the present application, by setting a relevant address block set on the network device side, and binding the ACL rules corresponding to the message protocol that needs to use the source IP address and / or destination IP address for message matching to the relevant address blocks in these address block sets, after receiving the message, the network device can quickly match the source IP address and / or destination IP address of the message based on the relevant address blocks, thereby greatly shortening the time consumed in message matching and thereby improving the message processing efficiency.
[0120] Based on the same inventive concept, the present application also provides a message matching device, which is applied to a network device, and its structural diagram is as follows: Figure 3 As shown, it specifically includes a receiving module 31 and a matching module 32, wherein:
[0121] A receiving module 31, used for receiving a message;
[0122] A matching module 32, configured to determine, when it is necessary to match any one of the source IP address and the destination IP address of the message, a first address block corresponding to the IP address in a first address block set corresponding to a message protocol corresponding to the message, wherein the first address block set includes 24 address blocks;
[0123] If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rules is matched one by one; if there is no first ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a first ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
[0124] Preferably, the matching module 32 is further used for:
[0125] If the first address block does not have a corresponding first ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
[0126] Preferably, the matching module 32 is further used for:
[0127] If the first address block has a corresponding first ACL rule, and the first total number value of the first ACL rule is greater than 24, determining the second address block corresponding to the IP address in the second address block set corresponding to the first address block;
[0128] If the second address block has a corresponding second ACL rule, and the second total number value of the second ACL rule is greater than 24, determining the third address block corresponding to the IP address in the third address block set corresponding to the second address block;
[0129] If the third address block has a corresponding third ACL rule and the third total number value of the third ACL rule is greater than 24, then determining the fourth address block corresponding to the IP address in the fourth address block set corresponding to the third address block;
[0130] If the fourth address block has a corresponding fourth ACL rule and the fourth total number value of the fourth ACL rule is greater than 8, determining the fifth address block corresponding to the IP address in the fifth address block set corresponding to the fourth address block;
[0131] If the fifth address block has a corresponding fifth ACL rule and the fifth total number value of the fifth ACL rule is greater than 8, then determine the sixth address block corresponding to the IP address in the sixth address block set corresponding to the fifth address block;
[0132] If the sixth address block has a corresponding sixth ACL rule, and the sixth total number value of the sixth ACL rule is greater than 4, then in a seventh address block set corresponding to the sixth address block, determine the seventh address block corresponding to the IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule;
[0133] If the IP address does not match the seventh ACL rule corresponding to the seventh address block, determining that the matching result of the message is that there is no ACL rule matching the IP address;
[0134] If the IP address matches the seventh ACL rule, determining that the matching result of the message is that there is an ACL rule matching the IP address;
[0135] The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
[0136] Preferably, the matching module 32 is further used for:
[0137] When it is necessary to match the source IP address and the destination IP address of the message, determining an eighth address block corresponding to the source IP address in the first address block set;
[0138] If the eighth address block has a corresponding eighth ACL rule and the eighth total number value of the eighth ACL rule is not greater than 24, then matching each eighth ACL rule in the eighth ACL rule one by one based on the source IP address;
[0139] If there is no eighth ACL rule matching the source IP address, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address;
[0140] If there is an eighth ACL rule matching the source IP address, further determining whether the destination IP address matches the eighth ACL rule;
[0141] When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address;
[0142] When the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
[0143] Preferably, the matching module 32 is further used for:
[0144] If the eighth address block has a corresponding eighth ACL rule and the eighth total quantity value of the eighth ACL rule is greater than 24, then determining a ninth address block corresponding to the source IP address in the second address block set corresponding to the eighth address block;
[0145] If the ninth address block has a corresponding ninth ACL rule and the ninth total number value of the ninth ACL rule is greater than 24, then determining the tenth address block corresponding to the source IP address in the third address block set corresponding to the ninth address block;
[0146] If the tenth address block has a corresponding tenth ACL rule, and the tenth total quantity value of the tenth ACL rule is greater than 24, then determining the eleventh address block corresponding to the source IP address in the fourth address block set corresponding to the tenth address block;
[0147] If the eleventh address block has a corresponding eleventh ACL rule, and the eleventh total quantity value of the eleventh ACL rule is greater than 8, determining the twelfth address block corresponding to the source IP address in the fifth address block set corresponding to the eleventh address block;
[0148] If the twelfth address block has a corresponding twelfth ACL rule, and the twelfth total quantity value of the twelfth ACL rule is greater than 8, determining the thirteenth address block corresponding to the source IP address in the sixth address block set corresponding to the twelfth address block;
[0149] If the thirteenth address block has a corresponding thirteenth ACL rule, and the thirteenth total quantity value of the thirteenth ACL rule is greater than 4, then in the seventh address block set corresponding to the thirteenth address block, determine the fourteenth address block corresponding to the source IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule;
[0150] If the source IP address does not match the fourteenth ACL rule corresponding to the fourteenth address block, determining that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address;
[0151] If the source IP address matches the fourteenth ACL rule, further determining whether the destination IP address matches the fourteenth ACL rule;
[0152] When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address;
[0153] When the judgment result is no, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address;
[0154] The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
[0155] Preferably, the device further comprises:
[0156] Divide the binding module ( Figure 3 ), which is used to perform binary division on the four groups of decimal numbers corresponding to the preset IP addresses after power-on to obtain the first address block set, wherein the first address block set includes 24 address blocks;
[0157] For each address block in the first address block set, perform binary division on the address block to obtain a second address block set corresponding to the address block;
[0158] For each address block in the second address block set, perform binary division on the address block to obtain a third address block set corresponding to the address block;
[0159] For each address block in the third address block set, perform binary division on the address block to obtain a fourth address block set corresponding to the address block;
[0160] For each address block in the fourth address block set, perform binary division on the address block to obtain a fifth address block set corresponding to the address block;
[0161] For each address block in the fifth address block set, perform binary division on the address block to obtain a sixth address block set corresponding to the address block;
[0162] For each address block in the sixth address block set, perform binary division on the address block to obtain a seventh address block set corresponding to the address block;
[0163] If there are multiple first target ACL rules that need to match the source IP address of the message or need to match the source IP address and the destination IP address of the message in the ACL rule corresponding to the message protocol, then for each first target ACL rule, bind the first target ACL rule to the first target address block to which the target source IP address corresponding to the first target ACL rule belongs in the first address block set, the second target address block to which the target source IP address belongs in the second address block set corresponding to the first target address block, the third target address block to which the target source IP address belongs in the third address block set corresponding to the second target address block, the fourth target address block to which the target source IP address belongs in the fourth address block set corresponding to the third target address block, the fifth target address block to which the target source IP address belongs in the fifth address block set corresponding to the fourth target address block, the sixth target address block to which the target source IP address belongs in the sixth address block set corresponding to the fifth target address block, and the seventh address block to which the target source IP address belongs in the seventh address block set corresponding to the sixth target address block;
[0164] If there are multiple second target ACL rules that need to match the destination IP address of the message in the ACL rules corresponding to the message protocol, for each second target ACL rule, the second target ACL rule is bound to the eighth target address block to which the target destination IP address corresponding to the second target ACL rule in the first address block set belongs, the ninth target address block to which the target destination IP address in the second address block set corresponding to the eighth target address block belongs, the tenth target address block to which the target destination IP address in the third address block set corresponding to the ninth target address block belongs, the eleventh target address block to which the target destination IP address in the fourth address block set corresponding to the tenth target address block belongs, the twelfth target address block to which the target destination IP address in the fifth address block set corresponding to the eleventh target address block belongs, the thirteenth target address block to which the target destination IP address in the sixth address block set corresponding to the twelfth target address block belongs, and the fourteenth address block to which the target destination IP address in the seventh address block set corresponding to the thirteenth target address block belongs.
[0165] It can be seen from the above technical solution that in an embodiment of the present application, by setting a relevant address block set on the network device side, and binding the ACL rules corresponding to the message protocol that needs to use the source IP address and / or destination IP address for message matching to the relevant address blocks in these address block sets, after receiving the message, the network device can quickly match the source IP address and / or destination IP address of the message based on the relevant address blocks, thereby greatly shortening the time consumed in message matching and thereby improving the message processing efficiency.
[0166] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A message matching method, characterized in that: The method is applied to a network device, and the method comprises: Receive messages; When it is necessary to match any IP address of the source IP address and the destination IP address of the message, determine a first address block corresponding to the IP address in a first address block set corresponding to a message protocol corresponding to the message, wherein the first address block set includes 24 address blocks; If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rule is matched one by one; If there is no first ACL rule matching the IP address, determining that the matching result of the message is that there is no ACL rule matching the IP address; If there is a first ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
2. The method according to claim 1, characterized in that The method further comprises: If the first address block does not have a corresponding first ACL rule, it is determined that the matching result of the message is that there is no ACL rule matching the IP address.
3. The method according to claim 1, characterized in that The method further comprises: If the first address block has a corresponding first ACL rule, and the first total number value of the first ACL rule is greater than 24, determining the second address block corresponding to the IP address in the second address block set corresponding to the first address block; If the second address block has a corresponding second ACL rule, and the second total number value of the second ACL rule is greater than 24, determining the third address block corresponding to the IP address in the third address block set corresponding to the second address block; If the third address block has a corresponding third ACL rule, and the third total number value of the third ACL rule is greater than 24, then determining the fourth address block corresponding to the IP address in the fourth address block set corresponding to the third address block; If the fourth address block has a corresponding fourth ACL rule and the fourth total number value of the fourth ACL rule is greater than 8, then determining the fifth address block corresponding to the IP address in the fifth address block set corresponding to the fourth address block; If the fifth address block has a corresponding fifth ACL rule and the fifth total number value of the fifth ACL rule is greater than 8, then determine the sixth address block corresponding to the IP address in the sixth address block set corresponding to the fifth address block; If the sixth address block has a corresponding sixth ACL rule, and the sixth total number value of the sixth ACL rule is greater than 4, then in a seventh address block set corresponding to the sixth address block, determine the seventh address block corresponding to the IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule; If the IP address does not match the seventh ACL rule corresponding to the seventh address block, determining that the matching result of the message is that there is no ACL rule matching the IP address; If the IP address matches the seventh ACL rule, determining that the matching result of the message is that there is an ACL rule matching the IP address; The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
4. The method according to claim 1, characterized in that: The method further comprises: When it is necessary to match the source IP address and the destination IP address of the message, determining an eighth address block corresponding to the source IP address in the first address block set; If the eighth address block has a corresponding eighth ACL rule and the eighth total number value of the eighth ACL rule is not greater than 24, then matching each eighth ACL rule in the eighth ACL rule one by one based on the source IP address; If there is no eighth ACL rule matching the source IP address, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; If there is an eighth ACL rule matching the source IP address, further determining whether the destination IP address matches the eighth ACL rule; When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address; When the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
5. The method according to claim 4, characterized in that The method further comprises: If the eighth address block has a corresponding eighth ACL rule and the eighth total quantity value of the eighth ACL rule is greater than 24, then determining a ninth address block corresponding to the source IP address in the second address block set corresponding to the eighth address block; If the ninth address block has a corresponding ninth ACL rule and the ninth total number value of the ninth ACL rule is greater than 24, then determining the tenth address block corresponding to the source IP address in the third address block set corresponding to the ninth address block; If the tenth address block has a corresponding tenth ACL rule, and the tenth total quantity value of the tenth ACL rule is greater than 24, then determining the eleventh address block corresponding to the source IP address in the fourth address block set corresponding to the tenth address block; If the eleventh address block has a corresponding eleventh ACL rule, and the eleventh total quantity value of the eleventh ACL rule is greater than 8, determining the twelfth address block corresponding to the source IP address in the fifth address block set corresponding to the eleventh address block; If the twelfth address block has a corresponding twelfth ACL rule, and the twelfth total quantity value of the twelfth ACL rule is greater than 8, determining the thirteenth address block corresponding to the source IP address in the sixth address block set corresponding to the twelfth address block; If the thirteenth address block has a corresponding thirteenth ACL rule, and the thirteenth total quantity value of the thirteenth ACL rule is greater than 4, then in the seventh address block set corresponding to the thirteenth address block, determine the fourteenth address block corresponding to the source IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule; If the source IP address does not match the fourteenth ACL rule corresponding to the fourteenth address block, determining that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address; If the source IP address matches the fourteenth ACL rule, further determining whether the destination IP address matches the fourteenth ACL rule; When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address; When the judgment result is no, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
6. The method according to claim 5, characterized in that The method further comprises: After power-on, four groups of decimal numbers corresponding to the preset IP addresses are divided into two groups to obtain the first address block set, wherein the first address block set includes 24 address blocks; For each address block in the first address block set, perform binary division on the address block to obtain a second address block set corresponding to the address block; For each address block in the second address block set, perform binary division on the address block to obtain a third address block set corresponding to the address block; For each address block in the third address block set, perform binary division on the address block to obtain a fourth address block set corresponding to the address block; For each address block in the fourth address block set, perform binary division on the address block to obtain a fifth address block set corresponding to the address block; For each address block in the fifth address block set, perform binary division on the address block to obtain a sixth address block set corresponding to the address block; For each address block in the sixth address block set, perform binary division on the address block to obtain a seventh address block set corresponding to the address block; If there are multiple first target ACL rules that need to match the source IP address of the message or need to match the source IP address and the destination IP address of the message in the ACL rule corresponding to the message protocol, then for each first target ACL rule, bind the first target ACL rule to the first target address block to which the target source IP address corresponding to the first target ACL rule belongs in the first address block set, the second target address block to which the target source IP address belongs in the second address block set corresponding to the first target address block, the third target address block to which the target source IP address belongs in the third address block set corresponding to the second target address block, the fourth target address block to which the target source IP address belongs in the fourth address block set corresponding to the third target address block, the fifth target address block to which the target source IP address belongs in the fifth address block set corresponding to the fourth target address block, the sixth target address block to which the target source IP address belongs in the sixth address block set corresponding to the fifth target address block, and the seventh address block to which the target source IP address belongs in the seventh address block set corresponding to the sixth target address block; If there are multiple second target ACL rules that need to match the destination IP address of the message in the ACL rules corresponding to the message protocol, for each second target ACL rule, the second target ACL rule is bound to the eighth target address block to which the target destination IP address corresponding to the second target ACL rule in the first address block set belongs, the ninth target address block to which the target destination IP address in the second address block set corresponding to the eighth target address block belongs, the tenth target address block to which the target destination IP address in the third address block set corresponding to the ninth target address block belongs, the eleventh target address block to which the target destination IP address in the fourth address block set corresponding to the tenth target address block belongs, the twelfth target address block to which the target destination IP address in the fifth address block set corresponding to the eleventh target address block belongs, the thirteenth target address block to which the target destination IP address in the sixth address block set corresponding to the twelfth target address block belongs, and the fourteenth address block to which the target destination IP address in the seventh address block set corresponding to the thirteenth target address block belongs.
7. A message matching device, characterized in that: The device is applied to a network device, and the device comprises: A receiving module, used for receiving messages; a matching module, configured to, when it is necessary to match any one of the source IP address and the destination IP address of the message, determine a first address block corresponding to the IP address in a first address block set corresponding to a message protocol corresponding to the message, wherein the first address block set includes 24 address blocks; and If the first address block has a corresponding first ACL rule and the first total number value of the first ACL rule is not greater than 24, then based on the IP address, each first ACL rule in the first ACL rules is matched one by one; if there is no first ACL rule matching the IP address, it is determined that the matching result of the message is that there is no ACL rule matching the IP address; if there is a first ACL rule matching the IP address, it is determined that the matching result of the message is that there is an ACL rule matching the IP address.
8. The device according to claim 7, characterized in that The matching module is further used for: If the first address block has a corresponding first ACL rule, and the first total number value of the first ACL rule is greater than 24, determining the second address block corresponding to the IP address in the second address block set corresponding to the first address block; If the second address block has a corresponding second ACL rule, and the second total number value of the second ACL rule is greater than 24, determining the third address block corresponding to the IP address in the third address block set corresponding to the second address block; If the third address block has a corresponding third ACL rule, and the third total number value of the third ACL rule is greater than 24, then determining the fourth address block corresponding to the IP address in the fourth address block set corresponding to the third address block; If the fourth address block has a corresponding fourth ACL rule and the fourth total number value of the fourth ACL rule is greater than 8, then determining the fifth address block corresponding to the IP address in the fifth address block set corresponding to the fourth address block; If the fifth address block has a corresponding fifth ACL rule and the fifth total number value of the fifth ACL rule is greater than 8, then determine the sixth address block corresponding to the IP address in the sixth address block set corresponding to the fifth address block; If the sixth address block has a corresponding sixth ACL rule, and the sixth total number value of the sixth ACL rule is greater than 4, then in a seventh address block set corresponding to the sixth address block, determine the seventh address block corresponding to the IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule; If the IP address does not match the seventh ACL rule corresponding to the seventh address block, determining that the matching result of the message is that there is no ACL rule matching the IP address; If the IP address matches the seventh ACL rule, determining that the matching result of the message is that there is an ACL rule matching the IP address; The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
9. The device according to claim 7, characterized in that The matching module is further used for: When it is necessary to match the source IP address and the destination IP address of the message, determining an eighth address block corresponding to the source IP address in the first address block set; If the eighth address block has a corresponding eighth ACL rule and the eighth total number value of the eighth ACL rule is not greater than 24, then matching each eighth ACL rule in the eighth ACL rule one by one based on the source IP address; If there is no eighth ACL rule matching the source IP address, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; If there is an eighth ACL rule matching the source IP address, further determining whether the destination IP address matches the eighth ACL rule; When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address; When the judgment result is no, it is determined that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address.
10. The device according to claim 9, characterized in that The matching module is further used for: If the eighth address block has a corresponding eighth ACL rule and the eighth total quantity value of the eighth ACL rule is greater than 24, then determining a ninth address block corresponding to the source IP address in the second address block set corresponding to the eighth address block; If the ninth address block has a corresponding ninth ACL rule and the ninth total number value of the ninth ACL rule is greater than 24, then determining the tenth address block corresponding to the source IP address in the third address block set corresponding to the ninth address block; If the tenth address block has a corresponding tenth ACL rule, and the tenth total quantity value of the tenth ACL rule is greater than 24, then determining the eleventh address block corresponding to the source IP address in the fourth address block set corresponding to the tenth address block; If the eleventh address block has a corresponding eleventh ACL rule, and the eleventh total quantity value of the eleventh ACL rule is greater than 8, determining the twelfth address block corresponding to the source IP address in the fifth address block set corresponding to the eleventh address block; If the twelfth address block has a corresponding twelfth ACL rule, and the twelfth total quantity value of the twelfth ACL rule is greater than 8, determining the thirteenth address block corresponding to the source IP address in the sixth address block set corresponding to the twelfth address block; If the thirteenth address block has a corresponding thirteenth ACL rule, and the thirteenth total quantity value of the thirteenth ACL rule is greater than 4, then in the seventh address block set corresponding to the thirteenth address block, determine the fourteenth address block corresponding to the source IP address, wherein each address block included in the seventh address block set corresponds to one ACL rule; If the source IP address does not match the fourteenth ACL rule corresponding to the fourteenth address block, determining that the matching result of the message is that there is no ACL rule that matches the source IP address and the destination IP address; If the source IP address matches the fourteenth ACL rule, further determining whether the destination IP address matches the fourteenth ACL rule; When the judgment result is yes, determining that the matching result of the message is that there is an ACL rule that matches the source IP address and the destination IP address; When the judgment result is no, determining that the matching result of the message is that there is no ACL rule matching the source IP address and the destination IP address; The second address block set, the third address block set, the fourth address block set, the fifth address block set, the sixth address block set and the seventh address block set each include 24 address blocks.
11. The device according to claim 10, characterized in that The device also includes: A partitioning and binding module, used for performing binary partitioning on four groups of decimal numbers corresponding to the preset IP addresses after power-on to obtain the first address block set, wherein the first address block set includes 24 address blocks; For each address block in the first address block set, perform binary division on the address block to obtain a second address block set corresponding to the address block; For each address block in the second address block set, perform binary division on the address block to obtain a third address block set corresponding to the address block; For each address block in the third address block set, perform binary division on the address block to obtain a fourth address block set corresponding to the address block; For each address block in the fourth address block set, perform binary division on the address block to obtain a fifth address block set corresponding to the address block; For each address block in the fifth address block set, perform binary division on the address block to obtain a sixth address block set corresponding to the address block; For each address block in the sixth address block set, perform binary division on the address block to obtain a seventh address block set corresponding to the address block; If there are multiple first target ACL rules that need to match the source IP address of the message or need to match the source IP address and the destination IP address of the message in the ACL rule corresponding to the message protocol, then for each first target ACL rule, bind the first target ACL rule to the first target address block to which the target source IP address corresponding to the first target ACL rule belongs in the first address block set, the second target address block to which the target source IP address belongs in the second address block set corresponding to the first target address block, the third target address block to which the target source IP address belongs in the third address block set corresponding to the second target address block, the fourth target address block to which the target source IP address belongs in the fourth address block set corresponding to the third target address block, the fifth target address block to which the target source IP address belongs in the fifth address block set corresponding to the fourth target address block, the sixth target address block to which the target source IP address belongs in the sixth address block set corresponding to the fifth target address block, and the seventh address block to which the target source IP address belongs in the seventh address block set corresponding to the sixth target address block; If there are multiple second target ACL rules that need to match the destination IP address of the message in the ACL rules corresponding to the message protocol, for each second target ACL rule, the second target ACL rule is bound to the eighth target address block to which the target destination IP address corresponding to the second target ACL rule in the first address block set belongs, the ninth target address block to which the target destination IP address in the second address block set corresponding to the eighth target address block belongs, the tenth target address block to which the target destination IP address in the third address block set corresponding to the ninth target address block belongs, the eleventh target address block to which the target destination IP address in the fourth address block set corresponding to the tenth target address block belongs, the twelfth target address block to which the target destination IP address in the fifth address block set corresponding to the eleventh target address block belongs, the thirteenth target address block to which the target destination IP address in the sixth address block set corresponding to the twelfth target address block belongs, and the fourteenth address block to which the target destination IP address in the seventh address block set corresponding to the thirteenth target address block belongs.
12. An electronic device, characterized in that: The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps described in any one of claims 1 to 6.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method for service matching of messages by means of access control list (ACL)
CN103220287A
Message matching method and device based on lookup tree and electronic equipment
CN112804206A
Message filtering method and device
CN115834233A
ACL rule-based access control method and device, and storage medium
CN117527428A
Centralized Management and Distributed Enforcement of Policies for Network Segmentation
US20210352013A1
