A link maintenance method and device, electronic equipment and storage medium

By temporarily not modifying the MAC address of the aggregated link interface of the slave device during the master device restart, and determining the MAC address based on the negotiation result during the timer countdown, the link oscillation problem caused by the master device restart is resolved, and the stability of link transmission is improved.

CN116545920BActive Publication Date: 2026-07-07INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2023-04-06
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In a cross-device link aggregation group, the MAC address of the aggregation link interface of the slave device is modified multiple times during the restart of the master device, resulting in unstable link transmission.

Method used

During the master device restart, the MAC address of the aggregated link interface of the slave device is not modified temporarily. A masterless state timer is started. If a negotiation message is received during the timer's countdown, the MAC address of the aggregated link interface of the slave device is determined based on the negotiation result.

Benefits of technology

This reduces the number of times the MAC address of the aggregated link interface of the device is modified, thus improving the stability of link transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116545920B_ABST
    Figure CN116545920B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a link maintenance method and device, electronic equipment and storage medium. The method is applied to a first device, and the method comprises: after receiving an offline notification message sent by a second device, determining whether the first device is a slave device; if the first device is a slave device, starting a masterless state timer to time; before the time duration reaches a preset duration, if a negotiation message sent by a target device is received, negotiating with the target device according to the negotiation message, and determining an aggregation link interface media access control address of the first device according to a negotiation result, wherein the target device is a device in a current link or a device outside the current link. Through the above method, the link oscillation problem caused by the first device modifying the aggregation link interface media access control address multiple times when the second device in the link is offline can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a link maintenance method, apparatus, electronic device, and storage medium. Background Technology

[0002] Cross-device link aggregation enables link aggregation between multiple devices, thereby improving reliability from the board level to the device level. When a link or device in a cross-device link aggregation group fails, data services will be automatically switched to other available links or devices in the aggregation group, thus enhancing link-level and device-level reliability. However, in some systems, during the master device restart process, the aggregation link interface status of the master device changes from open to closed and then back to open. The media access control address (MAC) of the slave device's aggregation link interface is modified twice in response to the change in the master device's aggregation link interface status. This multiple modification of the slave device's aggregation link interface MAC address can cause oscillations in the aggregation link of the device, which is detrimental to the stability of link transmission. Summary of the Invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a link maintenance method, apparatus, electronic device and storage medium that overcomes or at least partially solves the above problems.

[0004] To address the aforementioned problems, in a first aspect, embodiments of the present invention disclose a link maintenance method, wherein the link includes a first device and a second device, the first device communicating with the second device, and the method being applied to the first device, the method comprising:

[0005] After receiving the offline notification message sent by the second device, determine whether the first device is a slave device;

[0006] If the first device is a slave device, then start the masterless state timer to keep track of the time;

[0007] If a negotiation message is received from the target device before the preset timeout period is reached, negotiation is conducted with the target device based on the negotiation message; wherein, the target device is a device in the current link or a device outside the current link;

[0008] The media access control address of the aggregation link interface of the first device is determined based on the negotiation results.

[0009] Optionally, if the first device is a slave device, then the second device is a master device, the aggregated link interface media access control address of the first device is the same as the media access control address of the second device, the negotiation message includes the media access control address of the target device, and determining the aggregated link interface media access control address of the first device according to the negotiation result includes:

[0010] If the negotiation result is that the first device is negotiated to be the master device and the target device is negotiated to be the slave device, then the aggregated link interface media access control address of the first device is modified to the media access control address of the first device.

[0011] If the negotiation result is that the first device is negotiated to be a slave device and the target device is negotiated to be a master device, then it is determined whether the media access control address of the aggregated link interface of the first device is the same as the media access control address of the target device.

[0012] If they are the same, then the media access control address of the aggregated link interface of the first device remains unchanged;

[0013] If they are different, the media access control address of the aggregation link interface of the first device is modified to the media access control address of the target device.

[0014] Optionally, determining whether the first device is a slave device after receiving the offline notification message sent by the second device includes:

