Packet statistics method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202311629071.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-11-30
AI Technical Summary
比如对于某些芯片来说,入方向ACL和出方向ACL都可以匹配报文的VNI(网络标识符)字段,对于另外一些芯片来说,入方向ACL可以匹配报文的VNI字段,但是出方向ACL没办法匹配报文的VNI字段
[0035]本发明提供的一种报文统计方法、装置、电子设备及存储介质,通过将芯片下发的入方向ACL匹配报文VNI并给报文添加metadata,出方向ACL匹配指定metadata的报文执行动作构建链表,并将要查询的VNI字段在链表中每个结构体存储信息上的VNI字段进行匹配,将匹配成功的数目作为对指定设备发送的报文的出方向ACL的统计数目,以达到在某些芯片不支持出方向ACL匹配VNI字段,也能够实现报文统计的目的。
Smart Images

Figure CN117880119B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a message processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Computer devices (such as routers) use chips to build ACLs that support matching many fields in both inbound and outbound directions. However, the matching capability of these fields differs between inbound and outbound ACLs. Even within the same direction, the support capability varies between different chips. For example, some chips can match the VNI (Network Identifier) field of packets in both inbound and outbound directions, while others can only match the VNI field in the outbound direction. If a user wants to count packets with a specific VNI originating from a port, they would issue an outbound ACL to match and count the packets' VNI fields. Because some chips do not support matching this VNI field in outbound ACLs, the chip will return an error indicating that it is not supported, thus preventing the desired functionality from being achieved. Summary of the Invention
[0003] To address the problems existing in the prior art, the present invention provides a message processing method, apparatus, electronic device, and storage medium.
[0004] This invention provides a message processing method, comprising:
[0005] Obtain a statistical request for the outbound ACL of the message sent by the receiving device. The statistical request includes a VNI field, which represents the unique identifier of the receiving device.
[0006] The VNI field is matched against the VNI field in the structure storage information of each structure in the linked list, and the number of successful matches is used as the statistical number of outbound ACLs for the packets sent to the specified device.
[0007] The structure storage information in the linked list includes:
[0008] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0009] In one embodiment, the method further includes:
[0010] Obtain the outgoing ACL number that the sending device plans to delete;
[0011] Traverse the linked list, determine the structure storage information to be deleted in the linked list based on the outgoing ACL number to be deleted, delete the ACL corresponding to the structure storage information to be deleted, and delete the structure storage information to be deleted in the linked list;
[0012] If the structure storage information to be deleted has a tail identifier, then based on the sequence number of each structure storage information in the linked list, the tail identifier is added to the structure storage information preceding the structure storage information to be deleted.
[0013] In one embodiment, the method further includes a processing step of constructing the linked list, comprising:
[0014] Obtain the newly added ACL issued by the sending device, determine that the newly added ACL is an outbound ACL and matches the packet VNI, and construct a structure corresponding to the newly added ACL to store information;
[0015] When it is determined that the newly added ACL is the first ACL, the structure storage information corresponding to the newly added ACL is used as the head information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
[0016] If it is determined that the newly added ACL is not the first ACL, the structure storage information corresponding to the newly added ACL is placed at the tail of the existing linked list as the tail information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
[0017] In one embodiment, the construction of the structure storage information corresponding to the newly added ACL includes:
[0018] Record the VNI, and the chip of the sending device creates an inbound ACL for generating metadata for the VNI message, and records the inbound ACL number for generating metadata into the structure storage information.
[0019] The chip of the transmitting device creates an outgoing ACL that matches the metadata and records the outgoing ACL number that matches the metadata into the structure storage information.
[0020] In one embodiment, the tail identifier is represented by the next_user_entry field. Setting the next_user_entry field to 0 indicates that the corresponding structure stores the tail information of the linked list.
[0021] In one embodiment, deleting the ACL corresponding to the structure storage information to be deleted includes:
[0022] Based on the outbound ACL number to be deleted, obtain the inbound ACL number for generating metadata for the VNI message and the outbound ACL number matching the metadata from the storage information of the structure to be deleted.
[0023] Based on the inbound ACL number that generates metadata for VNI messages and the outbound ACL number that matches the metadata, delete the inbound ACL corresponding to the inbound ACL number that generates the metadata, and delete the outbound ACL that matches the outbound ACL number of the metadata in the database.
[0024] Accordingly, the method further includes:
[0025] The deleted ACLs are stored in the cache, and the storage information of the structures to be deleted is stored in the auxiliary linked list as the storage information of the structures to be recovered.
[0026] The deletion duration is determined based on the deletion time. When the deletion duration is less than the preset recovery duration, upon receiving a recovery signal, the deleted ACL is restored to the database, and the structure storage information to be recovered is restored to its original position in the linked list based on the structure storage information to be recovered in the auxiliary linked list.
[0027] The present invention also provides a message statistics device, comprising:
[0028] The acquisition module is used to acquire a statistical request for the outgoing ACL of the message sent by the receiving device. The statistical request includes a VNI field, which represents the unique identifier of the receiving device.
[0029] The statistics module is used to match the VNI field in the VNI field of each structure stored in the linked list, and use the number of successful matches as the statistical number of outgoing ACLs for the packets sent to the specified device.
[0030] The structure storage information in the linked list includes:
[0031] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0032] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the message statistics method described above.
[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the message statistics method described above.
[0034] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the message processing method described above.
[0035] This invention provides a message statistics method, apparatus, electronic device, and storage medium. By matching the inbound ACL issued by the chip with the message VNI and adding metadata to the message, and matching the outbound ACL with the specified metadata of the message, a linked list is constructed. The VNI field to be queried is matched with the VNI field stored in the information of each structure in the linked list. The number of successful matches is used as the statistical number of outbound ACLs for messages sent by the specified device. This achieves the purpose of message statistics even in some chips that do not support outbound ACL matching with the VNI field. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0037] Figure 1 This is a flowchart illustrating the message statistics method provided by the present invention;
[0038] Figure 2 This is a schematic diagram illustrating the specific process of message statistics and deletion provided by the present invention;
[0039] Figure 3 This is a schematic diagram of the message statistics device provided by the present invention;
[0040] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0042] The following is combined with Figures 1-4 This invention describes a message processing method, apparatus, electronic device, and storage medium.
[0043] Figure 1 A flowchart illustrating a message processing method provided by the present invention is shown below. Figure 1 The method includes:
[0044] 11. Obtain the statistics request for the outgoing ACL of the message sent by the receiving device. The statistics request includes the VNI field, which represents the unique identifier of the receiving device.
[0045] 12. Match the VNI field in each structure stored in the linked list, and use the number of successful matches as the statistical count of the outbound ACL for the message sent to the specified device; wherein, the structure stored in the linked list includes: the outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0046] It should be noted that Access Control Lists (ACLs) are a commonly used function of switches. They can control various behaviors of packets and play a very important role in the packet processing pipeline of switching chips.
[0047] A switching chip has multiple components, including an inbound processing module, an outbound processing module, and a switching module. ACLs are classified into different sub-ACL types based on the module they function on, including inbound ACLs and outbound ACLs. Inbound and outbound ACL resources are not interchangeable; the fields that can be matched, the actions that can be issued, and the number of ACLs that can be issued are all different.
[0048] Computer devices (such as routers) use chips to build ACLs that support matching many fields in both inbound and outbound directions. However, the matching capability of these fields differs between inbound and outbound ACLs. Even within the same direction, the support capability varies between different chips. For example, some chips can match the VNI (Network Identifier) field of packets in both inbound and outbound directions, while others can only match the VNI field in the outbound direction. If a user wants to count packets with a specific VNI originating from a port, they would issue an outbound ACL to match and count the packets' VNI fields. Because some chips do not support matching this VNI field in outbound ACLs, the chip will return an error indicating that it is not supported, thus preventing the desired functionality from being achieved.
[0049] To address this, the present invention provides a message processing method. In order to save users' operating costs and make users unaware of the differences between chips, when configuring the outbound ACL to match the message VNI on the outbound module of a chip that does not support outbound ACL, two ACLs are issued. The first is the inbound ACL, which is used to match the message VNI and generate metadata (a 5-tuple). This metadata will accompany the message to the outbound module. At this time, the second ACL will be hit. The second ACL is the outbound ACL, which matches the metadata corresponding to the message. Then, the user's desired action, such as counting, is executed.
[0050] In this invention, for the computer device (the aforementioned sending device), the complete process of sending messages can be layered by the sending device. The layered structure can be divided into a bottom-layer chip (communication logic part), a middle layer (business logic part), and an upper layer (display operation part). To achieve the above-mentioned execution effect, the middle layer needs to create a data structure for the outgoing ACL (here, the outgoing ACL, since it is user-configured, can be used as user_entry) of the upper layer that matches the message VNI. This data structure records the correspondence between the user_entry and the two ACLs actually sent by the chip (here, the incoming ACL, since it is configured by the bottom-layer chip, can be used as ingress_chip_entry; the outgoing ACL can be used as egress_chip_entry). To handle the situation where the upper layer configures multiple user entries matching different VNIs simultaneously, a linked list can be constructed to manage these ACLs.
[0051] For each message in this linked list, a corresponding structure is constructed to store information according to a preset data structure. This structure storage information includes the following:
[0052] The outbound ACL number (user_entry_id) issued by the user is the outbound ACL number of the matching VNI message issued by the sending device.
[0053] The inbound ACL number (ingress_chip_entry_id) corresponding to the chip that generates metadata is the inbound ACL number created by the underlying chip of the sending device for generating metadata for VNI messages.
[0054] Match the outgoing ACL number (egress_chip_entry_id) of this metadata, that is, match the outgoing ACL number of the metadata.
[0055] The VNI that the ACL entry must match;
[0056] This includes a tail identifier for the linked list members that unifies the structure storage information corresponding to all user_entry entries. Specifically, a tail identifier is configured for the storage information of the last member in the linked list, indicating that this storage information is the last item in the list, facilitating traversal operations within the list. It should be further noted that this tail identifier is represented by the next_user_entry field. That is, each structure storage information is configured with a next_user_entry field. When the next_user_entry field is set to 0, it indicates that the corresponding structure storage information is the tail information of the linked list. If the next_user_entry field is set to 1, it indicates that the corresponding structure storage information is not the tail information.
[0057] In this invention, when querying the outbound statistics of VNI messages of a specified device (i.e., a specified receiving device), a statistical request for the outbound ACL of the messages sent by the receiving device is obtained. The statistical request includes a VNI field, which represents the unique identifier of the receiving device.
[0058] The VNI field in the statistics request is traversed through a linked list. The VNI field is matched against the VNI field in each structure stored in the linked list. If a match is found, it means that the corresponding ingress chip entry in that structure matches the VNI the upper layer is looking for. After a match, corresponding metadata is generated. The count of packets with a specific VNI that the upper layer wants is the number of hits of the egress chip entry matching the metadata in that structure. The chip interface is then directly called to query the hit count of this outbound chip entry and returned to the upper layer. The number of successful matches is used as the statistical count of the outbound ACL for packets sent to the specified device.
[0059] The message processing method provided by this invention constructs a linked list by matching the inbound ACL issued by the chip with the message VNI and adding metadata to the message, and matching the outbound ACL with the specified metadata of the message and performing actions. The method then matches the VNI field to be queried in the VNI field stored in the information of each structure in the linked list, and uses the number of successful matches as the statistical count of the outbound ACL of the message sent to the specified device. This achieves the purpose of message statistics even when some chips do not support outbound ACL matching with the VNI field.
[0060] In a further step of the above method, when deleting a VNI message from a specified device (i.e., a specified receiving device), the outgoing ACL number that the sending device plans to delete is obtained.
[0061] Traverse the linked list, determine the structure storage information to be deleted in the linked list based on the outgoing ACL number to be deleted, delete the ACL corresponding to the structure storage information to be deleted, and delete the structure storage information to be deleted in the linked list.
[0062] If the structure storage information to be deleted has a tail identifier, then based on the sequence number of each structure storage information in the linked list, the tail identifier is added to the structure storage information preceding the structure storage information to be deleted.
[0063] It should be noted that in this invention, when sending messages to a device is stopped, the ACL controlling the sending of messages is deleted. At this time, since the linked list contains structure storage information for sending that message, to avoid errors in subsequent counting, the corresponding structure storage information in the linked list needs to be deleted, as well as the corresponding ACL in the database. During the deletion process, the linked list also needs to be traversed. Then, the user_entry_id of each structure storage information is compared with the user_entry number to be deleted in the parent list. If they are the same, the structure storage information is deleted from the linked list. If the deleted structure storage information has a tail identifier, then the tail identifier needs to be configured on other structure storage information in the linked list to demonstrate the integrity of the linked list information and continue to serve subsequent traversal. Since all members in the linked list are arranged by number, it is equivalent to being arranged by sequence number. Therefore, it is only necessary to set the next_user_entry field of the structure storage information preceding the structure storage information to be deleted to 0. If we consider each structure storage information as a node, setting the next_user_entry field to 0 means that this structure storage information plays the role of the tail node in the linked list. Therefore, the parent node of the deleted tail node is taken as the new tail node.
[0064] In a further method of the present invention, the corresponding structure storage information can be quickly and accurately deleted by traversing the linked list, which facilitates effective information management.
[0065] In a further step of the above method, it should be noted that the deletion of information stored in the structure in the linked list is reflected in the following:
[0066] Based on the outbound ACL number to be deleted, retrieve the inbound ACL number for generating metadata for the VNI message and the outbound ACL number matching the metadata from the storage information of the structure to be deleted.
[0067] Based on the inbound ACL number generated for the metadata of the VNI message and the outbound ACL number matching the metadata, the inbound ACL corresponding to the generated metadata is deleted from the database, and the outbound ACL matching the metadata is also deleted.
[0068] In this invention, a computer device may need to recover a message sent to a receiving device. To avoid the cumbersome processing and potential failures caused by reconstructing the corresponding structure storage information in the linked list, the deleted ACL can be temporarily stored in a cache, and the structure storage information to be deleted can be stored in an auxiliary linked list as the structure storage information to be recovered. Here, both the cache and the auxiliary linked list serve as temporary storage carriers for the information to be deleted.
[0069] In this invention, a recovery period is configured for each deleted piece of information. If no recovery signal is received within this recovery period, it indicates that the information is no longer needed, and it is then completely deleted from the cache and auxiliary linked list. Therefore, the deletion period is determined based on the deletion time. When the deletion period is less than the preset recovery period, upon receiving a recovery signal, the deleted ACL is restored to the database, and the structure storage information to be restored is restored to its original position in the linked list based on the structure storage information to be restored in the auxiliary linked list.
[0070] In a further method of the present invention, by controlling the deleted information, it can be restored within an effective time, thereby improving the reuse of information and avoiding repeated construction.
[0071] In a further step of the above method, the steps for constructing the linked list are explained below:
[0072] To obtain the ACL issued by the newly added sending device, it is necessary to first determine whether the ACL is outgoing. If it is outgoing ACL and the ACL matches the packet VNI, the corresponding structure storage information should be constructed for the outgoing ACL and stored in the linked list.
[0073] In this invention, a linked list is essential. Its purpose is to handle situations where multiple user entries matching different VNIs are configured simultaneously at the upper layer; therefore, a linked list can be constructed to manage these ACLs.
[0074] When a newly added ACL is confirmed to be the first ACL, it indicates that the linked list has not yet been built; that is, the linked list structure does not exist. Initial construction is required, so the structure storage information corresponding to the newly added ACL serves as the head information of the linked list; that is, the structure storage information corresponding to the newly added ACL is the head node of the linked list. For a certain period, this linked list will still only contain this one structure storage information. To ensure the integrity of the linked list, a tail identifier should be added to this structure storage information.
[0075] Accordingly, when it is determined that the newly added ACL is not the first ACL, it indicates that it was created after the other structure storage information was generated. Therefore, the structure storage information corresponding to the newly added ACL is placed at the end of the existing linked list as the tail information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
[0076] Further explanation: During the construction of the structure storage information, the VNI is recorded, the chip of the sending device creates an inbound ACL for generating metadata for the VNI message, and records the inbound ACL number for generating metadata into the structure storage information.
[0077] The chip of the transmitting device creates an outgoing ACL that matches the metadata and records the outgoing ACL number that matches the metadata into the structure storage information.
[0078] In a further method of the present invention, a linked list is used to record the correspondence between user_entry and the two ACLs actually issued by the chip. This facilitates querying information based on traversing the linked list and realizing packet statistics, especially for chips that do not support outbound ACL matching of the VNI field.
[0079] under Figure 2 This is a flowchart illustrating the process of constructing and deleting structures to store information while traversing a linked list. (Refer to...) Figure 2 The above-mentioned processing content can be intuitively understood, and the specific description of the figure will not be repeated here.
[0080] The message statistics device provided by the present invention is described below. The message statistics device described below can be referred to in correspondence with the message processing method described above.
[0081] Figure 3 A schematic diagram of the structure of a message statistics device provided by the present invention is shown below. Figure 3 The device includes an acquisition module 31 and a statistics module 32, wherein:
[0082] The acquisition module is used to acquire a statistical request for the outgoing ACL of the message sent by the receiving device. The statistical request includes a VNI field, which represents the unique identifier of the receiving device.
[0083] The statistics module is used to match the VNI field in the VNI field of each structure stored in the linked list, and use the number of successful matches as the statistical number of outbound ACLs for the packets sent to the specified device.
[0084] The structure stored in the linked list includes:
[0085] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0086] In a further embodiment of the above-described apparatus, the apparatus includes a deletion module for:
[0087] Obtain the outgoing ACL number of the sending device that is scheduled to be deleted;
[0088] Traverse the linked list, determine the structure storage information to be deleted in the linked list based on the outgoing ACL number to be deleted, delete the ACL corresponding to the structure storage information to be deleted, and delete the structure storage information to be deleted from the linked list.
[0089] If the structure storage information to be deleted has a tail identifier, then based on the sequence number of each structure storage information in the linked list, the tail identifier is added to the structure storage information preceding the structure storage information to be deleted.
[0090] In a further embodiment of the above-described apparatus, the apparatus includes a building module for:
[0091] Obtain the ACL issued by the newly added sending device, determine that the newly added ACL is an outbound ACL and matches the packet VNI, and construct a structure corresponding to the newly added ACL to store information;
[0092] When it is determined that the newly added ACL is the first ACL, the structure storage information corresponding to the newly added ACL is used as the head information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
[0093] If it is determined that the newly added ACL is not the first ACL, the structure storage information corresponding to the newly added ACL is placed at the tail of the existing linked list as the tail information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
[0094] In a further embodiment of the above apparatus, the construction module, during the process of constructing the structure storage information corresponding to the newly added ACL, is specifically used for:
[0095] Record the VNI, and the chip of the sending device creates an inbound ACL for generating metadata for the VNI message, and records the inbound ACL number for generating metadata into the structure storage information.
[0096] The chip of the transmitting device creates an outgoing ACL that matches the metadata and records the outgoing ACL number that matches the metadata into the structure storage information.
[0097] In a further embodiment of the above device, the tail identifier is represented by the next_user_entry field. Setting the next_user_entry field to 0 indicates that the corresponding structure stores the tail information of the linked list.
[0098] In a further embodiment of the above apparatus, the deletion module, during the process of deleting the ACL corresponding to the structure storage information to be deleted, is specifically used for:
[0099] Based on the outbound ACL number to be deleted, retrieve the inbound ACL number for generating metadata for the VNI message and the outbound ACL number matching the metadata from the storage information of the structure to be deleted.
[0100] Based on the inbound ACL number that generates metadata for VNI messages and the outbound ACL number that matches the metadata, delete the inbound ACL corresponding to the inbound ACL number that generates the metadata, and delete the outbound ACL that matches the outbound ACL number of the metadata in the database.
[0101] Accordingly, the device also includes a recovery module for:
[0102] The deleted ACLs are stored in the cache, and the storage information of the structures to be deleted is stored in the auxiliary linked list as the storage information of the structures to be recovered.
[0103] The deletion duration is determined based on the deletion time. When the deletion duration is less than the preset recovery duration, upon receiving a recovery signal, the deleted ACL is restored to the database, and the structure storage information to be recovered is restored to its original position in the linked list based on the structure storage information to be recovered in the auxiliary linked list.
[0104] The message statistics device provided by this invention constructs a linked list by matching the inbound ACL issued by the chip with the message VNI and adding metadata to the message, and matching the outbound ACL with the specified metadata of the message. The device then matches the VNI field to be queried in the VNI field stored in the information of each structure in the linked list, and uses the number of successful matches as the statistical number of outbound ACLs for messages sent to the specified device. This achieves the purpose of message statistics even when some chips do not support outbound ACL matching with the VNI field.
[0105] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include: a processor 41, a communication interface 42, a memory 43, and a communication bus 44. The processor 41, communication interface 42, and memory 43 communicate with each other via the communication bus 44. The processor 41 can call logical instructions in the memory 43 to execute a message statistics method. This method includes: obtaining a statistics request for the outbound ACL of messages sent by the receiving device, the statistics request including a VNI field, the VNI field representing the unique identifier of the receiving device; matching the VNI field with the VNI field in the information stored in each structure of the linked list, and using the number of successful matches as the statistical count of the outbound ACL of messages sent to the specified device.
[0106] The structure stored in the linked list includes:
[0107] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0108] Furthermore, the logical instructions in the aforementioned memory 43 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the message statistics method provided by the above methods. The method includes: obtaining a statistics request for the outbound ACL of a message sent by a receiving device, the statistics request including a VNI field, the VNI field representing a unique identifier of the receiving device; matching the VNI field in the VNI field stored in each structure of the linked list, and taking the number of successful matches as the statistical count of the outbound ACL of the message sent by the specified device.
[0110] The structure stored in the linked list includes:
[0111] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0112] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the message statistics method provided by the above methods. The method includes: obtaining a statistics request for the outbound ACL of a message sent by a receiving device, the statistics request including a VNI field, the VNI field representing a unique identifier of the receiving device; matching the VNI field in the VNI field stored in each structure of the linked list, and taking the number of successful matches as the statistical count of the outbound ACL of the message sent by the specified device.
[0113] The structure stored in the linked list includes:
[0114] The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
[0115] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0116] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention 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; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A message statistics method, characterized in that, include: Obtain a statistical request for the outbound ACL of the message sent by the receiving device. The statistical request includes a VNI field, which represents the unique identifier of the receiving device. The VNI field is matched against the VNI field in the structure storage information of each structure in the linked list, and the number of successful matches is used as the statistical number of outbound ACLs for the packets sent to the specified device. The structure storage information in the linked list includes: The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
2. The message statistics method according to claim 1, characterized in that, The method further includes: Obtain the outgoing ACL number that the sending device plans to delete; Traverse the linked list, determine the structure storage information to be deleted in the linked list based on the outgoing ACL number to be deleted, delete the ACL corresponding to the structure storage information to be deleted, and delete the structure storage information to be deleted in the linked list; If the structure storage information to be deleted has a tail identifier, then based on the sequence number of each structure storage information in the linked list, the tail identifier is added to the structure storage information preceding the structure storage information to be deleted.
3. The message statistics method according to claim 2, characterized in that, The method further includes a processing step of constructing the linked list, including: Obtain the newly added ACL issued by the sending device, determine that the newly added ACL is an outbound ACL and matches the packet VNI, and construct a structure corresponding to the newly added ACL to store information; When it is determined that the newly added ACL is the first ACL, the structure storage information corresponding to the newly added ACL is used as the head information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL. If it is determined that the newly added ACL is not the first ACL, the structure storage information corresponding to the newly added ACL is placed at the tail of the existing linked list as the tail information of the linked list, and a tail identifier is added to the structure storage information corresponding to the newly added ACL.
4. The message statistics method according to claim 3, characterized in that, The construction of the structure storage information corresponding to the newly added ACL includes: Record the VNI, and the chip of the sending device creates an inbound ACL for generating metadata for the VNI message, and records the inbound ACL number for generating metadata into the structure storage information. The chip of the transmitting device creates an outgoing ACL that matches the metadata and records the outgoing ACL number that matches the metadata into the structure storage information.
5. The message statistics method according to claim 4, characterized in that, The tail identifier is represented by the next_user_entry field. Setting the next_user_entry field to 0 indicates that the corresponding structure stores the tail information of the linked list.
6. The message statistics method according to claim 3, characterized in that, The deletion of the ACL corresponding to the structure storage information to be deleted includes: Based on the outbound ACL number to be deleted, obtain the inbound ACL number for generating metadata for the VNI message and the outbound ACL number matching the metadata from the storage information of the structure to be deleted. Based on the inbound ACL number that generates metadata for VNI messages and the outbound ACL number that matches the metadata, delete the inbound ACL corresponding to the inbound ACL number that generates the metadata, and delete the outbound ACL that matches the outbound ACL number of the metadata in the database. Accordingly, the method further includes: The deleted ACLs are stored in the cache, and the storage information of the structures to be deleted is stored in the auxiliary linked list as the storage information of the structures to be recovered. The deletion duration is determined based on the deletion time. When the deletion duration is less than the preset recovery duration, upon receiving a recovery signal, the deleted ACL is restored to the database, and the structure storage information to be recovered is restored to its original position in the linked list based on the structure storage information to be recovered in the auxiliary linked list.
7. A message statistics device, characterized in that, include: The acquisition module is used to acquire a statistical request for the outgoing ACL of the message sent by the receiving device. The statistical request includes a VNI field, which represents the unique identifier of the receiving device. The statistics module is used to match the VNI field in the VNI field of each structure stored in the linked list, and use the number of successful matches as the statistical number of outgoing ACLs for the packets sent to the specified device. The structure storage information in the linked list includes: The outbound ACL number of the matching VNI message issued by the sending device, the inbound ACL number of the metadata generated for the VNI message created by the chip of the sending device, the outbound ACL number of the matching metadata, the VNI to be matched in the ACL entry, and the tail identifier of the linked list; the sending device is the device that sends the message to the receiving device.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the message statistics method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the message statistics method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the message statistics method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Packet access control method and system for network devices
CN101267437A
ACL distribution method and network device
CN109088894A