Spanning tree construction method and device for spanning tree protocol
By matching the source and destination MAC addresses of BPDU packets in the inbound access control list of the switch, the BPDU packets returned by the loop are identified and redirected, thus solving the problem of spanning tree calculation errors and improving network stability and communication efficiency.
Patent Information
- Application Number
- CN202511427876.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-09
AI Technical Summary
In existing spanning tree protocols, switch ports can still receive BPDU packets from the loop even when they are in blocking mode, leading to spanning tree calculation errors and oscillations, which affect network stability.
By matching the source MAC address and destination MAC address of Bridge Protocol Data Unit (BPDU) packets in the inbound access control list (ACL) of the switch, the local BPDU packets returned by the loop are identified and diverted to avoid affecting the processing of normal BPDU packets. An abnormal packet is handled by a CPU reserved queue.
It improves the computational accuracy and network communication efficiency of the spanning tree protocol, reduces the risk of misjudgment, and ensures the stability and rapid convergence of the spanning tree topology.
Smart Images

Figure CN121309261A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer information processing, and more specifically, to a method and apparatus for constructing a spanning tree protocol. Background Technology
[0002] To address the loop problem, IEEE has proposed the Spanning Tree Protocol (STP), Rapid Spanning Tree Protocol (RSTP), and Multiple Spanning Tree Protocol (MSTP). All spanning tree protocols maintain the spanning tree relationships between switches through Bridge Protocol Data Units (BPDUs). Switches exchange network topology information via these BPDUs, collaboratively electing the root bridge and calculating the spanning tree structure. Figure 1 The topology of the spanning tree is shown, and loop detection and prevention are implemented.
[0003] Once the spanning tree network stabilizes, the ports on the switch devices primarily exist in three states: blocking, learning, and forwarding. In the blocking state, the port does not forward data to prevent loops; in the learning state, the port learns the MAC addresses of devices in the network but does not forward data; in the forwarding state, it forwards data normally, learning and updating MAC addresses. BPDU packets are processed normally in all three states. However, because switch ports can still receive BPDU packets in the blocking state, in some network topologies, the switch can receive BPDU packets originating from itself and sent via a loop. This can interfere with normal spanning tree calculations, leading to incorrect spanning tree calculations or causing spanning tree oscillations, severely impacting the network. For example... Figure 1 As shown, sw1 and sw2 form a spanning tree network, while sw3 does not have spanning tree enabled and has a loop. In this network environment, BPDU messages sent by sw2 through port 1 will cause a broadcast storm on sw3 and be sent back to sw2 through port 1. In this case, sw2 receives too many BPDU messages through port 1 and cannot process the BPDU messages sent by sw1 normally, causing the spanning tree calculation on sw2 to malfunction.
[0004] Therefore, a new method and apparatus for constructing spanning trees for spanning tree protocols is needed.
[0005] The information disclosed in the background section is only intended to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] In view of this, this application provides a method and apparatus for constructing a spanning tree using the spanning tree protocol, which can identify bridge protocol data unit messages sent by the local machine and received through a loop, thereby avoiding errors in spanning tree calculation caused by affecting the reception of normal bridge protocol data unit messages and improving network communication efficiency.
[0007] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0008] According to one aspect of this application, a method for constructing a spanning tree using a spanning tree protocol is proposed. The method includes: a switch acquiring a bridge protocol data unit (BMU) message; matching the BMU message with the inbound access control list of the switch; determining the source address and destination address of the BMU message based on the matching result; and constructing and maintaining a spanning tree network topology using the BMU message when the source address and the destination address satisfy a preset rule.
[0009] In one exemplary embodiment of this application, the method further includes: when the source address and the destination address do not satisfy a preset rule, executing the corresponding action in the matched inbound access control list.
[0010] In one exemplary embodiment of this application, performing the action corresponding to the matched inbound access control list includes: determining the bridge protocol data unit message as a loop message; and sending the bridge protocol data unit message to the CPU reserved queue for processing.
[0011] In one exemplary embodiment of this application, the switch obtains a Bridge Protocol Data Unit (BTP) message by: obtaining the BTP message through the physical port of the switch.
[0012] In one exemplary embodiment of this application, matching the bridge protocol data unit message with the inbound access control list of the switch includes: generating an inbound access control list match using a specific source MAC address and a specific destination MAC address.
[0013] In one exemplary embodiment of this application, the specific source MAC address is the local bridge MAC address and the specific destination MAC address is the multicast address that generates the bridge protocol data unit message.
[0014] In one exemplary embodiment of this application, determining the source address and destination address of the bridge protocol data unit message includes: determining the source MAC address and destination MAC address of the bridge protocol data unit message.
[0015] In one exemplary embodiment of this application, when the source address and destination address satisfy a preset rule, constructing and maintaining a spanning tree network topology through the bridge protocol data unit message includes: determining that the bridge protocol data unit message is a normal bridge protocol data unit message when the source address and destination address satisfy the preset rule; and constructing and maintaining a spanning tree network topology through the bridge protocol data unit message.
[0016] In one exemplary embodiment of this application, constructing and maintaining a spanning tree network topology using the bridge protocol data unit (BMU) message includes: determining the root bridge identifier of each switch in the network based on the BMU message; constructing a spanning tree topology based on the root bridge identifier and the path cost of each switch port; determining the forwarding status or blocking status of each port in the topology; and maintaining the spanning tree network topology based on the port status information.
[0017] According to one aspect of this application, a spanning tree construction apparatus for a spanning tree protocol is proposed. The apparatus includes: a receiving module for a switch to acquire bridge protocol data unit (BNU) packets; a matching module for matching the BNU packets with the inbound access control list of the switch; an address module for determining the source address and destination address of the BNU packets based on the matching result; and a generation module for constructing and maintaining a spanning tree network topology using the BNU packets when the source address and destination address satisfy a preset rule.
[0018] According to one aspect of this application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs; and, when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the method as described above.
[0019] According to one aspect of this application, a computer-readable medium is provided having a computer program stored thereon that, when executed by a processor, implements the method described above.
[0020] According to the spanning tree construction method and apparatus for spanning tree protocol of this application, a bridge protocol data unit (BNU) message is obtained through a switch; the BNU message is matched with the inbound access control list of the switch; based on the matching result, the source address and destination address of the BNU message are determined; when the source address and the destination address meet preset rules, the spanning tree network topology is constructed and maintained through the BNU message, which can identify BNU messages sent by the local machine that are received through a loop, avoid affecting the reception of normal BNU messages and causing spanning tree calculation errors, and improve network communication efficiency.
[0021] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description
[0022] The above and other objects, features, and advantages of this application will become more apparent from the detailed description of exemplary embodiments with reference to the accompanying drawings. The drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0023] Figure 1 It is the topology of the spanning tree in the existing technology.
[0024] Figure 2 This is a schematic diagram of spanning tree calculation in the existing technology.
[0025] Figure 3 This is another schematic diagram of spanning tree calculation in the existing technology.
[0026] Figure 4 This is a flowchart illustrating a method for constructing a spanning tree protocol according to an exemplary embodiment.
[0027] Figure 5 This is a flowchart illustrating a method for constructing a spanning tree protocol according to another exemplary embodiment.
[0028] Figure 6 This is a block diagram illustrating a spanning tree construction apparatus for a spanning tree protocol according to an exemplary embodiment.
[0029] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment.
[0030] Figure 8 This is a block diagram illustrating a computer-readable medium according to an exemplary embodiment. Detailed Implementation
[0031] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this application will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0032] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0035] It should be understood that although the terms first, second, third, etc., may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another. Therefore, the first component discussed below may be referred to as the second component without departing from the teachings of this application. As used herein, the term "and / or" includes all combinations of any one and more of the associated listed items.
[0036] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of exemplary embodiments, and the modules or processes in the drawings are not necessarily essential for implementing this application, and therefore cannot be used to limit the scope of protection of this application.
[0037] The technical abbreviations used in this application are explained as follows:
[0038] ACL: Access Control List, is a collection of one or more rules. A rule is a conditional statement describing the matching criteria for a packet; these criteria can be the packet's source address, destination address, port number, etc. Essentially, an ACL is a packet filter, and rules are the filter elements. Devices match packets based on these rules, filtering out specific packets and allowing or blocking them according to the processing policies of the service modules applying the ACL.
[0039] BPDU: Bridge Protocol Data Unit. The Bridge Protocol Data Unit is the core communication unit of the Spanning Tree Protocol, used to exchange topology information between switches in order to collaboratively compute the spanning tree.
[0040] STP: Spanning Tree Protocol;
[0041] RSTP: Rapid Spanning Tree Protocol;
[0042] MSTP: Multiple Spanning Tree Protocol;
[0043] All three of the above belong to the Spanning Tree Protocol (STP), which is a loop-breaking protocol in Ethernet. To solve the loop problem, IEEE has successively proposed STP (Spanning Tree Protocol), RSTP (Rapid Spanning Tree Protocol), and MSTP (Multiple Spanning Tree Protocol). RSTP is an improvement on STP, enabling fast network topology convergence. STP and RSTP cannot block redundant links by VLAN; all VLANs in the local area network share a single spanning tree, and all VLAN packets are forwarded along a single spanning tree, thus failing to achieve load balancing between VLANs. Furthermore, when a link is blocked, it will not carry any traffic, resulting in wasted bandwidth and potentially preventing the forwarding of packets from some VLANs. MSTP overcomes the shortcomings of STP and RSTP, being compatible with both. It achieves fast convergence and provides multiple paths for data forwarding, enabling load balancing of VLAN data during the forwarding process.
[0044] The applicant in this case discovered that existing solutions to this problem involve enabling edge ports and BPDU protection. Edge ports are ports connected to terminal devices (such as computers, printers, etc.), typically ports on access switches. Edge ports assume connection to terminal devices and do not create loops. BPDU protection is a mechanism to prevent access ports from receiving unwanted BPDUs. When a port with BPDU protection enabled receives a BPDU, the switch will shut down that port, entering an error-disabled state. Figure 2 As shown, port 1 of sw2 is used as an edge port and BPDU protection is enabled. When port 1 of sw2 receives a BPDU message sent from the loop of sw3, it will shut down to isolate the traffic of sw3.
[0045] The existing edge port and BPDU protection functions have the following main drawbacks:
[0046] 1. In actual network applications, the network topology is complex. Although it is not difficult to determine whether a port is an edge port, it may require manual configuration, which involves a lot of configuration and is troublesome to manage.
[0047] 2. Prone to misjudgment, such as Figure 3 In the environment shown, SW2's port 1 is enabled as an edge port, and SW4 also has spanning tree functionality enabled. BPDU packets sent from SW4's port 2 will be received by SW2's port 1, triggering the BPDU protection function and causing it to shut down directly. This will significantly impact the network environment.
[0048] To address the problem of spanning tree calculation errors in existing network topologies, this application proposes a spanning tree construction method and apparatus for the Spanning Tree Protocol (STP), which can identify BPDU messages sent by the local machine and received through loops, thus resolving the abnormal spanning tree calculation problem caused by loops.
[0049] The content of this application will be described in detail below through specific embodiments.
[0050] Figure 4 This is a flowchart illustrating a spanning tree construction method for a spanning tree protocol according to an exemplary embodiment. The spanning tree construction method 40 for the spanning tree protocol includes at least steps S402 to S408.
[0051] like Figure 4 As shown, in S402, the switch acquires the Bridge Protocol Data Unit (BPC) message. For example, the BPC message can be acquired through the switch's physical port.
[0052] Switches receive Bridge Protocol Data Unit (BPDU) messages from other devices in the network through their physical ports. BPDU messages are the core control messages of the Spanning Tree Protocol, used to transmit spanning tree topology information in the network.
[0053] In S404, the bridge protocol data unit message is matched with the inbound access control list of the switch.
[0054] In one embodiment, the method further includes: generating an inbound access control list matching using a specific source MAC address and a specific destination MAC address. The specific source MAC address is the local bridge MAC address, and the specific destination MAC address is the multicast address used to generate the bridge protocol data unit (BMU) message.
[0055] After receiving a BPDU message, the switch performs a pre-defined inbound access control list (ACL) match to identify the source and destination addresses of the message.
[0056] In one embodiment, the ACL matching rule includes matching based on a specific source MAC address and a specific destination MAC address, wherein the specific source MAC address is the local bridge MAC address, and the specific destination MAC address is the multicast address 01:80:C2:00:00:00 of the spanning tree BPDU packet. Using this rule, the switch can quickly filter out local BPDU packets that may be loop-returned.
[0057] In S406, based on the matching result, the source address and destination address of the bridge protocol data unit message are determined. The source MAC address and destination MAC address of the bridge protocol data unit message are also determined.
[0058] In S408, when the source address and the destination address satisfy a preset rule, the spanning tree network topology is constructed and maintained through the bridge protocol data unit (BNU) message. For example, when the source address and destination address satisfy the preset rule, the BNU message is determined to be a normal BNU message; the spanning tree network topology is constructed and maintained through the BNU message.
[0059] More specifically, the root bridge identifier of each switch in the network can be determined based on the bridge protocol data unit message; the spanning tree topology can be constructed according to the root bridge identifier and the path cost of each switch port; the forwarding status or blocking status of each port can be determined in the topology; and the spanning tree network topology can be maintained based on the port status information.
[0060] More specifically, the process may include the following steps: determining the root bridge identifier of each switch in the network based on the BPDU message; calculating the topology of the spanning tree based on the root bridge identifier and the path cost of each switch port; determining the forwarding or blocking state of each port in the topology; and dynamically maintaining the network topology based on the port state information to ensure the elimination of network loops and stable convergence of the topology.
[0061] Through the above processing, the switch can continuously maintain a stable spanning tree network structure in complex networking environments, preventing topology oscillations or double-root phenomena caused by loops.
[0062] In one embodiment, the method further includes: when the source address and the destination address do not meet the preset rules, executing the corresponding action in the matched inbound access control list.
[0063] More specifically, the bridge protocol data unit message can be identified as a loop message; the bridge protocol data unit message can be sent to the CPU reserved queue for processing.
[0064] In one optional embodiment, when the source address and destination address do not meet the preset rules, the switch executes the action corresponding to the matched ACL rule. For example, the BPDU packet can be identified as a loop packet and sent to the CPU's reserved queue for processing. By importing abnormal packets into a separate reserved queue, it is possible to effectively prevent abnormal PDUs from occupying normal BPDU queue resources, thereby ensuring that the switch can continuously receive and process valid BPDU packets from the root bridge.
[0065] By introducing ACL matching rules based on source and destination MAC addresses at the switch port side, local BPDU packets returned from loops can be identified and diverted, separating abnormal packets from normal packets for processing, thereby ensuring the stable operation of the Spanning Tree Protocol (STP). Compared with traditional edge port configuration and BPDU protection mechanisms, this embodiment requires less manual configuration, reduces the risk of misjudgment, and can significantly improve the accuracy and convergence speed of spanning tree topology calculation in complex network environments.
[0066] According to the spanning tree construction method for the spanning tree protocol of this application, a bridge protocol data unit (BNU) message is obtained through a switch; the BNU message is matched with the inbound access control list of the switch; based on the matching result, the source address and destination address of the BNU message are determined; when the source address and the destination address meet preset rules, the spanning tree network topology is constructed and maintained through the BNU message. This method can identify BNU messages sent by the local machine that are received through a loop, avoiding interference with the reception of normal BNU messages and thus preventing spanning tree calculation errors, thereby improving network communication efficiency.
[0067] It should be clearly understood that this application describes how specific examples are formed and used, but the principles of this application are not limited to any details of these examples. Rather, based on the teachings of the disclosure of this application, these principles can be applied to many other embodiments.
[0068] Figure 5 This is a flowchart illustrating a method for constructing a spanning tree protocol according to another exemplary embodiment. Figure 5 The process shown in step 50 is... Figure 4 A detailed description of the process shown. (e.g.) Figure 5 As shown, this application can identify BPDU messages sent by the local machine that are received through the loop, thus avoiding errors in spanning tree calculation caused by affecting the reception of normal BPDU messages.
[0069] Generally, switches forward received packets directly through the switching chip. A small number of network protocol control packets need to be sent to the CPU for processing. Switches divide different types of packets into different queues. Since there are a relatively large number of available queues, some are reserved for use as needed. BPDU packets are commonly used network protocol packets, and a dedicated queue is used to receive these packets. Figure 2 In the problematic network environment shown, sw2 receives a large number of BPDU packets sent from the loop, which severely blocks the BPDU packet receiving queue of the switch. Since all received BPDU packets are sent to the same queue, sw2 cannot receive and process the BPDU packets sent by sw1 normally. sw2's spanning tree calculation has a problem, and it thinks it is the root bridge, resulting in a double-root phenomenon.
[0070] The principle behind this application's protection of SW2's spanning tree calculation is as follows: The loop BPDU packets received by SW2's port 1 are traceable, originating from SW2 itself. This allows for the identification of the source MAC address. Furthermore, the destination MAC address of the BPDU packet is a multicast address (01:80:C2:00:00:00). Therefore, the source and destination MAC addresses can be used to determine whether a loop BPDU packet received by SW2 is correct. Once the loop BPDU packet rules are determined, ACLs can be used to redirect these packets to the CPU packet reception reservation queue mentioned above for processing. This ensures the normal processing of BPDU packets from the root bridge and prevents the occurrence of dual-root issues.
[0071] like Figure 5 As shown, in S502, the physical port receives a message.
[0072] In S504, inbound ACL rule matching.
[0073] Among them, the inbound ACL needs to be pre-configured. The rule is to match the "source MAC + destination MAC". The action is to redirect the packet to a reserved queue of the CPU.
[0074] More specifically, the matching rule for an ACL can be "source MAC + destination MAC", and the action is to direct the packet to a reserved queue of the CPU. Wherein:
[0075] Source MAC: Local bridge MAC address;
[0076] Destination MAC: Spanning Tree BPDU multicast MAC address, 01:80:C2:00:00:00.
[0077] In S506, it is determined that the source MAC is the local machine and the destination MAC is the BPDU multicast address.
[0078] In S508, CPU reservation queue processing was introduced.
[0079] In S510, the BPDU is normally sent to the CPU queue corresponding to it.
[0080] Those skilled in the art will understand that all or part of the steps of the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, it performs the functions defined by the method provided in this application. The program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0081] Furthermore, it should be noted that the above figures are merely illustrative representations of the processes included in the method according to exemplary embodiments of this application, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0082] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0083] Figure 6 This is a block diagram illustrating a spanning tree construction apparatus for a spanning tree protocol according to an exemplary embodiment. Figure 6 As shown, the spanning tree construction apparatus 60 for the spanning tree protocol includes: a receiving module 602, a matching module 604, an address module 606, and a generation module 608.
[0084] The receiving module 602 is used by the switch to obtain bridge protocol data unit messages; the receiving module 602 is also used to obtain the bridge protocol data unit messages through the physical port of the switch.
[0085] The matching module 604 is used to match the bridge protocol data unit message with the inbound access control list of the switch; the matching module 604 is also used to generate an inbound access control list match using a specific source MAC address and a specific destination MAC address.
[0086] Address module 606 is used to determine the source address and destination address of the bridge protocol data unit message based on the matching result; address module 606 is also used to determine the source MAC address and destination MAC address of the bridge protocol data unit message.
[0087] The generation module 608 is used to construct and maintain a spanning tree network topology using the bridge protocol data unit (BMU) messages when the source address and destination address meet preset rules. The generation module 608 is also used to determine that the BMU message is a normal BMU message when the source address and destination address meet preset rules; and to construct and maintain a spanning tree network topology using the BMU messages.
[0088] According to the spanning tree construction apparatus for the spanning tree protocol of this application, a bridge protocol data unit (BNU) message is obtained through a switch; the BNU message is matched with the inbound access control list of the switch; based on the matching result, the source address and destination address of the BNU message are determined; when the source address and the destination address meet preset rules, the spanning tree network topology is constructed and maintained through the BNU message. This method can identify BNU messages sent by the local machine that are received through a loop, avoiding interference with the reception of normal BNU messages and thus preventing spanning tree calculation errors, thereby improving network communication efficiency.
[0089] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment.
[0090] The following reference Figure 7 To describe an electronic device 700 according to this embodiment of the present application. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0091] like Figure 7 As shown, the electronic device 700 is presented in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including storage unit 720 and processing unit 710), a display unit 740, etc.
[0092] The storage unit stores program code that can be executed by the processing unit 710, causing the processing unit 710 to perform the steps described in this specification according to various exemplary embodiments of this application. For example, the processing unit 710 can perform actions such as... Figure 4 , Figure 5 The steps are shown in the figure.
[0093] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 7201 and / or a cache storage unit 7202, and may further include a read-only memory unit (ROM) 7203.
[0094] The storage unit 720 may also include a program / utility 7204 having a set (at least one) program module 7205, such program module 7205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0095] Bus 730 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0096] Electronic device 700 can also communicate with one or more external devices 700' (e.g., keyboard, pointing device, Bluetooth device, etc.), enabling users to communicate with devices that interact with electronic device 700, and / or any device (e.g., router, modem, etc.) that allows electronic device 700 to communicate with one or more other computing devices. This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. Network adapter 760 can communicate with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0097] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software, or by combining software with necessary hardware. Therefore, as... Figure 8As shown, the technical solution according to the embodiments of this application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.) or on a network, and includes several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the above-described method according to the embodiments of this application.
[0098] The software product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0099] The computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0100] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0101] The aforementioned computer-readable medium carries one or more programs. When one or more of these programs are executed by a device, the computer-readable medium performs the following functions: the switch acquires Bridge Protocol Data Unit (BMU) messages; matches the BMU messages with the switch's inbound access control list; determines the source address and destination address of the BMU messages based on the matching result; and, when the source address and destination address satisfy a preset rule, constructs and maintains a spanning tree network topology using the BMU messages.
[0102] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified to be uniquely different from one or more devices in this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0103] Through the description of the above embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0104] Exemplary embodiments of this application have been specifically shown and described above. It should be understood that this application is not limited to the detailed structures, arrangements, or implementation methods described herein; rather, this application is intended to cover various modifications and equivalent arrangements contained within the spirit and scope of the appended claims.
Claims
1. A method for constructing a spanning tree for a spanning tree protocol, characterized in that, include: The switch acquires bridge protocol data unit messages; Match the bridge protocol data unit message with the inbound access control list of the switch; Based on the matching results, the source address and destination address of the bridge protocol data unit message are determined; When the source address and the destination address satisfy a preset rule, the spanning tree network topology is constructed and maintained through the bridge protocol data unit message.
2. The method as described in claim 1, characterized in that, Also includes: When the source address and the destination address do not meet the preset rules, the corresponding action in the matched inbound access control list is executed.
3. The method as described in claim 2, characterized in that, Execute the corresponding action in the matched inbound access control list, including: The bridge protocol data unit message is identified as a loop message; The bridge protocol data unit message is sent to the CPU reserved queue for processing.
4. The method as described in claim 1, characterized in that, The switch acquires Bridge Protocol Data Unit (BTP) messages, including: The bridge protocol data unit message is obtained through the physical port of the switch.
5. The method as described in claim 1, characterized in that, Matching the bridge protocol data unit message with the inbound access control list of the switch also includes: Inbound access control list matching is generated by using a specific source MAC address and a specific destination MAC address.
6. The method as described in claim 5, characterized in that, The specific source MAC address is the local bridge MAC address, and the specific destination MAC address is the multicast address that generated the bridge protocol data unit message.
7. The method as described in claim 1, characterized in that, Determining the source and destination addresses of the bridge protocol data unit message includes: Determine the source MAC address and destination MAC address of the bridge protocol data unit message.
8. The method as described in claim 1, characterized in that, When the source address and destination address satisfy a preset rule, the spanning tree network topology is constructed and maintained through the bridge protocol data unit message, including: When the source address and destination address meet the preset rules, the bridge protocol data unit message is determined to be a normal bridge protocol data unit message; The spanning tree network topology is constructed and maintained through the bridge protocol data unit messages.
9. The method as described in claim 8, characterized in that, Constructing and maintaining the spanning tree network topology through the bridge protocol data unit messages includes: The root bridge identifier of each switch in the network is determined based on the bridge protocol data unit message. Based on the root bridge identifier and the path cost of each switch port, construct the topology of the spanning tree; In the topology, determine the forwarding state or blocking state of each port; Based on the port status information, maintain the spanning tree network topology.
10. A spanning tree construction apparatus for a spanning tree protocol, characterized in that, include: The receiving module is used by the switch to acquire bridge protocol data unit messages; The matching module is used to match the bridge protocol data unit message with the inbound access control list of the switch; The address module is used to determine the source address and destination address of the bridge protocol data unit message based on the matching result; The generation module is used to construct and maintain the spanning tree network topology using the bridge protocol data unit messages when the source address and destination address meet the preset rules.
Citation Information
Patent Citations
Message state checking method and device, switch equipment and storage medium
CN119299407A