[0015] After receiving the offline notification message from the second device, the negotiation status of the first device is changed to negotiation ended;

[0016] When the negotiation status of the first device is "negotiation ended", determine whether the first device is a slave device.

[0017] Optionally, the offline notification message includes a preset type value, and the step of modifying the negotiation status of the first device to "negotiation ended" after receiving the offline notification message sent by the second device includes:

[0018] Once the preset type value is parsed from the offline notification message, the negotiation status of the first device is changed to negotiation ended.

[0019] Optionally, the method further includes:

[0020] If the first device is the master device, then the media access control address of the aggregated link interface of the first device remains unchanged, and the masterless state timer is not started for timing.

[0021] Optionally, the method further includes:

[0022] If no negotiation message is received from the target device before the preset timeout period is reached, the media access control address of the aggregated link interface of the first device will be modified to the media access control address of the first device.

[0023] Optionally, the preset duration is preset based on the maximum time required for the device to restart.

[0024] In a second aspect, embodiments of the present invention disclose a link maintenance device, wherein the link includes a first device and a second device, the first device communicates with the second device, the method is applied to the first device, and the device includes:

[0025] The device role determination module is used to determine whether the first device is a slave device after receiving the offline notification message sent by the second device.

[0026] The timing module is used to start a masterless state timer to keep track of time if the first device is a slave device.

[0027] The negotiation module is used to negotiate with the target device based on the negotiation message if it receives a negotiation message from the target device before the timeout period reaches a preset timeout period; wherein the target device is a device in the current link or a device outside the current link.

[0028] The first aggregation link interface media access control address determination module is used to determine the aggregation link interface media access control address of the first device based on the negotiation result.

[0029] Optionally, the negotiation module is specifically configured to: if the negotiation result is that the first device is negotiated as the master device and the target device is negotiated as the slave device, then modify the aggregated link interface media access control address of the first device to the media access control address of the first device; if the negotiation result is that the first device is negotiated as the slave device and the target device is negotiated as the master device, then determine whether the aggregated link interface media access control address of the first device is the same as the media access control address of the target device; if they are the same, then keep the aggregated link interface media access control address of the first device unchanged; if they are different, then modify the aggregated link interface media access control address of the first device to the media access control address of the target device.

[0030] Optionally, the device role determination includes:

[0031] The negotiation status determination submodule is used to modify the negotiation status of the first device to negotiation end after receiving the offline notification message sent by the second device;

[0032] The device role determination submodule is used to determine whether the first device is a slave device when the negotiation status of the first device is "negotiation ended".

[0033] Optionally, the offline notification message includes a preset type value, and the negotiation status determination submodule is specifically used to modify the negotiation status of the first device to negotiation ended after parsing the preset type value from the offline notification message.

[0034] Optionally, the device further includes:

[0035] The second aggregation link interface media access control address determination module is used to keep the aggregation link interface media access control address of the first device unchanged if the first device is the master device, and not to start the masterless state timer for timing.

[0036] Optionally, the device further includes:

[0037] The third aggregation link interface media access control address determination module is used to modify the aggregation link interface media access control address of the first device to the media access control address of the first device if no negotiation message is received from the target device before the timeout period reaches the preset timeout period.

[0038] Optionally, the preset duration is preset based on the maximum time required for the device to restart.

[0039] Thirdly, embodiments of the present invention disclose an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the link maintenance method as described above.

[0040] Fourthly, embodiments of the present invention disclose a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the link maintenance method described above.

[0041] The embodiments of the present invention have the following advantages:

[0042] After receiving the offline notification message from the second device, the first device determines whether it is a slave device. If it is a slave device, it starts a masterless state timer. Before the timer reaches a preset duration, if it receives a negotiation message from the target device, it negotiates with the target device based on the negotiation message and determines the aggregated link interface media access control address of the first device based on the negotiation result. This method reduces the link oscillation problem caused by the first device repeatedly modifying the aggregated link interface media access control address when the second device in the link goes offline. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of a cross-device link aggregation group provided in an embodiment of the present invention;

