Title of Invention: Clock Port Attribute Recovery Method, Device, and System Abstract: A clock port attribute recovery method includes a network device setting a value of a port attribute of a clock port of the network device to a first value based on the clock port not receiving any one of three types of clock messages: N synchronization messages, follow-up messages, and delay response messages within a timeout interval, where the first value indicates that a message is lost on the clock port. Based on a case that a recovery condition is met, the network device sets the value of the port attribute of the clock port to a second value, where the second value indicates that a status of the clock port is that the message is not lost. Detailed Description: CROSS-REFERENCE TO RELATED APPLICATIONS This is a continuation of International Patent Application No. PCT/CN2021/070507 filed on Jan. 6, 2021, which claims priority to Chinese Patent Application No. 202010011547.7 filed on Jan. 6, 2020 and Chinese Patent Application No. 202010136536.1 filed on Mar. 2, 2020. All of the aforementioned patent applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD This disclosure relates to the communication field, and a clock port attribute recovery method, a device, and a system. BACKGROUND When a distributed system is increasingly used in communication and network applications, clock synchronization becomes increasingly important. As a clock synchronization mode, a Network Time Protocol (NTP) is widely used. In addition, to meet increasing requirements for high-precision time synchronization, the Institute of Electrical and Electronics Engineers (IEEE) officially released the IEEE 1588v2 standard (IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems) in 2008. The standard is a precision clock synchronization protocol standard for a network measurement and control system. To meet a time synchronization requirement of a wireless base station, a mobile bearer network may transfer precise time to each base station by using an IEEE 1588v2 protocol, to meet the time synchronization requirement of the base station. A device in a network usually selects an optimal 1588 clock source by using a best master clock (BMC) algorithm for tracking. The device determines, by using a BMC source selection algorithm, that a status of a port on the device is a master clock port, a slave clock port, or a passive clock port. When determining a status of a clock port by using the BMC algorithm, the device calculates a port dataset of the clock port, and information of the port dataset of the clock port is related to an attribute of the clock port. Therefore, ensuring correctness of a clock port attribute on a network device is key to ensuring correctness of clock source tracking. SUMMARY Embodiments of this disclosure provide a clock port attribute recovery method, a device, and a system, to resolve a technical problem that a clock port status may be incorrect because a clock port attribute cannot be recovered. Technical solutions are as follows. According to a first aspect, a clock port attribute recovery method is provided. The method may be performed by a first network device, and the method includes the following steps. The first network device sets a value of a port dataset signal fail attribute of a clock port to a first value based on a case that the clock port does not receive N clock messages of a first type within a timeout interval, where the clock port is connected to a master clock port of a second network device, the clock port is a slave port or a passive port, the clock message of the first type is any one of the following three types of clock messages: a synchronization message, a follow-up message, and a delay response message, N is a positive integer greater than 0, and the first value indicates that a message is lost on the clock port, and after setting the value of the port dataset signal fail attribute to the first value, the first network device sets the value of the port dataset signal fail attribute to a second value when the first network device determines that a recovery condition is met, to indicate that no message is lost on the clock port. A method in which the network device recovers the value of the port dataset signal fail attribute of the clock port to the second value based on the recovery condition after setting the value to the first value based on message loss can help keep the value of the port dataset signal fail attribute correct, so that a status of the clock port can be kept normal, and correctness of a clock tracking relationship is ensured. In a possible design, that the first network device determines that a recovery condition is met includes that the first network device receives a configuration instruction, where the configuration instruction is used to instruct the first network device to set the value of the port dataset signal fail attribute to the second value. After a network administrator determines that the clock port of the first network device has received a message sent by the connected master clock port, the administrator may modify the value of the port dataset signal fail attribute to the second value by using the configuration instruction. This can reduce impact on the network device, and directly and quickly recover the status of the port. In a possible design, that the first network device determines that a recovery condition is met includes that the first network device receives M synchronization messages and M follow-up messages within first time, where M is a positive integer greater than 0. The network device determines, by determining that a synchronization message and a follow-up message that meet a requirement are received, that the recovery condition is met. This helps reduce workload of the administrator, and automatically determine that the recovery condition is met. In a possible design, the clock message of the first type is a synchronization message, and that the first network device determines that a recovery condition is met includes that the first network device receives M synchronization messages within second time, or the clock message of the first type is a follow-up message, and that the first network device determines that a recovery condition is met includes that the first network device receives M follow-up messages within the second time, where M is a positive integer greater than 0. The network device determines, by determining that a clock message that corresponds to the first type and that meets a requirement is received, that the recovery condition is met. This helps reduce workload of the administrator, and automatically determine that the recovery condition is met. In a possible design, that the first network device determines that a recovery condition is met includes that the first network device receives a second message, where the second message indicates that a delay response message loss state of the clock port is recovered. After the attribute value of the clock port is changed to the first value, the clock port does not send a delay request message to the corresponding master clock port. Therefore, the clock port no longer receives a delay response message. The administrator may deliver a message by using a management system, or the administrator may deliver a configuration instruction directly through a management interface of the device, to indicate that the delay response message loss state of the port is recovered. In this way, it is determined that the recovery condition is met. In a possible design, that the first network device sets a value of a port dataset signal fail attribute of a clock port to a first value based on a case that the clock port does not receive N clock messages of a first type within a timeout interval includes that the first network device generates a first event based on the case that the clock port does not receive the N clock messages of the first type within the timeout interval, and the first network device sets the value of the port dataset signal fail attribute to the first value based on the first event. By generating a corresponding message loss event after a message is lost, the network device may record related information of the message loss, for example, port information and a type of the lost message. The network device may also change the value of the port attribute based on the event. This is more helpful in recording a related fault and a related change on the network device. In a possible design, that the first network device sets the value of the port dataset signal fail attribute to a second value when the first network device determines that a recovery condition is met includes, when the first network device determines that the recovery condition is met, the first network device determines that the first loss event is eliminated, and the first network device sets the value of the port dataset signal fail attribute to the second value based on a case that the first event is eliminated. When the network device determines that the recovery condition is met, for example, a corresponding message is received or a configuration instruction is received, the network device may determine that the first loss event is eliminated, and recover the value of the port attribute by determining that the first loss event is eliminated. Further, information recorded in the first loss event may be modified. This helps record information such as fault recovery on the network device. In a possible design, that the first network device sets the value of the port dataset signal fail attribute to the second value based on a case that the first event is eliminated includes that the first network device sets, based on the case that the first event is eliminated, a value of a port parameter corresponding to the first event of the clock port to a third value, where the third value indicates that a clock message corresponding to the port parameter is not lost, and the first network device sets the value of the port dataset signal fail attribute to the second value based on a case that the value of the clock port parameter is the third value. In a possible design, the first event includes an identifier of the first type. In a possible design, that the first network device sets the value of the port dataset signal fail attribute to a second value when the first network device determines that a recovery condition is met includes that the first network device sets, based on a case that it is determined that the recovery condition is met, a value of a port parameter of the clock port corresponding to the first type to a third value, where the third value indicates that a clock message corresponding to the port parameter is not lost, and the first network device sets the value of the port dataset signal fail attribute to the second value based on a case that the value of the clock port parameter is the third value. In the foregoing descriptions, a port parameter corresponding to a message loss event is further defined on the network device, and a value of the port parameter is updated based on event information, so that a loss status of each type of message on the network device can be accurately recorded. This helps the network device recover the value of the port attribute based on the port parameter. A clearer record is obtained, and determining is easy. In a possible design, after that the first network device sets the value of the port dataset signal fail attribute of the clock port to the first value, the method further includes that the first network device sets a value of a clock reference source Erbest dataset of the clock port to null based on a case that the value of the port dataset signal fail attribute is the first value. In a possible design, if the value of the port dataset signal fail attribute is the first value, the first network device generates a status determining event, where the status determining event is used to indicate the first network device to determine a status of the clock port. In a possible design, after that the first network device sets the value of the port dataset signal fail attribute to the second value, the method further includes that the first network device sets the value of the Erbest dataset to non-null. In a possible design, before the first network device sets the value of the port dataset signal fail attribute to the first value, the value of the port dataset signal fail attribute is the second value. In a possible design, the clock message is a Precision Time Protocol (PTP) clock message. In the foregoing descriptions, in a manner of changing and recovering the value of the port attribute of the clock port, the network device may flexibly adjust a value of a port dataset on the network device to null or non-null, so that the network device more accurately determines the port status based on the value of the port dataset by using a BMC algorithm, to ensure correctness of the clock tracking relationship in this network. According to a second aspect, a first network device is provided. The network device includes a processing unit and a first communication unit. The processing unit is configured to set a value of a port dataset signal fail attribute of the first communication unit to a first value based on a case that the first communication unit does not receive N clock messages of a first type within a timeout interval, where the clock message of the first type is any one of the following three types of clock messages: a synchronization message, a follow-up message, and a delay response message, N is a positive integer greater than 0, and the first value indicates that a message is lost on the first communication unit. The first communication unit is configured to communicate with a master clock port of a second network device, where a clock port status of the first communication unit is a slave port or a passive port. After the processing unit sets the value of the port dataset signal fail attribute to the first value, the processing unit is further configured to set the value of the port dataset signal fail attribute to a second value when it is determined that a recovery condition is met, where the second value indicates that no message is lost on the first communication unit. In a possible design, the second communication unit is configured to receive a configuration instruction, where the configuration instruction is used to instruct the processing unit to set the value of the port dataset signal fail attribute to the second value, and the processing unit is further configured to determine, based on a case that the second communication unit receives the configuration instruction, that the recovery condition is met. In a possible design, the processing unit is further configured to determine, based on a case that the first communication unit receives M synchronization messages and M follow-up messages within first time, that the recovery condition is met, where M is a positive integer greater than 0. In a possible design, the clock message of the first type is a synchronization message, and the processing unit is further configured to determine, based on a case that the first communication unit receives M synchronization messages within second time, that the recovery condition is met, or the clock message of the first type is a follow-up message, and the processing unit is further configured to determine, based on a case that the first communication unit receives M follow-up messages within the second time, that the recovery condition is met, where M is a positive integer greater than 0. In a possible design, the processing unit is further configured to determine, based on a case that the second communication unit receives a second message, that the recovery condition is met, where the second message indicates that a delay response message loss state of the first communication unit is recovered. In a possible design, the processing unit is further configured to generate a first event based on the case that the first communication unit does not receive the N clock messages of the first type within the timeout interval, and the processing unit is further configured to set the value of the port dataset signal fail attribute to the first value based on the first event. In a possible design, the processing unit is further configured to generate a first event based on the case that the first communication unit does not receive the N clock messages of the first type within the timeout interval, and the processing unit is further configured to set the value of the port dataset signal fail attribute to the first value based on the first event. In a possible design, the processing unit is further configured to determine, based on a case that it is determined that the recovery condition is met, that the first loss event is eliminated, and the processing unit is further configured to set the value of the port dataset signal fail attribute to the second value based on a case that the first event is eliminated. In a possible design, the processing unit is further configured to set, based on a case that the first event is eliminated, a value of a port parameter corresponding to the first event of the communication unit to a third value, where the third value indicates that a clock message corresponding to the port parameter is not lost, and the processing unit is further configured to set the value of the port dataset signal fail attribute to the second value based on a case that the value of the clock port parameter is the third value. In a possible design, the processing unit is further configured to set, based on a case that it is determined that the recovery condition is met, a value of a port parameter of the first communication unit corresponding to the first type to a third value, where the third value indicates that a clock message corresponding to the port parameter is not lost, and the processing unit is further configured to set the value of the port dataset signal fail attribute to the second value based on a case that the value of the clock port parameter is the third value. In a possible design, the processing unit is further configured to set a value of a clock reference source Erbest dataset of the clock port to null based on a case that the value of the port dataset signal fail attribute is the first value. In a possible design, when the value of the port dataset signal fail attribute is the first value, the processing unit is further configured to generate a status determining event, where the status determining event is used to indicate the processing unit to determine a status of the clock port. In a possible design, the processing unit is further configured to set the value of the Erbest dataset to non-null. In a possible design, before the processing unit sets the value of the port dataset signal fail attribute to the first value, the value of the port dataset signal fail attribute is the second value. According to a third aspect, an embodiment of this disclosure provides another network device, including at least one processor. The at least one processor is coupled to at least one memory. The at least one processor is configured to execute a computer program or instructions stored in the at least one memory, so that the network device performs the method according to the first aspect. According to a fourth aspect, a chip is provided, including a processor and an interface circuit. The interface circuit is configured to receive instructions and transmit the instructions to the processor. The processor is configured to perform the method according to the first aspect. According to a fifth aspect, a network system is provided. The system includes a first network device and a second network device. The first network device is the first network device according to the second aspect or the network device provided in the third aspect. The second network device includes a communication interface. The second network device communicates with the first network device through the communication interface. A clock port status of the communication interface is a master clock port. According to a sixth aspect, an embodiment of this disclosure further provides a computer-readable storage medium, including a computer program. When the computer program is run on a computer, the computer is enabled to perform the method according to the first aspect. BRIEF DESCRIPTION OF DRAWINGS FIG. 1 is a schematic diagram of a scenario of a clock tracking relationship according to an embodiment of this disclosure; FIG. 2A is a schematic diagram of a clock tracking relationship according to an embodiment of this disclosure; FIG. 2B is a schematic diagram of a clock tracking relationship according to an embodiment of this disclosure; FIG. 3A is a schematic flowchart of clock synchronization according to an embodiment of this disclosure; FIG. 3B is a schematic flowchart of clock synchronization according to an embodiment of this disclosure; FIG. 4 is a flowchart of a clock port status recovery method according to an embodiment of this disclosure; FIG. 5A is a flowchart of a clock port status recovery method according to an embodiment of this disclosure; FIG. 5B is a flowchart of a clock port status recovery method according to an embodiment of this disclosure; FIG. 6A is a flowchart of a clock port status recovery method according to an embodiment of this disclosure; FIG. 6B is a flowchart of a clock port status recovery method according to an embodiment of this disclosure; FIG. 7 is a schematic diagram of a structure of an apparatus for implementing clock port status recovery according to an embodiment of this disclosure; FIG. 8 is a schematic diagram of a structure of an apparatus for implementing clock port status recovery according to an embodiment of this disclosure; and FIG. 9 is a schematic diagram of a structure of an apparatus for implementing clock port status recovery according to an embodiment of this disclosure. DESCRIPTION OF EMBODIMENTS Terms used in embodiments of this disclosure are only used to explain specific embodiments of this disclosure, but are not intended to limit this disclosure. In a disclosure scenario of IEEE 1588, when an attribute value of a clock port of a device in a network changes, a status of the clock port changes, and therefore a clock tracking relationship changes. Consequently, the device selects an incorrect clock source for tracking. The following briefly describes terms involved in this disclosure. In this disclosure, terms such as “first”, “second”, and “third” are used to distinguish between same items or similar items that have a basically same usage and function. It should be understood that “first”, “second”, and “third” do not have a dependency relationship in logic or timing, and do not limit a quantity or an execution sequence either. In this disclosure, when a value of an attribute or another message is true or false, it indicates that a meaning expressed by the value of the attribute or the message is true or false. A specific manifestation may be using one or more flag bits or another form for expression. This is not limited in this disclosure. In the telecommunications field, the International Telecommunication Union (ITU)—Telecommunication Standardization Sector (ITU-T) defines two standards, namely, ITU-T G.8275.1 and ITU-T G.8275.2, based on an IEEE 1588v2 protocol and with reference to a unique scenario in the telecommunications field, where G indicates a series of recommended standards in a chapter related to transmission systems and media, digital systems and networks in the ITU-T. The ITU-T G.8275.1 is applied to a mobile bearer network in which all devices support a 1588 protocol. The ITU-T G.8275.2 is applied to a mobile bearer network in which some devices support the 1588 protocol. The ITU-T G.8275.1 and the ITU-T G.8275.2 have a same principle for selection of a 1588 reference clock source. For example, in a scenario in which a device has a plurality of 1588 clock input sources, an optimal 1588 clock source needs to be selected by using a BMC algorithm for tracking, to determine a master clock port, a slave clock port, or a passive clock port of the device. The master clock port, the slave clock port, and the passive clock port may also be referred to as a master port, a slave port, and a passive port. A clock tracking relationship formed by determining a clock port of a device in a network by using the device may be shown in FIG. 1. FIG. 1 is a schematic diagram of a scenario of a clock tracking relationship according to this disclosure. FIG. 1 shows a network including four network devices. In the network, a network device 101 is connected to a clock source, the network device 101 is connected to a network device 102 and a network device 103, the network device 102 is connected to the network device 101 and a network device 104, the network device 103 is connected to the network device 101 and the network device 104, and the network device 104 is connected to the network device 101 and the network device 103. A master port determined by the network device 101 is a port 1. A slave port determined by the network device 102 is a port 2, and a master port determined by the network device 102 is a port 3. A slave port determined by the network device 103 is a port 4, and a master port determined by the network device 103 is a port 5. A slave port determined by the network device 104 is a port 6, a master port determined by the network device 104 is a port 7, and a passive port determined by the network device 104 is a port 8. A clock tracking relationship formed by the network is as follows: the network device 101→the network device 102→the network device 104, and the network device 101→the network device 103. The tracking relationship may be simply shown in FIG. 2A. A second network device receives, through a slave port (the port 2), a clock message sent by a first network device through a port (the port 1), and responds to the clock message, to synchronize clock information. Clock messages sent between devices mainly include an announce message, a synchronization (sync) message, a follow-up (follow_up) message, a delay request (delay_req) message, and a delay response (delay_resp) message. The announce message is mainly used by a BMC source selection algorithm to determine whether a port status is a master state, a slave state, or a passive state. When a device is recently powered on, a port status is an initializing state. Then ports send announce messages to each other. After the device determines a port status (master, slave, or the like) by using the BMC source selection algorithm, only a master port sends an announce message, and a slave port does not send an announce message. When information of an announce message received by the slave port changes or the slave port fails to receive an announce message, a port status is recalculated and a status of each port is updated in the BMC source selection algorithm. The sync message, the follow_up message, the delay_req message, and the delay_resp message are mainly used for time synchronization. There are mainly two manners of synchronizing time information between network devices: a one-step mode shown in FIG. 3A and a two-step mode shown in FIG. 3B. The following provides descriptions mainly with reference to a master port and a slave port. Interaction between the master port and a passive port is also similar to this, and details are not described again. A detailed process is as follows. S301: The master port sends a sync message to the slave port, and records sending time T1 when sending the sync message. If the master port is configured as a one-step mode, T1 is filled in a field of the sync message, and the sync message is sent to the slave port. S302: After receiving the sync message, the slave port records receiving time T2. S303: If the master port is configured as a two-step mode, the master port immediately sends a follow up message after sending the sync message. In this case, T1 is filled in a field of the follow_up message, and the follow_up message is sent to the slave port. In the foregoing descriptions, S302 may be performed before S303, or S302 may be performed after S303. S304: After the slave port is configured as an End-to-End (E2E) mechanism, the slave port sends a delay_req message to the master port, and records sending time T3. S305: After receiving the delay_req message, the master port records receiving time T4, fills T4 in a field of a delay_resp message, and then sends the delay_resp message to the slave port. S306: After receiving the delay_resp message, the slave port obtains T4. Therefore, a time error (TE) between the slave port and the master port may be calculated based on T1, T2, T3, and T4. The time error may be obtained by using the following formula: TE=[(t2−t1)−(t4−t3)]/2. A packet timing signal fail (PTSF) function is further defined in a G.8275.2 standard. The function is used when a message is lost on a clock port, and includes the following two events: (1) PTSF-loss synchronization (PTSF-losssync) event: When the slave port detects that any one of three types of messages (the sync message, the follow up message, or the delay_resp message) is lost, the slave port needs to generate a PTSF-losssync event. (2) PTSF-unusable event: When detecting that a time error TE calculated based on timestamps generated by an input sync message, follow up message, and delay_resp message exceeds a requirement, the slave port generates a PTSF-unusable event. When (1) or (2) occurs, the network device sets a value of a port dataset signal fail (portDS.SF) attribute of the slave port to true. The value of portDS.SF is further used to indicate whether the port fails. When the value of portDS.SF is true, a clock reference source (Erbest) dataset of the slave port is set to null. Then a BMC algorithm is triggered to recalculate a port status, and the port is set to a master state, so that the clock port cannot participate in clock source selection. To be specific, a status of the port 2 of the second network device in FIG. 2A changes to a master port state shown in FIG. 2B. The port 2 of the second network device changes to the master state, and after a fault is rectified, the port 2 continues to receive a sync message and a follow up message that are sent by the first network device (the follow_up message is received only when the clock tracking relationship is configured as the two-step mode). However, in this case, because the port 2 does not send a delay_req message to the port 1 of the first network device, the first network device does not send a delay_resp message to the port 2 of the second network device, and the port 2 of the second network device cannot receive the delay_resp message. Therefore, a PTSF-losssync event on the port 2 of the second network device cannot be eliminated, and a value of portDS.SF of a port dataset of the port is still true. To be specific, if no special technical means is used, when the value of portDS.SF of the port dataset of the port is true, a value of an Erbest dataset of the port is not set to non-null. Consequently, the port cannot be recovered to a slave state again when the device determines a port status by using the BMC algorithm. However, if portDS.SF is false, the device does not set the reference source dataset Erbest of the port to a null set. Therefore, clock source selection of the port is not affected. The foregoing example is described only by using the slave port, but is also applicable to a passive port. To be specific, when a value of portDS.SF of a clock port is true, the port cannot be used as one of ports for clock source selection, and the clock tracking relationship in the network is affected. In view of this, a technical solution is provided in the present disclosure. In addition to the 1588 standard ITU-T G.8275.2 for telecommunications, the technical solution may be applied to the 1588 standard ITU-T G.8275.1 for telecommunications, and may be further applied to the 1588 base protocol IEEE 1588, the 1588 standard IEEE C37.238 in the telecommunications field, the 1588 standard SMPTE 2059 of the Society of Motion Picture and Television Engineers (SMPTE), and the like. With reference to the scenario shown in FIG. 1, the following describes, by using an example, several possible implementations of a method provided in an embodiment of this disclosure. The network device 104 is used as a network device herein for description. As shown in FIG. 4, a method for implementing clock port status recovery includes the following steps. S401: The network device detects that a message is lost on a clock port within a timeout interval. If the network device 104 determines that a clock port of the network device 104, for example, the port 6 or the port 8, does not receive N clock messages of a first type within a specific timeout interval, the network device 104 generates a message loss event. The timeout interval may be a specified specific timeout interval, for example, the specified timeout interval is 6 seconds (s), or may be a multiple of a time interval for receiving a specific type of message, for example, when time for receiving a specific type of message is 3 s, the timeout interval may be three times the receiving time interval, in other words, is finally 9 s. N may be a specified quantity of lost clock messages. For example, the value may be a quantity configured on the network device 104 by a network administrator by delivering a configuration instruction by using a management system or a management interface, or specified in a 1588 clock protocol, or is a specific value preset when the network device 104 is manufactured and delivered from a factory. A value of N is an integer greater than or equal to 1. In some cases, a value range of N may be 3≤N≤255. The first type may be any message type in a synchronization message, a follow-up message, and a delay response message. When a clock synchronization operating mechanism on the network device 104 is a one-step mode, the follow-up message does not need to be considered. When the clock synchronization operating mechanism configured on the network device is a two-step mode, the follow-up message needs to be considered. To be specific, in the one-step mode, if the network device determines that any slave or passive port on the network device does not receive N messages of one of the following two types within the timeout interval: a synchronization message and a delay response message, it is determined that a message is lost on the clock port. Alternatively, in the two-step mode, if the network device determines that any slave or passive port on the network device does not receive N messages of one of the following three types within the timeout interval: a synchronization message, a follow-up message, and a delay response message, it is determined that a message is lost on the clock port. In the following descriptions, in this embodiment of this disclosure, when the network device recovers an attribute value of the clock port, a received message needs to be consistent with that herein. To be specific, in the one-step mode, only a status of whether a synchronization message and a delay response message are received is determined, or in the two-step mode, a status of whether a synchronization message, a follow-up message, and a delay response message are received is determined. This is not described in detail again in other embodiments of this disclosure. Optionally, when the network device detects that a message is lost on a clock port of the device, the network device generates a message loss event. In an example, the message loss event is a PTSF-losssync event. The message loss event indicates that a message is lost on the clock port, and a type of a lost clock message may be any one or more of a synchronization message, a follow-up message, or a delay response message. Optionally, the message loss event further includes an indication of the type of the lost clock message. In an example, the message loss event includes a field indicating the type of the lost clock message, and the field indicates an event that is lost on the clock port. In another example, the message loss event may include three type fields: a synchronization message type, a follow-up message type, and a delay response type. When a value of a corresponding type field is set to a special value, for example, 1, it is considered that a clock message of the type is lost. Optionally, when another type of clock message is further lost on the clock port after a first type of clock message is lost on the clock port, the network device may update information of a second type field of the loss event to the event, or generate another message loss event. S403: The network device sets a value of a port attribute of the clock port to a first value based on a case that it is detected that a message is lost on the clock port. The network device 104 sets a value of portDS.SF of the port 6 to the first value based on a case that a message is lost on the port 6. Optionally, the network device 104 may alternatively set the value of portDS.SF of the port to the first value based on the message loss event. The network device 104 may set the value of portDS.SF of the port to the first value while generating the message loss event or after generating the message loss event. In an example, the first value is true. Optionally, the clock port of the network device further has a port parameter corresponding to a message type. When the network device detects that a message is lost on the clock port of the device, the network device sets a value of the port parameter to true, to indicate that a message of a corresponding type is lost on the clock port. Optionally, the network device may alternatively set the value of the port parameter to true based on the message loss event. S405: After the value of portDS.SF is set to the first value, the network device sets the value of portDS.SF of the clock port to a second value when determining that a recovery condition is met. The recovery condition includes, when the port 6 of the network device 104 receives clock messages of both of the following two types of messages: a synchronization message and a follow-up message, and continuously receives M clock messages of each type, the network device or a management and maintenance person determines that a corresponding message loss event is recovered. M may be a specified quantity of lost clock messages. For example, the value may be a quantity configured on the network device by a network administrator or specified in a 1588 clock protocol, or a specific value preset when the network device is manufactured and delivered from a factory. A value of M is an integer greater than or equal to 1. In some cases, a value range of M may be 2≤M≤255. Being continuously received means that, when a message transmission rate of a master port tracked by the port 6 is one message per second, it is considered that the recovery condition is met when the port 6 receives two synchronization messages within two consecutive seconds and receives two follow-up messages within two consecutive seconds, and the synchronization messages and the follow-up messages are received within a determined message transmission interval, for example, two synchronization messages and two follow-up messages are received within four seconds. In an example, the port attribute is configurable. When the management and maintenance person determines that the network device meets the recovery condition, the administrator may deliver a configuration instruction to the network device through configuration, where the configuration instruction instructs the network device 104 to set the value of the port attribute of the port 6 to the second value. Optionally, after the network device generates the message loss event when detecting that the message is lost on the clock port, and modifies the value of portDS.SF to the first value based on the message loss event, the message loss event is eliminated after the network device receives the foregoing messages. The network device may set the value of portDS.SF of the clock port to the second value based on a case that the message loss event is eliminated. In an example, the clock port has two configurable port parameters, for example, a port signal fail-synchronization message loss (portDS.SF.losssync) attribute and a port signal fail-unusable (portDS.SF.unusable) attribute. Values of the port parameters may be any value capable of indicating true or false. When a PTSF-losssync event occurs and after a fault is rectified, portDS.SF.losssync of the port may be set to false through manual configuration. When a PTSF-unusable event occurs and after a fault is rectified, portDS.SF.unusable of the port may be set to false through manual configuration. When both portDS.SF.losssync and portDS.SF.unusable of the port are false, the network device 104 automatically sets the value of the port attribute portDS.SF to false. The device no longer sets a reference source dataset Erbest of the port 6 to a null set. Therefore, a BMC algorithm is triggered to re-update a status of the port to a slave state or another state. In an example, the second value is false. Optionally, when the network device further has a port parameter corresponding to the message type or the message loss event, the network device sets a value of a corresponding port parameter to false after receiving the foregoing messages. The network device may set the value of portDS.SF of the clock port to the second value based on a case that values of all port parameters are false. In this case, because the clock port may receive the synchronization message and the follow-up message when the fault is rectified, after the clock port receives the synchronization message and the follow-up message, the network device may automatically change values of port parameters corresponding to the message types to false. However, because the status of the clock port has changed to master, the clock port does not send a delay request message to a master port connected to the clock port, and the clock port does not receive a delay response message. In this case, a corresponding port parameter may be defined for the delay response message. When the delay response message is lost on the clock port, a value of this parameter is set to true. After the value of portDS.SF of the clock port is modified to true due to the loss of the delay response message, the network administrator may modify the value of the parameter to false by default. In this way, the network device may automatically modify the value of portDS.SF of the clock port to false after receiving the synchronization message and/or the follow-up message. Certainly, the network administrator may alternatively configure some policies to automatically modify the value of the port parameter to false. Still with reference to the scenario shown in FIG. 1, the following describes, by using an example, several possible implementations of a method provided in an embodiment of this disclosure. The network device 104 is used as a network device herein for description. A method in a method embodiment shown in FIG. 5A is similar to the method in the method embodiment shown in FIG. 4. For related content, refer to the descriptions of FIG. 4. Different parts are described in detail herein. As shown in FIG. 5A, a method for implementing clock port status recovery includes the following steps. S501: The network device detects that a clock message of a first type is lost on a clock port, and generates a first message loss event. If the network device 104 detects that the clock message of the first type is lost on a slave port or a passive port of the network device 104, for example, the port 6 or the port 8, the network device 104 generates the first message loss event. As described in S401, that the network device 104 detects that the clock message of the first type is lost may include detecting that the port 6 or the port 8 of the network device 104 does not receive N clock messages of the first type within a timeout interval. For details, refer to S401. Details are not described herein again. In an example, when the first type is a synchronization message, the network device 104 generates the first message loss event. The message loss event is a loss synchronization event, and may also be referred to as a PTSF-loss synchronization event (PTSF-loss-sync-message). The event is used to indicate that a synchronization message is lost on the port 6 or the port 8. In another example, when the first type is a follow-up message, the network device 104 generates the first message loss event. The message loss event is a loss follow-up event, and may also be referred to as a PTSF-loss follow-up event (PTSF-loss-follow-up-message). The event is used to indicate that a follow-up message is lost on the port 6 or the port 8. In another example, when the first type is a delay response message, the network device 104 generates the first message loss event. The message loss event is a loss delay response event, and may also be referred to as a PTSF-loss delay response event (PTSF-loss-delay-resp-message). The event is used to indicate that a delay response message is lost on the port 6. S503: The network device sets a value of a port attribute of the clock port to a first value based on the first message loss event. For example, the port attribute is a PTSF attribute. When the network device 104 generates a PTSF-loss synchronization event for the port 6, or after the network device 104 receives a PTSF-loss synchronization event generated by the port 6 or the port 8, the network device 104 sets a value of the PTSF attribute of the port 6 to true. S505 (Optional): If the network device further detects that a clock message of a second type is further lost on the clock port, the network device generates a second message loss event. In an example, N clock messages of the second type are further lost on the port 6 or the port 8 of the network device 104, and the clock messages of the second type are clock messages different from those of the first type. S507 (Optional): If the network device further detects that a clock message of a third type is further lost on the clock port, the network device generates a third message loss event. In an example, N clock messages of the third type are further lost on the port 6 or the port 8 of the network device 104, and the clock messages of the third type are clock messages different from those of the first type and the second type. Occurrence time of steps S505 and S507 and step S501 is not limited. To be specific, the clock message of the first type may be any one of a synchronization message, a follow-up message, and a delay response message, the clock message of the second type is any one of the three types of clock messages that is different from the first type, and the clock message of the third type is one of the three types of clock messages that is different from the first type and the second type. An occurrence sequence of various types of message loss is not limited. When any type of clock message loss event occurs, the network device 104 may set the value of the PTSF port attribute to true. S509: The clock port of the network device receives the clock message of the first type, and the network device determines that the first message loss event is eliminated. In an example,
{'application_number': '<application-reference appl-type="utility">\n<document-id>\n<country>US</country>\n<doc-number>17857412</doc-number>\n<date>20220705</date>\n</document-id>\n</application-reference>', 'publication_number': '<publication-reference>\n<document-id>\n<country>US</country>\n<doc-number>20220337384</doc-number>\n<kind>A1</kind>\n<date>20221020</date>\n</document-id>\n</publication-reference>', 'source_file': './application/2022/ipa221020.xml', 'source_data': 'USPTO-Application'}