A method and apparatus for managing forms
By setting an aging filter bitmap mask and a software entry polling task, the problem of aging hardware MAC address entries on online user terminals was solved, thus improving the user's internet experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEW H3C TECH CO LTD
- Filing Date
- 2024-12-27
- Publication Date
- 2026-05-26
Smart Images

Figure CN119743469B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a method and apparatus for managing table entries. Background Technology
[0002] For a user terminal that successfully authenticates and goes online on the network device, the network device records the user terminal's MAC address entry in the hardware Media Access Control (MAC) address table and records the user terminal's information entry in the online user list. The network device is configured with MAC address aging time and offline detection time. If no packets are received from the user terminal within the MAC address aging time, the network device's hardware chip will age the user terminal's MAC address entry in the hardware MAC address table; if no packets are received from the user terminal within the offline detection time, the network device will disconnect the user terminal and delete the user terminal's information entry from the online user list.
[0003] Since MAC address aging time and offline detection time are independent of each other, if the MAC address aging time is less than the offline detection time, it will result in a situation where the user terminal is online, but the hardware MAC address table entry has already aged out. In this case, the user terminal needs to re-authenticate and go online in order to access network resources, which will affect the user's Internet experience. Summary of the Invention
[0004] The purpose of this application is to provide a table entry management method and apparatus to solve the problem that user terminals are online, but the hardware MAC address table entries have become outdated, thereby improving the user's internet experience. The specific technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a table entry management method applied to a network device, the method comprising:
[0006] Configure the hardware MAC address table to prevent aging.
[0007] Perform a software table entry polling task, polling each storage location of the software MAC address table;
[0008] The software entry polling task performs a logical AND operation between the authentication type of the first software MAC address entry in the polled storage location and the aging filter bitmap mask; wherein, the aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1.
[0009] The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 1, and identifies that the first software MAC address entry matches the aging filter parameter.
[0010] The software entry polling task polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address table entry.
[0011] Secondly, embodiments of this application provide an entry management device applied to a network device, the device comprising:
[0012] The configuration module is used to prevent the hardware MAC address table from aging.
[0013] An execution module is used to perform a software entry polling task, polling each storage location of the software MAC address table. The software entry polling task performs a logical AND operation on the authentication type of the first software MAC address entry at the polled storage location and the aging filter bitmap mask. The aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. The software entry polling task determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 1, identifying that the first software MAC address entry matches the aging filter parameter. The software entry polling task then polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address entry.
[0014] Thirdly, embodiments of this application provide a network device including a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being prompted by the machine-executable instructions to implement the method provided in the first aspect.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method provided in the first aspect.
[0016] Fifthly, embodiments of this application also provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the method provided in the first aspect.
[0017] Beneficial effects of the embodiments in this application:
[0018] In the technical solution provided in this application embodiment, the network device is configured with an aging filter bitmap mask, and the aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. When the result of a logical AND operation between the authentication type of a MAC address entry and the aging filter bitmap mask is such that the corresponding bit of the aging filter parameter is 1, it indicates that the corresponding bit of the aging filter parameter for the authentication type of the MAC address entry is 1, and the MAC address entry matches the aging filter parameter, thus skipping the aging deletion process. For user terminals whose MAC address aging time is less than the offline detection time, the authentication type of the user terminal's MAC address can be set to an authentication type that matches the aging filter parameter, thereby skipping the aging deletion process of the user terminal's MAC address.
[0019] In addition, the network device is configured with a software entry polling task that polls each storage location of the software MAC address table. This allows the software entry polling task to poll the software MAC address table entries in each storage location, thereby skipping the aging and deletion process of software MAC address table entries that match the aging filter parameters. This ensures that MAC address table entries that need to skip the aging and deletion process can be avoided, while MAC address table entries that do not need to skip the aging and deletion process can be aged and deleted in a timely manner. This solves the problem of user terminals being online, but hardware MAC address table entries already being aged, thus improving the user's internet experience.
[0020] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application 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 only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0022] Figure 1 This is a first schematic diagram of a MAC address authentication network provided in an embodiment of this application;
[0023] Figure 2 A schematic diagram of a first type of table entry management method provided in this application embodiment;
[0024] Figure 3 A schematic diagram illustrating the execution of a software table polling task provided in an embodiment of this application;
[0025] Figure 4 A second flowchart illustrating the table entry management method provided in this application embodiment;
[0026] Figure 5 A third flowchart illustrating the table entry management method provided in this application embodiment;
[0027] Figure 6 A schematic diagram illustrating the aging bit setting process provided in an embodiment of this application;
[0028] Figure 7 This is a second schematic diagram of a MAC address authentication network provided in an embodiment of this application;
[0029] Figure 8 A schematic diagram of the structure of the table entry management device provided in the embodiments of this application;
[0030] Figure 9 This is a schematic diagram of the structure of a network device provided in an embodiment of this application. Detailed Implementation
[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0032] MAC address authentication is an authentication method that controls network access permissions for user terminals based on port and MAC address, without requiring the installation of client software. For example... Figure 1 In the network configuration shown, MAC address authentication is enabled on ports 101-103 and port 107 of network device 100. User terminals 104-106 are connected to network device 100, with user terminal 104 connected to port 101, user terminal 105 connected to port 102, and user terminal 106 connected to port 103.
[0033] When network device 100 detects a packet sent by user terminal 104 for the first time through port 101, it initiates a MAC address authentication operation for user terminal 104. This is achieved by a Remote Authentication Dial In User Service (RADIUS) server authenticating the MAC address of user terminal 104. During MAC address authentication, the user does not need to manually enter a username or password. If the MAC address authentication of user terminal 104 is successful, network device 100 allows user terminal 104 to access network resources through port 101 and issues the corresponding hardware MAC address entry 1 to the hardware MAC address table, recording hardware MAC address entry 1 in the hardware MAC address table and information entry 1 of user terminal 104 in the online user list. If the MAC address authentication of user terminal 104 fails, network device 100 discards the packet sent by user terminal 104 and prevents user terminal 104 from accessing the internet through port 101.
[0034] Similarly, network device 100 performs MAC address authentication on user terminal 105 and user terminal 106.
[0035] MAC address aging and MAC address offline detection functions can be enabled on ports 101 to 103 of network device 100. Taking port 101 as an example: After enabling the MAC address aging function on port 101, if no packet sent by user terminal 104 is received within the MAC address aging time, the hardware chip of network device 100 will delete hardware MAC address table entry 1. After enabling the MAC address offline detection function on port 101, if no packet sent by user terminal 104 is received within the offline detection time, network device 100 will disconnect user terminal 104 and delete information table entry 1, i.e., user terminal 104 will be offline.
[0036] Since MAC address aging time and offline detection time are independent of each other, if the MAC address aging time is less than the offline detection time, it will result in a situation where the user terminal is online, but the hardware MAC address table entry has already aged out. In this case, the user terminal needs to re-authenticate and go online in order to access network resources, which will affect the user's Internet experience.
[0037] Especially for dumb terminals, the MAC address offline detection function on a specified port needs to be disabled to ensure that the dumb terminal remains online. If the hardware MAC address table entries of the dumb terminal are outdated, it will cause the dumb terminal to be online but unable to access the internet.
[0038] To address the aforementioned problems, embodiments of this application provide a method for managing table entries, such as... Figure 2 As shown, applied to network devices, the method includes:
[0039] Step S201: Disable aging of the hardware MAC address table;
[0040] Step S202: Execute the software table entry polling task to poll each storage location of the software MAC address table;
[0041] Step S203, Software entry polling task, performs a logical AND operation between the authentication type of the first software MAC address entry in the polled storage location and the aging filter bitmap mask; wherein, the aging filter parameter bits of the aging filter bitmap mask are set to the binary value 1.
[0042] Step S204: The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 1, and identifies that the first software MAC address entry matches the aging filter parameter.
[0043] Step S205: The software entry polling task polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address table entry.
[0044] In the technical solution provided in this application embodiment, the network device is configured with an aging filter bitmap mask, and the aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. When the result of a logical AND operation between the authentication type of a MAC address entry and the aging filter bitmap mask is such that the corresponding bit of the aging filter parameter is 1, it indicates that the MAC address entry matches the aging filter parameter and can skip the aging deletion process. For user terminals whose MAC address aging time is less than the offline detection time, the authentication type of the user terminal's MAC address can be set to an authentication type that matches the aging filter parameter, thereby skipping the aging deletion process of the user terminal's MAC address.
[0045] In addition, the network device is configured with a software entry polling task that polls each storage location of the software MAC address table. This allows the software entry polling task to poll the software MAC address table entries in each storage location, thereby skipping the aging and deletion process of software MAC address table entries that match the aging filter parameters. This ensures that MAC address table entries that need to skip the aging and deletion process can be avoided, while MAC address table entries that do not need to skip the aging and deletion process can be aged and deleted in a timely manner. This solves the problem of user terminals being online, but hardware MAC address table entries already being aged, thus improving the user's internet experience.
[0046] In this embodiment of the application, the network device may be a switching device, a router, etc.
[0047] In step S201 above, the network device can use any of the following methods to prevent hardware MAC address aging.
[0048] Method 1: Disable the automatic aging mechanism of the MAC address in the hardware chip.
[0049] In this embodiment, the automatic aging mechanism for the MAC address of the hardware chip is as follows: if no message is received from the user terminal within the MAC address aging period, the hardware MAC address entry corresponding to the user terminal is aged out and deleted. The hardware MAC address entry corresponding to the user terminal is the hardware MAC address entry in the hardware MAC address table that includes the MAC address of the user terminal.
[0050] After disabling the automatic aging mechanism for MAC addresses, the hardware chip of the network device will no longer automatically age and delete hardware MAC address entries.
[0051] Method 2: Set the MAC address aging time of the hardware chip to non-aging.
[0052] In this embodiment, the network device can be configured to set the MAC address aging time to empty. When the hardware chip reads that the MAC address aging time is set to empty, it can determine that the MAC address aging time is not aging.
[0053] Network devices can also configure registers corresponding to the MAC address aging time. The register value determines whether the MAC address aging time is set to non-aging. For example, a register value of 1 indicates no MAC address aging; a register value of 0 indicates MAC address aging is enabled. In this case, the hardware chip can age the hardware MAC address table entries based on the MAC address aging time. That is, if no packets are received from user terminals within the MAC address aging time, the corresponding hardware MAC address table entry for that user terminal is aged out and deleted.
[0054] In this embodiment, the network device can enable MAC address authentication, enable MAC address offline detection, or disable MAC address offline detection on a specified port. For example, if the specified port is the access port for a dumb terminal, the network device can disable the MAC address offline detection function on that specified port to ensure that the dumb terminal remains online for an extended period.
[0055] In step S202 above, the MAC addresses included in the software MAC address table and the hardware MAC address table are the same, that is, the table entry specifications of the hardware MAC address table and the software MAC address table are the same. The MAC address entries included in the software MAC address table are software MAC address entries, and the MAC address entries included in the hardware MAC address table are hardware MAC address entries. One software MAC address entry is stored at one storage location in the software MAC address table, and correspondingly, one hardware MAC address entry is stored at one storage location in the hardware MAC address table. Software MAC address entries and hardware MAC address entries may include MAC address, access port, and authentication type, as shown in Table 1.
[0056] Table 1
[0057]
[0058] Wherein, the MAC address is the MAC address of the user terminal. In this embodiment, the MAC address can be a dynamic MAC address. Using a dynamic MAC address can avoid the problem that when a user terminal migrates from one port (such as the first port) of a network device to another port (such as the second port), the user terminal can only be re-authenticated and reconnected after the MAC address offline detection function of the first port detects that the user terminal is offline.
[0059] The access port is the port through which a user terminal connects to the network device, and the authentication type is the type used to authenticate whether the aging-out deletion process should be skipped. Authentication types can include one or more of MAC address type, port number type, and virtual LAN type. The MAC address type, port number type, and virtual LAN type can be categorized based on whether the aging-out deletion process should be skipped, or based on their intended use; there are no restrictions on these categories.
[0060] For example, MAC address types may include MAC address type 11 and MAC address type 12, where MAC address type 11 is the type that skips the aging and deletion process, and MAC address type 12 is the type that does not skip the aging and deletion process; or, MAC address types may include MAC address type 21, MAC address type 22 and MAC address type 23, where MAC address type 21 is the type of MAC address used for authentication, MAC address type 22 is the type of MAC address used for billing, and MAC address type 23 is the type of MAC address used for traffic monitoring.
[0061] For example, port number types can include port number type 11 and port number type 12, where port number type 11 is a type that skips the aging deletion process and port number type 12 is a type that does not skip the aging deletion process; or, port number types can include port number type 21 and port number type 22, where port number type 21 is a single port type and port number type 22 is an aggregated port type.
[0062] The authentication type can be represented by a corresponding parameter value, for example, the authentication type is 10000000. The authentication type can also be represented by a left shift, for example, the authentication type is 7, that is, the parameter value is 1<<7, which is 10000000.
[0063] The software entry polling task iterates through each storage location of the software MAC address table and deletes software MAC address entries that have reached their aging time. Network devices execute the software entry polling task, thus polling each storage location of the software MAC address table, i.e., polling each software MAC address entry within the software MAC address table.
[0064] In some embodiments, to reduce the processing pressure on the upper-layer software (such as the CPU) of the network device, the network device can intermittently poll the software MAC address table. Specifically: the network device pre-sets the number of polling times; the software table polling task determines that the number of storage locations in the software MAC address table that have been polled is equal to the preset number of polling times, and then enters a sleep state; when the sleep time ends, the software table polling task determines that the last storage location in the software MAC address table has not been polled, and then polls the next storage location in the software MAC address table; or, when the sleep time ends, the software table polling task determines that the last storage location in the software MAC address table has been polled, and then polls the first storage location in the software MAC address table.
[0065] In this embodiment of the application, when the network device performs a software table polling task and polls each storage location of the software MAC address table, the network device can determine the number of storage locations polled in this poll after polling a storage location. If the number of storage locations polled is less than the preset number of polls per time, the network device continues to poll the next storage location of the software MAC address table; if the number of storage locations polled is equal to the preset number of polls per time, the network device stops polling.
[0066] After the sleep period, the network device continues to perform the software table polling task, starting from the last storage location polled in the previous poll. It polls each storage location in the software MAC address table. During this poll, it can determine whether the last storage location polled in the previous poll is the last storage location in the software MAC address table. If not, it means that the last storage location in the software MAC address table has not been polled, and the next storage location in the software MAC address table is polled. If yes, it means that the last storage location in the software MAC address table has been polled, and the first storage location in the software MAC address table is polled.
[0067] For example Figure 3 The diagram illustrates the execution of the software table polling task. The software MAC address table includes 20 entries, numbered 1 to 20. Each polling operation involves 10 entries, with a sleep time of Δt. At time t1, the network device begins executing the software table polling task, starting with entry 1. At time t2, the network device executes the software table polling task and reaches entry 10; at this point, 10 storage locations have been polled, and the software table polling task enters a sleep state.
[0068] When time t3 is reached, the software table polling task sleeps for Δt, and the sleep time ends. The last storage location polled in the last time was table entry 10, which is not the last storage location. Therefore, the next storage location of the software MAC address table (i.e., table entry 11) is polled. At time t4, the network device executes the software table polling task and polls table entry 20. At this time, 10 storage locations have been polled, and the software table polling task enters a sleep state.
[0069] When time t5 is reached, the software MAC address polling task goes into sleep mode for Δt. The sleep time ends, and the last storage location polled was entry 20, which is the last storage location. Therefore, the first storage location of the software MAC address table (i.e., entry 1) is polled. This process of polling the software MAC address table is repeated to age out and delete entries that have reached their aging time.
[0070] In this embodiment of the application, the network device distributes the software table polling task to every moment, reducing the CPU processing pressure at any given time.
[0071] In this embodiment, the aforementioned sleep time can be preset by the user or obtained in the following manner: Before executing the software entry polling task, the number of polls per session of the software entry polling task is set; based on the software entry specifications of the software MAC address table, the number of polls per session, and the aging time of the software MAC address table, the polling time per session within the aging time of the hardware MAC address table is determined; the aging time of the software MAC address table is equal to the aging period of the hardware MAC address table; based on the polling time per session and the number of polls per session, the sleep time of the software entry polling task within each polling session is calculated.
[0072] The polling time mentioned above can be determined using the following formula:
[0073] T = S / (M / N).
[0074] Where T is the polling time, S is the aging time of the software MAC address table, M is the software table entry size of the software MAC address table, and N is the number of polls per polling session. N can be adjusted according to the processing capacity of the upper-layer software.
[0075] Given a fixed polling time, the network device can determine the processing time T' required for each polling quantity N based on the processing capacity of the upper-layer software, and thus determine the sleep time Δt = T - T'.
[0076] In this embodiment, the MAC address aging time is equal to the aging period of the hardware chip's MAC address table. Furthermore, the hardware and software MAC address tables have distinct entry specifications. Each hardware MAC address entry corresponds one-to-one with a software MAC address entry. By calculating the sleep time using the above method, it can be determined that the time required for the software MAC address table to complete one polling traversal is less than or equal to the aging period, ensuring timely aging and deletion of hardware MAC address entries.
[0077] In step S203 above, the first software MAC address entry is the software MAC address entry of any storage location polled by the network device.
[0078] Network devices are pre-configured with aging filter parameters, which indicate the authentication types that should skip the aging removal process. The authentication types and the number of aging filter parameters can be set according to actual needs. Based on these parameters, the network device configures a bitmap mask representing the aging filter parameters for each authentication type. In this bitmap mask, each aging filter parameter corresponds to one bit, which is set to a binary value of 1.
[0079] The network device performs a software entry polling task. When it finds the first software MAC address entry, it performs a logical AND operation between the authentication type of the first software MAC address entry and the aging filter bitmap mask, obtaining the logical AND result. Based on the logical AND result, the network device can determine whether the first software MAC address entry matches the aging filter parameters.
[0080] For example, if two MAC address types need to skip the aging-out deletion process, the network device is configured with two aging-out filtering parameters and an aging-out filtering bitmap mask corresponding to each MAC address type. In this bitmap mask, the bits corresponding to the aging-out filtering parameters for the two MAC address types are bits 4 and 7, respectively. Therefore, the aging-out filtering bitmap mask can be the binary string "0000000010010000". In the logical AND operation result, the corresponding bits of the aging-out filtering parameters are bits 4 and 7. If bit 4 is 1 or bit 7 is 1 in the logical AND operation result, it is determined that the software MAC address entry matches the aging-out filtering parameters. If bit 4 is 0 and bit 7 is 0 in the logical AND operation result, it is determined that the software MAC address entry does not match the aging-out filtering parameters.
[0081] In step S204 above, the network device performs a software table polling task to obtain the result of a logical AND operation. The network device determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 1, and thus determines that the current first software MAC address table entry matches the aging filter parameter. Therefore, the network device can skip the aging deletion process and proceed to step S205, which is to poll the next storage location of the software MAC address table.
[0082] In this embodiment, the network device skips the aging and deletion process of the first software MAC address table entry, and the network device also sets the hardware MAC address table to prevent aging. Therefore, the first software MAC address table entry and the first hardware MAC address table entry associated with the first software MAC address table entry do not age out.
[0083] For newly polled software MAC address entries in the storage location, the network device can re-execute steps S203 to S204 to determine whether to skip the aging and deletion process for the newly polled software MAC address entries.
[0084] Taking an authentication type of MAC address, a software MAC address entry 1 with a MAC address type of 10000000, and an aging filter bitmap mask of 10000000 as an example, the aging filter parameter has bit 7. A logical AND operation is performed on the MAC address type aging filter bitmap mask of the first software MAC address entry, resulting in 10000000. In this result, bit 7 = 1. Therefore, the network device can recognize that software MAC address entry 1 matches the aging filter parameter, thus skipping the aging deletion process of software MAC address entry 1 and polling the next storage location in the software MAC address table.
[0085] In this embodiment, the network device manages MAC address entries at the software level. Users can flexibly configure the MAC address aging mechanism according to actual business needs, such as flexibly configuring software entry polling tasks, aging filtering parameters, and authentication types, offering hope for solving the drawbacks of many business scenarios. Furthermore, in this embodiment, the network device uses a bitmap mask to represent aging filtering parameters, facilitating the management of these parameters and determining whether to skip the aging deletion process, thus improving entry management efficiency.
[0086] To address the aforementioned problems, embodiments of this application provide a method for managing table entries, such as... Figure 4 As shown, applied to network devices, the method includes:
[0087] Step S401: Disable aging of the hardware MAC address table;
[0088] Step S402: Execute the software table entry polling task to poll each storage location of the software MAC address table;
[0089] Step S403, Software entry polling task, performs a logical AND operation between the authentication type of the first software MAC address entry in the polled storage location and the aging filter bitmap mask; wherein, the aging filter parameter bits of the aging filter bitmap mask are set to the binary value 1.
[0090] Step S404: The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 1, and identifies that the first software MAC address entry matches the aging filter parameter.
[0091] Step S405: The software entry polling task polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address table entry; Steps S401 to S405 are the same as Steps S201 to S205 above.
[0092] Step S406, Software entry polling task, performs a logical AND operation between the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask;
[0093] In this embodiment of the application, the second software MAC address entry is a software MAC address entry from any storage location polled by the network device.
[0094] The network device performs a software entry polling task. When it finds an entry in the second software MAC address table, it performs a logical AND operation between the authentication type of the second software MAC address entry and the aging filter bitmap mask, obtaining the logical AND result. Based on the logical AND result, the network device can determine whether the second software MAC address entry matches the aging filter parameters.
[0095] Step S407: The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 0, and identifies that the second software MAC address entry does not match the aging filter parameter.
[0096] The network device performs a software table polling task and obtains the result of a logical AND operation. The network device determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 0. Therefore, it can determine that the current second software MAC address table entry does not match the aging filter parameter, and thus can execute the aging deletion process, i.e., execute steps S408 to S409.
[0097] Step S408: The software entry polling task identifies that the second software MAC address entry has not set a software aging flag.
[0098] Step S409: The software entry polling task sets a software aging flag for the second software MAC address entry and sets a hardware aging flag for the second hardware MAC address entry corresponding to the second software MAC address entry.
[0099] The second hardware MAC address entry is the hardware MAC address entry in the hardware MAC address table that corresponds to the second software MAC address entry. The aging identifier for the software MAC address entry is called the software aging identifier, and the aging identifier for the hardware MAC address entry is called the hardware aging identifier. The non-aging identifier for the software MAC address entry is called the software non-aging identifier, and the non-aging identifier for the hardware MAC address entry is called the hardware non-aging identifier.
[0100] The network device performs a software entry polling task to read the second software MAC address entry to determine whether the second software MAC address entry has a software aging flag set. If it is determined that the second software MAC address entry has not a software aging flag set, then step S409 is executed to set the software aging flag for the second software MAC address entry and the hardware chip is notified so that the hardware chip sets the hardware aging flag for the second hardware MAC address entry.
[0101] In this embodiment of the application, in order to facilitate the management of aging identifiers, the software MAC address table entry and the hardware MAC address table entry may also include an aging bit (AGE bit), as shown in Table 2.
[0102] Table 2
[0103]
[0104] The AGE bit is used to fill the aging flag. The format of the aging flag can be set according to actual needs. For example, the aging flag can be FALSE or binary 0, and the non-aging flag can be TRUE or binary 1.
[0105] Based on the structure of this MAC address table, the network device performs a software table polling task, reads the second software MAC address table, and if the AGE bit of the second software MAC address table is TRUE or binary 1, it can be determined that the second software MAC address table has not set a software aging flag; then the AGE bit of the second software MAC address table is set to FALSE or binary 0, and the AGE bit of the second hardware MAC address table is also set to FALSE or binary 0.
[0106] In this embodiment of the application, the network device initiates the aging and deletion process of the second hardware MAC address table entry through the software aging identifier. This can realize the aging and deletion process of MAC addresses for which no user terminal is online, but whose hardware MAC address table entry has been aged out, thus avoiding the long-term occupation of the network device's storage space by the MAC addresses of certain user terminals.
[0107] To address the aforementioned problems, embodiments of this application provide a method for managing table entries, such as... Figure 5 As shown, applied to network devices, the method includes:
[0108] Step S501: Disable aging of the hardware MAC address table;
[0109] Step S502: Execute the software table entry polling task to poll each storage location of the software MAC address table;
[0110] Step S503, Software entry polling task, performs a logical AND operation between the authentication type of the first software MAC address entry in the polled storage location and the aging filter bitmap mask; wherein, the aging filter parameter bits of the aging filter bitmap mask are set to the binary value 1.
[0111] Step S504: The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 1, and identifies that the first software MAC address entry matches the aging filter parameter.
[0112] Step S505: The software entry polling task polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address table entry; Steps S501 to S505 are the same as Steps S201 to S205 above.
[0113] Step S506, Software entry polling task, performs a logical AND operation between the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask;
[0114] Step S507: The software table polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 0, and identifies that the second software MAC address table entry does not match the aging filter parameter; Steps S501 to S507 are the same as Steps S401 to S407 above.
[0115] The network device performs a software table polling task and obtains the result of a logical AND operation. The network device determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 0. Therefore, it can determine that the current second software MAC address table entry does not match the aging filter parameter, and thus can execute the aging deletion process, i.e., execute steps S508 to S509.
[0116] Step S508: The software entry polling task identifies that the second software MAC address entry has been set with a software aging flag.
[0117] Step S509: The software entry polling task identifies the hardware MAC address table, and finds that the second hardware MAC address table entry corresponding to the second software MAC address table entry does not have a hardware aging flag set, and sets a hardware aging flag for the second hardware MAC address table entry; or, identifies the hardware MAC address table, and finds that the second hardware MAC address table entry corresponding to the second software MAC address table entry has a hardware aging flag set; and ages out and deletes the second software MAC address table entry and the second hardware MAC address table entry.
[0118] In this embodiment of the application, the network device performs a software entry polling task to read the second software MAC address entry to determine whether the second software MAC address entry has a software aging flag set; if it is determined that the second software MAC address entry has a software aging flag set, then step S509 is executed to read the second hardware MAC address entry to determine whether the second hardware MAC address entry has a hardware aging flag set.
[0119] In this embodiment of the application, if the hardware chip receives a message that matches the second hardware MAC address table entry within one aging cycle of the hardware MAC address table, the hardware chip can set the hardware aging non-mark for the second hardware MAC address table entry.
[0120] If the hardware chip does not receive a message matching the second hardware MAC address table entry within one aging cycle of the hardware MAC address table, the hardware chip can set a hardware aging flag for the second hardware MAC address table entry.
[0121] If it is determined that the second hardware MAC address entry has not been set with a hardware aging flag, that is, the second hardware MAC address entry has been set with a hardware non-aging flag, it means that a message matching the second hardware MAC address entry was received in the previous aging cycle. The network device notifies the hardware chip to set the hardware aging flag for the second hardware MAC address entry. After that, the network device can continue to execute the software entry polling task to poll the next storage location of the software MAC address table.
[0122] If it is determined that the second hardware MAC address entry has a hardware aging flag set, it means that no packet matching the second hardware MAC address entry was received in the previous aging cycle. The network device then ages and deletes the second software MAC address entry and notifies the hardware chip, causing the hardware chip to age and delete the second software MAC address entry. Afterward, the network device can continue to perform the software entry polling task, polling the next storage location of the software MAC address table.
[0123] In this embodiment of the application, to facilitate the management of aging flags, the software MAC address entries and hardware MAC address entries may also include an aging bit (AGE bit), as shown in Table 2. Based on the structure of the MAC address entries shown in Table 2, the network device performs a software entry polling task, reads the second software MAC address entry, and if the AGE bit of the second software MAC address entry is read as FALSE or binary 0, it can be determined that the second software MAC address entry has set a software aging flag, and then the second hardware MAC address entry is read.
[0124] If the AGE bit of the second software MAC address entry is read as TRUE or binary 1, it indicates that the second hardware MAC address entry does not have a hardware aging flag set. The network device can then set the AGE bit of the second hardware MAC address entry to FALSE or binary 0. Afterward, the network device can continue executing the software entry polling task, polling the next storage location of the software MAC address table.
[0125] If the AGE bit of the second software MAC address entry is read as FALSE or binary 0, it can be determined that the second hardware MAC address entry has been set with a hardware aging flag. The network device can then age out the second software MAC address entry and notify the hardware chip to age out and delete it. Afterward, the network device continues to perform a software entry polling task, polling the next storage location of the software MAC address table.
[0126] In this embodiment of the application, the network device initiates the aging and deletion process of the second hardware MAC address table entry through the software aging identifier. This can realize the aging and deletion process of MAC addresses for which no user terminal is online, but whose hardware MAC address table entry has been aged out, thus avoiding the long-term occupation of the network device's storage space by the MAC addresses of certain user terminals.
[0127] When the authentication type matches the aging filter parameters, the procedure for setting the aging bit for software MAC address entries that match the aging filter parameters can be found in [link to documentation]. Figure 6 As shown. Among them, the software aging bit is the aging bit of the software MAC address table entry, and the hardware aging bit is the aging bit of the hardware MAC address table entry. Figure 6 The software MAC address entries and hardware MAC address entries in the table correspond to each other, meaning they include the same MAC address. Initially, the software MAC address table and hardware MAC address table are identical. In the initial state, the software aging bit and hardware aging bit are the software non-aging flag and the hardware non-aging flag, respectively.
[0128] Step S601: Read the software aging bit of the software MAC address table entry; if the software aging bit is a software non-aging flag, proceed to step S602; if the software aging bit is a software aging flag, proceed to step S603.
[0129] Step S602: Set the software aging bit to the software aging identifier and set the hardware aging bit of the hardware MAC address table entry to the hardware aging identifier; wait for the next polling session and re-execute step S601.
[0130] While waiting for the software MAC address table entry to be polled again, if the hardware chip receives a message that matches the hardware MAC address table entry within an aging cycle, the hardware chip can set the hardware aging bit of the hardware MAC address table entry to the hardware non-aging flag.
[0131] While waiting for the software MAC address table entry to be polled again, if the hardware chip does not receive a message matching the hardware MAC address table entry within an aging cycle, the hardware chip can keep the hardware aging bit of the hardware MAC address table entry as a hardware aging identifier.
[0132] Step S603: Read the hardware aging bit of the hardware MAC address table entry; if the hardware aging bit is a hardware non-aging indicator, then proceed to step S604; if the hardware aging bit is a hardware aging indicator, then proceed to step S605.
[0133] Step S604: Set the hardware aging bit to the hardware aging flag; wait for the next polling session, and re-execute step S601.
[0134] Step S605: Aging and deleting software MAC address entries and hardware MAC address entries.
[0135] The descriptions of steps S601-S605 above are relatively simple; please refer to the relevant descriptions above for details.
[0136] In this embodiment, the MAC address aging mechanism is managed by the upper-layer software of the network device, further improving the configuration flexibility of the MAC address aging mechanism. Furthermore, the hardware chip only needs to manage the hardware MAC address table entries, without needing to manage the software MAC address table entries, and there is no need to frequently notify the upper-layer software to modify the software MAC address table entries. In the MAC address aging mechanism, the upper-layer software only needs to read the hardware MAC address table entries once per aging cycle, reducing the number of communications between the hardware chip and the upper-layer software, lowering the burden on the upper-layer software, and improving the efficiency of the aging process.
[0137] In this embodiment of the application, the network device may also use other methods to implement the aging and deletion of software MAC address entries and hardware MAC address entries.
[0138] For example, network devices can disable the aging-out restriction for hardware MAC address tables. In this embodiment, the network device controls each hardware MAC address table entry individually. For software MAC address entries whose authentication type matches the aging-out filtering parameters, the network device only enables the hardware chip to age the corresponding hardware MAC address entries; for software MAC address entries whose authentication type does not match the aging-out filtering parameters, the network device keeps the hardware chip prohibited from aging the corresponding hardware MAC address entries, thus resolving the issue of user terminals being online but hardware MAC address entries already being aged out.
[0139] The following is combined with Figure 1 The network shown illustrates the table management method provided in the embodiments of this application. Figure 1 The user terminal 105 is a dumb terminal.
[0140] 1) Network device 100 disables the automatic aging mechanism of MAC addresses in the hardware chip, or sets the aging time of MAC addresses in the hardware chip to not age; creates a software entry polling task, which instructs to traverse the software MAC address table in a loop and delete the software MAC address entries that have reached the aging time.
[0141] Authentication types include MAC address type and port number type. The MAC address type that skips the aging-out process is 7, which also indicates the MAC address type used for authentication. The port number type that skips the aging-out process is 5. The aging filter bitmap mask 1 for MAC address type 7 is 0x00000080, which is represented as 10000000 in binary. In aging filter bitmap mask 1, the aging filter parameter bit is bit 7. The aging filter bitmap mask 2 for port number type 5 is 0x00000020, which is represented as 100000 in binary. In aging filter bitmap mask 2, the aging filter parameter bit is bit 5. The authentication type is the number of bits shifted left.
[0142] 2) Enable MAC address authentication on ports 101-103 and 107 of network device 100 to control the network access permissions of user terminals. That is, the RADIUS server will only add the MAC address of the user terminal to the MAC address table after successfully authenticating the MAC address of the user terminal, so that the user terminal can access the network.
[0143] 3) User terminal 104 accesses network device 100 through port 101. When network device 100 detects a packet sent by user terminal 104 for the first time, it initiates MAC address authentication for user terminal 104. If MAC address authentication for user terminal 104 is successful, network device 100 records hardware MAC address entry 1 in hardware MAC address table and software MAC address entry 1 in software MAC address table. Both hardware MAC address entry 1 and software MAC address entry 1 include the MAC address 1-1-1 of user terminal 104. Additionally, information entry 1 of user terminal 104 is recorded in the online user list.
[0144] User terminal 105 accesses network device 100 through port 102. Upon first detecting a packet sent by user terminal 105, network device 100 initiates MAC address authentication for user terminal 105. If MAC address authentication is successful, network device 100 records hardware MAC address entry 2 in the hardware MAC address table and software MAC address entry 2 in the software MAC address table. Both hardware and software MAC address entries 2 include the MAC address 2-2-2 of user terminal 105. Additionally, network device 100 records information entry 2 of user terminal 105 in the online user list. Network device 100 disables the MAC address offline detection function on port 102 to ensure that user terminal 105, acting as a dumb terminal, remains online.
[0145] User terminal 106 accesses network device 100 through port 103. When network device 100 detects a packet sent by user terminal 106 for the first time, it initiates MAC address authentication for user terminal 106. If MAC address authentication for user terminal 106 is successful, network device 100 records hardware MAC address entry 3 in hardware MAC address table and software MAC address entry 3 in software MAC address table. Both hardware MAC address entry 3 and software MAC address entry 3 include the MAC address 3-3-3 of user terminal 106. Additionally, network device 100 records information entry 3 of user terminal 106 in online user list.
[0146] At this point, the hardware MAC address table and the software MAC address table can be found in Table 3.
[0147] Table 3
[0148]
[0149] Among them, the MAC addresses of user terminal 104 and user terminal 106 are dynamic attributes, that is, the MAC addresses of user terminal 104 and user terminal 106 are dynamic MAC addresses.
[0150] 4) Network device 100 performs a software table polling task, polling the software MAC address table. When software MAC address table entry 1 is polled, the MAC address type 7 in software MAC address table entry 1 is logically ANDed with the aging filter bitmap mask 1 to obtain the result 1 of (1<<7) & 0x00000080. In result 1, bit 7=1, so the aging deletion process of software MAC address table entry 1 is skipped, and software MAC address table entry 1 and hardware MAC address table entry 1 to which 1-1-1 belong are not deleted. The next software MAC address table entry is then polled.
[0151] In this embodiment of the application, the software MAC address table includes two authentication types. When the aging filter parameter bit in the logical AND operation result of one authentication type is 1, the aging deletion process of the software MAC address table is skipped.
[0152] When the polling reaches software MAC address table entry 2, the MAC address type 7 in software MAC address table entry 2 is logically ANDed with the aging filter bitmap mask 1 to obtain result 2 of (1<<7) & 0x00000080. In result 2, bit 7=1, so the aging deletion process of software MAC address table entry 2 is skipped, and software MAC address table entry 2 and hardware MAC address table entry 2 to which 2-2-2 belongs are not deleted. The next software MAC address table entry is then polled.
[0153] When the polling reaches software MAC address table entry 3, a logical AND operation is performed between MAC address type 1 in software MAC address table entry 3 and aging filter bitmap mask 1, resulting in (1<<1) & 0x00000080, where bit 7 is 0. A logical AND operation is then performed between port number type 2 in MAC address table entry 3 and aging filter bitmap mask 2, resulting in (1<<2) & 0x00000020, where bit 5 is 0. Since the condition for skipping the aging deletion process of software MAC address table entry 3 is not met, network device 100 executes the aging deletion process of software MAC address table entry 3 as follows:
[0154] Network device 100 reads the AGE bit 31 included in software MAC address table entry 3, as shown in Table 3. If AGE bit 31 is TRUE (software non-aging flag), then both AGE bit 32 in hardware MAC address table entry 3 and AGE bit 31 in software MAC address table entry 3 are set to FALSE (software aging flag or hardware non-aging flag), as shown in Table 4.
[0155] Table 4
[0156]
[0157] Network device 100 performs a software entry polling task, polling the software MAC address table. Before polling back to entry 3 in the software MAC address table, if a packet matching entry 3 in the hardware MAC address table is received within one aging cycle, the hardware chip sets bit 32 of entry 3 to TRUE, as shown in Table 3. If no packet matching entry 3 in the hardware MAC address table is received within one aging cycle, the hardware chip keeps bit 32 of entry 3 in the hardware MAC address table as FALSE, as shown in Table 4.
[0158] When network device 100 performs a software table polling task, polling the software MAC address table, and polls again to software MAC address table entry 3, network device 100 reads the AGE bit 31 in software MAC address table entry 3, as shown in Table 4. If AGE bit 31 is FALSE, then it reads the AGE bit 32 in hardware MAC address table entry 3. If the AGE bit 32 of hardware MAC address table entry 3 is FALSE, as shown in Table 4, then both hardware MAC address table entry 3 and software MAC address table entry 3 are aged out and deleted. If the AGE bit 32 of hardware MAC address table entry 3 is TRUE, as shown in Table 3, then the AGE bit 32 of hardware MAC address table entry 3 is set to FALSE, as shown in Table 4.
[0159] Afterward, the network device continues to perform a software table polling task, polling the software MAC address table. This process is repeated until both hardware MAC address table entry 3 and software MAC address table entry 3 are deleted.
[0160] 5) If no message is received from user terminal 104 within the offline detection time, network device 100 deletes information table entry 1, that is, user terminal 104 goes offline, and deletes hardware MAC address table entry 1 and software MAC address table entry 1.
[0161] If no message is received from user terminal 106 within the offline detection time, network device 100 deletes information table entry 6, that is, user terminal 106 goes offline, and deletes hardware MAC address table entry 3 and software MAC address table entry 3.
[0162] For user terminal 105, network device 100 disables the MAC address offline detection function of port 102, and the authentication type of user terminal 105 meets the conditions for skipping the aging deletion process. Network device 100 will not age-delete hardware MAC address table entry 2 and software MAC address table entry 2, ensuring that user terminal 105 is online for a long time.
[0163] 6) When user terminal 104 migrates from port 101 to port 107, such as Figure 7In the network topology shown, since MAC address 1-1-1 in hardware MAC address table entry 1 and software MAC address table entry 1 are dynamic attributes, if the MAC address offline detection function does not determine that user terminal 104 is offline on port 101, network device 100 can re-trigger MAC address authentication of user terminal 104 on port 107, update the access port in hardware MAC address table entry 1 and software MAC address table entry 1 to port 107, and send it to the hardware MAC address table and software MAC address table, as shown in Table 5.
[0164] Table 5
[0165]
[0166] In this embodiment, the user terminal using MAC address authentication is configured with a dynamic MAC address, but the MAC address does not age out. This means that the user terminal using MAC address authentication is only subject to offline detection time control, preventing packet loss issues caused by the user terminal being online but the hardware MAC address table entry having been aged out and deleted, i.e., inconsistency between the online user terminal and the hardware MAC address table. Furthermore, when the user terminal migrates its access port, it can be re-authenticated and reconnected in a timely manner, further improving the user's internet experience.
[0167] Corresponding to the above-described table entry management method, this application provides a table entry management device, such as... Figure 8 As shown, the device is applied to a network device and includes:
[0168] Module 801 is used to configure the hardware MAC address table to prevent aging.
[0169] The execution module 802 is used to execute a software entry polling task, which polls each storage location of the software MAC address table. The software entry polling task performs a logical AND operation between the authentication type of the first software MAC address entry at the polled storage location and the aging filter bitmap mask. The aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. The software entry polling task determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 1, thus identifying that the first software MAC address entry matches the aging filter parameter. The software entry polling task then polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address entry.
[0170] In some embodiments, the execution module 802 can also be used to execute a software entry polling task, polling each storage location of the software MAC address table; the software entry polling task performs a logical AND operation on the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask; the software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 0, identifying that the second software MAC address entry does not match the aging filter parameter; the software entry polling task identifies that the second software MAC address entry has not set a software aging flag; the software entry polling task sets a software aging flag for the second software MAC address entry and sets a hardware aging flag for the second hardware MAC address entry corresponding to the second software MAC address entry.
[0171] In some embodiments, the execution module 802 can also be used to execute a software entry polling task. The software entry polling task performs a logical AND operation on the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask. The software entry polling task determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 0, thus identifying that the second software MAC address entry does not match the aging filter parameter. The software entry polling task identifies that the second software MAC address entry has a software aging flag set. The software entry polling task identifies that in the hardware MAC address table, the second hardware MAC address entry corresponding to the second software MAC address entry has not a hardware aging flag set, and sets a hardware aging flag for the second hardware MAC address entry. Alternatively, it identifies that in the hardware MAC address table, the second hardware MAC address entry corresponding to the second software MAC address entry has a hardware aging flag set. The software entry polling task also ages and deletes the second software MAC address entry and the second hardware MAC address entry.
[0172] In some embodiments, the execution module 802 may also be used for:
[0173] Once the number of storage locations that have been polled in the software MAC address table is equal to the preset number of polls per time, the software table polling task enters a sleep state.
[0174] When the hibernation period ends, the software table polling task determines that the last storage location of the software MAC address table has not been polled, and then polls the next storage location of the software MAC address table; or
[0175] When the hibernation period ends, the software table polling task determines that the last storage location of the software MAC address table has been polled, and then polls the first storage location of the software MAC address table.
[0176] In some embodiments, the above-mentioned table entry management device may further include: a determination module and a calculation module;
[0177] The setting module 801 can also be used to set the number of polling cycles for each software table entry polling task before executing the software table entry polling task.
[0178] The determination module is used to determine the polling time within the aging time of the software MAC address table based on the software table entry specifications, the number of polls per polling, and the aging time of the software MAC address table; the aging time of the software MAC address table is equal to the aging period of the hardware MAC address table.
[0179] The calculation module is used to calculate the sleep time of the software table polling task within each polling time, based on the polling time and the number of polling sessions.
[0180] In the technical solution provided in this application embodiment, the network device is configured with an aging filter bitmap mask, and the aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. When the result of a logical AND operation between the authentication type of a MAC address entry and the aging filter bitmap mask is such that the corresponding bit of the aging filter parameter is 1, it indicates that the corresponding bit of the aging filter parameter for the authentication type of the MAC address entry is 1, and the MAC address entry matches the aging filter parameter, thus skipping the aging deletion process. For user terminals whose MAC address aging time is less than the offline detection time, the authentication type of the user terminal's MAC address can be set to an authentication type that matches the aging filter parameter, thereby skipping the aging deletion process of the user terminal's MAC address.
[0181] In addition, the network device is configured with a software entry polling task that polls each storage location of the software MAC address table. This allows the software entry polling task to poll the software MAC address table entries in each storage location, thereby skipping the aging and deletion process of software MAC address table entries that match the aging filter parameters. This ensures that MAC address table entries that need to skip the aging and deletion process can be avoided, while MAC address table entries that do not need to skip the aging and deletion process can be aged and deleted in a timely manner. This solves the problem of user terminals being online, but hardware MAC address table entries already being aged, thus improving the user's internet experience.
[0182] Corresponding to the above-described table entry management method, this application embodiment also provides a network device, such as... Figure 9 As shown, it includes a processor 901 and a machine-readable storage medium 902, the machine-readable storage medium 902 storing machine-executable instructions that can be executed by the processor 901, the processor 901 being prompted by the machine-executable instructions to implement any of the above-described table entry management methods.
[0183] In this embodiment of the application, the network device may further include a communication interface and a communication bus, wherein the processor 901, the communication interface, and the machine-readable storage medium 902 communicate with each other through the communication bus.
[0184] The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0185] The communication interface is used for communication between the aforementioned network devices and other devices.
[0186] Machine-readable storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the machine-readable storage medium may also be at least one storage device located remotely from the aforementioned processor.
[0187] The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0188] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described table entry management methods.
[0189] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the table entry management methods described above.
[0190] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0191] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0192] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for apparatus, network devices, storage media, and program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0193] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A method for managing a table entry, characterized by, Applied to network devices, the method includes: Configure the hardware MAC address table to prevent aging. For each successfully authenticated MAC address, a hardware MAC address entry is recorded in the hardware MAC address table, and a software MAC address entry is recorded in the software MAC address table. Perform a software table entry polling task, polling each storage location of the software MAC address table; The software entry polling task performs a logical AND operation between the authentication type of the first software MAC address entry in the polled storage location and the aging filter bitmap mask; wherein, the aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. The software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 1, and identifies that the first software MAC address entry matches the aging filter parameter. The software entry polling task polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address table entry.
2. The method of claim 1, wherein, The method further includes: The software entry polling task performs a logical AND operation between the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask. The software entry polling task determines that in the logical AND operation result, the corresponding bit of the aging filter parameter bit has a binary value of 0, and identifies that the second software MAC address entry does not match the aging filter parameter. The software entry polling task identifies that the second software MAC address entry has not been set with a software aging flag. The software entry polling task sets the software aging flag for the second software MAC address entry and sets the hardware aging flag for the second hardware MAC address entry corresponding to the second software MAC address entry.
3. The method of claim 1, wherein, The method further includes: The software entry polling task performs a logical AND operation between the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask. The software entry polling task determines that in the logical AND operation result, the corresponding bit of the aging filter parameter bit has a binary value of 0, and identifies that the second software MAC address entry does not match the aging filter parameter. The software entry polling task identifies that the second software MAC address entry has been set with a software aging flag. The software entry polling task identifies that the second hardware MAC address entry corresponding to the second software MAC address entry in the hardware MAC address table does not have a hardware aging flag set, and sets the hardware aging flag for the second hardware MAC address entry; or, it identifies that the second hardware MAC address entry corresponding to the second software MAC address entry in the hardware MAC address table has a hardware aging flag set; and then ages out and deletes both the second software MAC address entry and the second hardware MAC address entry.
4. The method according to any one of claims 1 to 3, characterized in that, The method also includes, Once the number of storage locations that have been polled in the software MAC address table is determined to be equal to the preset number of polls per time, the software table polling task enters a sleep state. When the hibernation period ends, the software entry polling task determines that the last storage location of the software MAC address table has not been polled, and then polls the next storage location of the software MAC address table; or When the hibernation period ends, the software entry polling task determines that the last storage location of the software MAC address table has been polled, and then polls the first storage location of the software MAC address table.
5. The method of claim 4, wherein, Before executing the software table polling task, the method further includes: Set the number of polls per poll for the software table polling task; Based on the software entry specifications of the software MAC address table, the number of polls per poll, and the aging time of the software MAC address table, the polling time per poll within the aging time of the hardware MAC address table is determined; the aging time of the software MAC address table is equal to the aging period of the hardware MAC address table. Based on the polling time and the number of polls per polling session, the sleep time of the software table polling task within each polling session is calculated.
6. An entry management apparatus characterized by comprising: Applied to network devices, the device includes: The configuration module is used to prevent the hardware MAC address table from aging out; based on each successfully authenticated MAC address, a hardware MAC address table entry is recorded in the hardware MAC address table and a software MAC address table entry is recorded in the software MAC address table. An execution module is used to perform a software entry polling task, polling each storage location of the software MAC address table. The software entry polling task performs a logical AND operation on the authentication type of the first software MAC address entry at the polled storage location and the aging filter bitmap mask. The aging filter parameter bits of the aging filter bitmap mask are set to a binary value of 1. The software entry polling task determines that the corresponding bit of the aging filter parameter in the logical AND operation result has a binary value of 1, identifying that the first software MAC address entry matches the aging filter parameter. The software entry polling task then polls the next storage location of the software MAC address table to skip the aging deletion process of the first software MAC address entry.
7. The apparatus of claim 6, wherein, The execution module is further configured to execute a software entry polling task, polling each storage location of the software MAC address table; the software entry polling task performs a logical AND operation between the authentication type of the second software MAC address entry at the polled storage location and the aging filter bitmap mask; the software entry polling task determines that the binary value of the corresponding bit of the aging filter parameter bit in the logical AND operation result is 0, identifying that the second software MAC address entry does not match the aging filter parameter; the software entry polling task identifies that the second software MAC address entry has not set a software aging flag; the software entry polling task sets the software aging flag for the second software MAC address entry and sets a hardware aging flag for the second hardware MAC address entry corresponding to the second software MAC address entry.
8. The apparatus of claim 6, wherein, The execution module is further configured to execute a software entry polling task, wherein the software entry polling task performs a logical AND operation between the authentication type of the second software MAC address entry in the polled storage location and the aging filter bitmap mask; the software entry polling task determines that the corresponding bit of the aging filter parameter bit in the logical AND operation result has a binary value of 0, and identifies that the second software MAC address entry does not match the aging filter parameter; the software entry polling task identifies that the second software MAC address entry has a software aging flag set; the software entry polling task identifies that the second hardware MAC address entry corresponding to the second software MAC address entry in the hardware MAC address table has not a hardware aging flag set, and sets the hardware aging flag for the second hardware MAC address entry; Alternatively, identify that the second hardware MAC address entry corresponding to the second software MAC address entry in the hardware MAC address table has been set with a hardware aging flag; age out and delete the second software MAC address entry and the second hardware MAC address entry.
9. The device according to any of claims 6-8, characterized in that The execution module is further configured to: Once the number of storage locations that have been polled in the software MAC address table is determined to be equal to the preset number of polls per time, the software table polling task enters a sleep state. When the hibernation period ends, the software entry polling task determines that the last storage location of the software MAC address table has not been polled, and then polls the next storage location of the software MAC address table; or When the hibernation period ends, the software entry polling task determines that the last storage location of the software MAC address table has been polled, and then polls the first storage location of the software MAC address table.
10. The apparatus according to claim 9, characterized in that, The device further includes: a determination module and a calculation module; The setting module is also used to set the number of polling cycles for each time in the software table entry polling task before executing the software table entry polling task; The determining module is used to determine the polling time within the aging time of the hardware MAC address table based on the software entry specifications of the software MAC address table, the number of polls per polling, and the aging time of the software MAC address table; the aging time of the software MAC address table is equal to the aging period of the hardware MAC address table. The calculation module is used to calculate the sleep time of the software table polling task within each polling time based on the polling time and the number of polls per polling.