[0044] Figure 2 This is a flowchart of the steps of a link maintenance method provided in an embodiment of the present invention;

[0045] Figure 3 This is a structural block diagram of a link maintenance device provided in an embodiment of the present invention;

[0046] Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present invention;

[0047] Figure 5 This is a structural block diagram of a computer-readable storage medium provided in an embodiment of the present invention. Detailed Implementation

[0048] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] In a live network, if devices are connected via a single link, and that link fails, the terminals at both ends of the link will be unable to communicate. Based on this, link aggregation technology emerged.

[0050] From a port perspective, link aggregation refers to bringing together multiple physical ports to form a single logical port, thereby achieving load balancing of inbound and outbound traffic across the member ports. The switch determines from which member port a data packet is sent to the other end of the switch based on the port load balancing method configured by the user.

[0051] From a link perspective, link aggregation combines multiple physical links between two devices and uses them as a single logical link. These two devices can be a pair of routers, a pair of switches, or a router and a switch. An aggregated link can contain multiple member links, with a default maximum of eight.

[0052] Link aggregation can improve link bandwidth. Theoretically, by aggregating several links, the bandwidth of an aggregation port can be expanded to the sum of the bandwidths of all member ports, thus effectively increasing the bandwidth of logical links. It can provide high reliability for the network. After configuring link aggregation, if a member aggregation link interface fails, the physical link of that member port will switch traffic to another member link. It can also achieve load balancing on an aggregation port. An aggregation port can distribute traffic to multiple different member ports and send traffic to the same destination through member links, minimizing the possibility of network congestion.

[0053] Multichassis Link Aggregation Group (M-LAG) is a mechanism for implementing cross-device link aggregation. It aggregates links between a server and multiple other devices, as if the server had established a link aggregation relationship with a single device, thereby improving link reliability from the single-board level to the device level.

[0054] Reference Figure 1 This diagram illustrates a cross-device link aggregation group according to an embodiment of the present invention. The cross-device link aggregation group includes one server, two switches, and one node. The links between the two switches and the server are aggregated links (Port Channel), and the aggregated link interfaces of the two switches are identical. The links between the switches are direct links (Peer Link). Assuming switch 1 is the master device and switch 2 is the slave device, the MAC address of the aggregated link interface of switch 2 is the MAC address of switch 1. When switch 1 restarts, the MAC address of the aggregated link interface of switch 2 will revert to its local MAC address. At this time, the server needs to reconfirm the MAC address of the aggregated link interface, confirming that the current MAC address is the MAC address of switch 2, and then send data services to switch 2 based on the newly confirmed MAC address. When switch 1 restarts and renegotiates to determine that switch 1 is the master device and switch 2 is the slave device, the MAC address of the aggregated link interface of switch 2 needs to be changed back to the MAC address of switch 1, and the server also needs to reconfirm the MAC address of the aggregated link interface. Therefore, during the restart of switch 1, the MAC address of the interface of the aggregated link is modified multiple times, which will cause the current aggregated link to fluctuate, which is not conducive to the stability of the link transmission.

[0055] Based on this, this invention proposes a novel method. During the master device restart of the aggregated link, the MAC address of the slave device's aggregated link interface is temporarily not modified. Instead, a masterless state timer is started. During the timer's countdown, if the slave device receives a negotiation message, the MAC address of the slave device's aggregated link interface is determined based on the negotiation message. This reduces the problem of multiple modifications to the slave device's aggregated link interface MAC address during the master device restart, which could lead to aggregated link oscillations.

[0056] Reference Figure 2 The diagram illustrates a flowchart of a link maintenance method according to an embodiment of the present invention. The link includes a first device and a second device, the first device communicates with the second device, and the method is applied to the first device. The method may specifically include the following steps:

[0057] Step 101: After receiving the offline notification message sent by the second device, determine whether the first device is a slave device.

[0058] The first device can be either the master or slave device in the aggregated link. When the first device is the master device, the second device is the slave device in the same aggregated link; when the first device is the slave device, the second device is the master device. Since the first and second devices are in the same aggregated link, their aggregated link interface MAC addresses are the same.

[0059] The first device and the second device can be switches. The first device and the second device communicate via a direct link.

[0060] Furthermore, the first and second devices communicate with the server via an aggregated link. When the second device receives a restart command from the server, or is manually restarted, it can send a shutdown notification message to the first device. The first device can receive the shutdown notification message from the second device and, upon receiving it, determine whether the first device (its own device) is a slave device.

[0061] In one embodiment, both the first and second devices may include an ICCP module (Institute for Certification of Computing Professionals). When the second device restarts, it can send a shutdown notification message to the first device via the built-in ICCP module. The first device receives the shutdown notification message from the second device via its built-in ICCP module.

[0062] In one embodiment, the step of determining whether the first device is a slave device after receiving the offline notification message sent by the second device may specifically include: after receiving the offline notification message sent by the second device, changing the negotiation status of the first device to negotiation ended; when the negotiation status of the first device is negotiation ended, determining whether the first device is a slave device.

[0063] Before the first device receives the offline notification message from the second device, its negotiation state is "up," meaning it has successfully negotiated and determined its device role: either a master device or a slave device. After receiving the offline notification message from the second device, the first device's negotiation state can be changed to "down," indicating that the negotiation has ended or has become invalid. When the first device's negotiation state is "negotiation ended," it can determine whether it is a slave device.

[0064] In one embodiment, if the offline notification message includes a preset type value, then after receiving the offline notification message sent by the second device, the step of modifying the negotiation status of the first device to "negotiation ended" may specifically include: after parsing the preset type value from the offline notification message, modifying the negotiation status of the first device to "negotiation ended".

[0065] The offline notification message can be a Notification Message TLVs (Notification Message Type Length Value, a type of notification message based on type, length, and value) based on the ICCP protocol message. The offline notification message can include a preset type value. When the first device parses the preset type value from the offline notification message, it will change the negotiation status of the first device to negotiation ended and determine whether the local device is a slave device.

[0066] Step 102: If the first device is a slave device, start the masterless state timer to start timing.

[0067] Both the first and second devices can be configured with a masterless state timer. When the first device receives an offline notification message and detects that it is a slave device, it starts the masterless state timer. The masterless state timer can be preset for a duration, allowing it to start a countdown after startup; alternatively, it can directly use the timer to count down the time since startup, stopping when the preset duration is reached. The preset duration can be set based on the maximum time required for device restart or configured manually.

[0068] In one embodiment, if the first device is the master device, the aggregated link interface media access control address of the first device remains unchanged, and the masterless state timer is not started for timing.

[0069] Step 103: If a negotiation message is received from the target device before the timeout period reaches the preset duration, then negotiate with the target device according to the negotiation message; wherein, the target device is a device in the current link or a device outside the current link.

[0070] Before the preset timeout period is reached, if the first device receives a negotiation message from the target device, it negotiates with the target device based on the negotiation message to determine which device is the master and which is the slave. The target device can be a device within the current link or a device outside the current link. For example, the target device could be the second device, which can resend the negotiation message to the first device after restarting; the target device can also be any other device outside the current link.

[0071] In one embodiment, the negotiation message may include the IP address of the control plane of the target device. The negotiation method may be: comparing the IP address value of the control plane of the first device with the IP address value of the control plane of the target device; if the IP address value of the control plane of the first device is greater than the IP address value of the control plane of the target device, the negotiation result is determined to be that the first device is the master device and the target device is the slave device; if the IP address value of the control plane of the first device is less than the IP address value of the control plane of the target device, the negotiation result is determined to be that the first device is the slave device and the target device is the master device.

[0072] Alternatively, the negotiation method can be as follows: compare the MAC address value of the first device with the MAC address value of the target device; if the MAC address value of the first device is greater than the MAC address value of the target device, then the negotiation result is determined to be that the first device is the master device and the target device is the slave device; if the MAC address value of the first device is less than the MAC address value of the target device, then the negotiation result is determined to be that the first device is the slave device and the target device is the master device.

[0073] The negotiation method between the first device and the target device can also be other custom methods. This embodiment of the invention does not limit the negotiation method.

[0074] Step 104: Determine the media access control address of the aggregation link interface of the first device based on the negotiation result.

[0075] After negotiation, the first device and the target device can obtain a negotiation result. The negotiation result includes: the first device is the master device and the target device is the slave device; or, the first device is the slave device and the target device is the master device. Based on the negotiation result, the first device modifies the MAC address of its aggregated link interface accordingly.

[0076] In one embodiment, if the first device is a slave device, the second device is a master device, the aggregation link interface media access control address of the first device is the same as the media access control address of the second device, and the negotiation message includes the media access control address of the target device, then step 104 may include the following sub-steps S11-S14:

[0077] Sub-step S11: If the negotiation result is that the first device is negotiated to be the master device and the target device is negotiated to be the slave device, then the aggregated link interface media access control address of the first device is modified to the media access control address of the first device.

[0078] If the first device is the slave device and the second device is the master device, then before negotiation, the aggregated link interface MAC address of the first device is the MAC address of the second device. If the negotiation result between the first device and the target device is that the first device is negotiated to become the master device and the target device is negotiated to become the slave device, the first device can change the aggregated link interface MAC address of its own device from the MAC address of the second device to the MAC address of its own device.

[0079] In sub-step S12, if the negotiation result is that the first device is negotiated to be a slave device and the target device is negotiated to be a master device, then it is determined whether the media access control address of the aggregated link interface of the first device is the same as the media access control address of the target device.

[0080] If the negotiation result between the first device and the target device is that the first device is negotiated to be the slave device and the target device is negotiated to be the master device, then the first device can determine whether the MAC address of the aggregated link interface of its own device is the same as the MAC address of the target device.

[0081] Sub-step S13: If the addresses are the same, then keep the media access control address of the aggregated link interface of the first device unchanged.

[0082] If the first device determines that its aggregated link interface MAC address is the same as the target device's MAC address, then the first device keeps its aggregated link interface MAC address unchanged. At this point, the target device is the second device. That is, the second device has completed its restart and resends a negotiation message to the first device, and the negotiation result remains the same: the first device is the slave device, and the second device is the master / backup. Therefore, the first device does not need to modify its aggregated link interface MAC address. In this embodiment, during the second device's restart process, the first device's aggregated link interface MAC address remains unchanged. Therefore, the problem of multiple modifications to the aggregated link interface MAC address during the second device's restart, leading to current aggregated link oscillations, can be avoided.

[0083] Sub-step S14: If they are different, modify the media access control address of the aggregation link interface of the first device to the media access control address of the target device.

[0084] If the first device determines that the MAC address of its aggregated link interface is different from the MAC address of the target device, then the first device modifies the MAC address of its aggregated link interface to that of the target device. In this case, the target device is a device outside the current link.

[0085] In this embodiment, during the restart process of the second device, the first device receives a negotiation message sent by a device outside the current link and determines that the first device has been renegotiationed as a slave device based on the negotiation message. At this time, the first device modifies the MAC address of the aggregated link interface of its own device to the MAC address of the target device, and the first device and the target device form a new aggregated link.

[0086] Normally, when the second device restarts, the first device modifies its aggregated link interface MAC address to its own MAC address. However, after the first device completes this modification, if it receives a negotiation message from a target device outside the current link and determines that the negotiation result is that the first device is negotiated as the slave and the target device as the master, the first device will again modify its aggregated link interface MAC address to the target device's MAC address. That is, during the second device restart process, the first device's aggregated link interface MAC address is modified twice, which can also cause link instability. Therefore, in this embodiment, when the second device restarts, the first device does not temporarily modify its own aggregated link interface MAC address but modifies it according to the negotiation result, thus reducing the number of times the first device's aggregated link interface MAC address is modified.

[0087] In one embodiment, if no negotiation message is received from the target device before the preset timeout period is reached, the media access control address of the aggregated link interface of the first device is modified to the media access control address of the first device.

[0088] If the first device does not receive a negotiation message within the preset time period, it may be due to a restart failure of the second device, or it may be that the second device no longer needs to combine with the first device to form an aggregated link. Therefore, at this time, the MAC address of the aggregated link interface of the first device can be changed back to the MAC address of the local device.

[0089] In one embodiment, after the first device receives the offline notification message sent by the second device and determines that the local device is a slave device or the local device is a master device, it modifies the relevant table entries, thereby improving the table entry switching rate and shortening the convergence time.

[0090] In this embodiment of the invention, after receiving a disconnection notification message from the second device, the first device determines whether it is a slave device. If the first device is a slave device, it starts a masterless state timer. Before the timer reaches a preset duration, if a negotiation message is received from the target device, the first device negotiates with the target device based on the negotiation message and determines the aggregated link interface media access control address based on the negotiation result. This method reduces the number of times the first device modifies the aggregated link interface media access control address when the second device in the link goes offline, thereby reducing link oscillation problems.

[0091] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0092] Reference Figure 3 The diagram illustrates a structural block diagram of a link maintenance device according to an embodiment of the present invention. The link includes a first device and a second device, the first device communicates with the second device, and the device is applied to the first device. The device may specifically include the following modules:

[0093] The device role determination module is used to determine whether the first device is a slave device after receiving the offline notification message sent by the second device.

[0094] The timing module is used to start a masterless state timer to keep track of time if the first device is a slave device.

[0095] The negotiation module is used to negotiate with the target device based on the negotiation message if it receives a negotiation message from the target device before the timeout period reaches a preset timeout period; wherein the target device is a device in the current link or a device outside the current link.

[0096] The first aggregation link interface media access control address determination module is used to determine the aggregation link interface media access control address of the first device based on the negotiation result.

[0097] Optionally, the negotiation module is specifically configured to: if the negotiation result is that the first device is negotiated as the master device and the target device is negotiated as the slave device, then modify the aggregated link interface media access control address of the first device to the media access control address of the first device; if the negotiation result is that the first device is negotiated as the slave device and the target device is negotiated as the master device, then determine whether the aggregated link interface media access control address of the first device is the same as the media access control address of the target device; if they are the same, then keep the aggregated link interface media access control address of the first device unchanged; if they are different, then modify the aggregated link interface media access control address of the first device to the media access control address of the target device.

[0098] Optionally, the device role determination includes:

[0099] The negotiation status determination submodule is used to modify the negotiation status of the first device to negotiation end after receiving the offline notification message sent by the second device;

[0100] The device role determination submodule is used to determine whether the first device is a slave device when the negotiation status of the first device is "negotiation ended".

[0101] Optionally, the offline notification message includes a preset type value, and the negotiation status determination submodule is specifically used to modify the negotiation status of the first device to negotiation ended after parsing the preset type value from the offline notification message.

[0102] Optionally, the device further includes:

[0103] The second aggregation link interface media access control address determination module is used to keep the aggregation link interface media access control address of the first device unchanged if the first device is the master device, and not to start the masterless state timer for timing.

[0104] Optionally, the device further includes:

[0105] The third aggregation link interface media access control address determination module is used to modify the aggregation link interface media access control address of the first device to the media access control address of the first device if no negotiation message is received from the target device before the timeout period reaches the preset timeout period.

[0106] Optionally, the preset duration is preset based on the maximum time required for the device to restart.

[0107] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0108] Reference Figure 4 The diagram shows a structural block diagram of an electronic device 30 provided in an embodiment of the present invention. The electronic device 30 includes:

[0109] The processor 301, the memory 302, and the computer program 3021 stored in the memory 302 and capable of running on the processor 301. When the computer program 3021 is executed by the processor 301, it implements the various processes of the above-described link maintenance method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0110] Reference Figure 5 The diagram shows a structural block diagram of a computer-readable storage medium 40 provided in an embodiment of the present invention. The computer-readable storage medium 40 stores a computer program 401. When the computer program 401 is executed by a processor, it implements the various processes of the above-described link maintenance method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0111] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0112] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0113] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0114] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0116] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0117] Finally, 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 terminal device 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 terminal device. 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 terminal device that includes said element.

[0118] The foregoing has provided a detailed description of the link maintenance method, apparatus, electronic device, and storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A link maintenance method, characterized in that, The link includes a first device and a second device, the first device communicates with the second device, and the method is applied to the first device, the method comprising: After receiving the offline notification message sent by the second device, determine whether the first device is a slave device; If the first device is a slave device, then start the masterless state timer to keep track of the time; If a negotiation message is received from the target device before the preset timeout period is reached, negotiation is conducted with the target device based on the negotiation message; wherein, the target device is a device in the current link or a device outside the current link; The media access control address of the aggregated link interface of the first device is determined based on the negotiation results. If the first device is a slave device, then the second device is a master device. The aggregated link interface media access control address of the first device is the same as the media access control address of the second device. The negotiation message includes the media access control address of the target device. Determining the aggregated link interface media access control address of the first device based on the negotiation result includes: If the negotiation result is that the first device is negotiated to be the master device and the target device is negotiated to be the slave device, then the aggregated link interface media access control address of the first device is modified to the media access control address of the first device. If the negotiation result is that the first device is negotiated to be a slave device and the target device is negotiated to be a master device, then it is determined whether the media access control address of the aggregated link interface of the first device is the same as the media access control address of the target device. If they are the same, then the media access control address of the aggregated link interface of the first device remains unchanged; If they are different, the media access control address of the aggregation link interface of the first device is modified to the media access control address of the target device.

2. The method according to claim 1, characterized in that, The step of determining whether the first device is a slave device after receiving the offline notification message sent by the second device includes: After receiving the offline notification message from the second device, the negotiation status of the first device is changed to negotiation ended; When the negotiation status of the first device is "negotiation ended", determine whether the first device is a slave device.

3. The method according to claim 2, characterized in that, The offline notification message includes a preset type value. The step of modifying the negotiation status of the first device to "negotiation ended" after receiving the offline notification message from the second device includes: Once the preset type value is parsed from the offline notification message, the negotiation status of the first device is changed to negotiation ended.

4. The method according to claim 1, characterized in that, The method further includes: If the first device is the master device, then the media access control address of the aggregated link interface of the first device remains unchanged, and the masterless state timer is not started for timing.

5. The method according to claim 1, characterized in that, The method further includes: If no negotiation message is received from the target device before the preset timeout period is reached, the media access control address of the aggregated link interface of the first device will be modified to the media access control address of the first device.

6. The method according to claim 1, characterized in that, The preset duration is preset based on the maximum time required for the device to restart.

7. A link maintenance device, characterized in that, The link includes a first device and a second device, the first device communicating with the second device, and the device being applied to the first device, the device comprising: The device role determination module is used to determine whether the first device is a slave device after receiving the offline notification message sent by the second device. The timing module is used to start a masterless state timer to keep track of time if the first device is a slave device. The negotiation module is used to negotiate with the target device based on the negotiation message if it receives a negotiation message from the target device before the timeout period reaches a preset timeout period; wherein the target device is a device in the current link or a device outside the current link. The first aggregated link interface media access control address determination module is used to determine the aggregated link interface media access control address of the first device based on the negotiation result. The negotiation module is specifically used for: if the negotiation result is that the first device is negotiated as the master device and the target device is negotiated as the slave device, then modifying the aggregated link interface media access control address of the first device to the media access control address of the first device; if the negotiation result is that the first device is negotiated as the slave device and the target device is negotiated as the master device, then determining whether the aggregated link interface media access control address of the first device is the same as the media access control address of the target device; if they are the same, then keeping the aggregated link interface media access control address of the first device unchanged; if they are different, then modifying the aggregated link interface media access control address of the first device to the media access control address of the target device.

8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the link maintenance method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the link maintenance method as described in any one of claims 1-6.