Link detection method based on ring network heartbeat
Patent Information
- Application Number
- CN202411094460.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-08
Smart Images

Figure CN118921300A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication, and in particular to a link detection method based on ring network heartbeat. Background Art
[0002] With the development of automobile intelligence, the network system inside the car has become more and more complex, and network security issues have become increasingly prominent. In order to ensure the security of network data, VLAN (Virtual Local Area Network) encryption technology came into being. VLAN is a network management technology that logically divides LAN devices into multiple broadcast domains. Each broadcast domain can be regarded as an independent network, thereby achieving data isolation and protection. At the same time, ring network technology is also used in automobile networks to achieve efficient data transmission and sharing. In existing technologies, VLAN encryption mechanism is usually used to ensure the security of Ethernet signals during transmission.
[0003] In a large vehicle ring network, there may be multiple controllers that manage different network areas or functional modules in a distributed manner. Multiple controllers collaborate and exchange information through interfaces to jointly manage the entire network. If a controller or a router responsible for forwarding data in the vehicle ring network fails and does not recover within a period of time, resulting in a link interruption, the two controllers cannot sense whether the connection with each other is normal.
[0004] When link detection is performed by sending heartbeat messages between controllers, the existing VLAN encryption mechanism can ensure the security of message data, but each transmission requires additional VLAN processing, which undoubtedly increases the complexity and overhead of the system. Secondly, when processing a large amount of message data, data congestion may occur, affecting data transmission efficiency. Summary of the invention
[0005] The embodiment of the present invention provides a link detection method based on ring network heartbeat to solve the problem that when detecting the communication status of the link in the vehicle ring network, adding an Ethernet message of the outer VLAN to the heartbeat message requires complex operation and low transmission efficiency.
[0006] The embodiment of the present invention discloses a link detection method based on a ring network heartbeat, which is applied to a vehicle-mounted ring network. The vehicle-mounted ring network includes a first controller and a second controller. The method includes:
[0007] Obtaining a heartbeat message generated by the first controller for the vehicle-mounted ring network, and performing outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message;
[0008] Sending the initial heartbeat message to the second controller for verification, and using the initial heartbeat message that passes the verification as a one-way communication heartbeat message;
[0009] Obtaining a reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message, wherein the reassembled heartbeat message is a message obtained by the second controller repackaging the unidirectional communication heartbeat message;
[0010] The reassembled heartbeat message is sent to the first controller, and a verification result for the reassembled heartbeat message is obtained, wherein the verification result is used to evaluate the communication status of the link where the vehicle-mounted ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
[0011] Optionally, the heartbeat message carries an inner layer identifier corresponding to the first controller, and the step of obtaining the heartbeat message generated by the first controller for the vehicle-mounted ring network and performing outer layer identifier encapsulation processing on the heartbeat message includes:
[0012] Parsing the heartbeat message to obtain header information of the heartbeat message;
[0013] Inserting a preset outer layer identifier into the header information to generate new header information of the heartbeat message;
[0014] The new header information is encapsulated to obtain an initial heartbeat message including the outer identifier and the inner identifier.
[0015] Optionally, the header information includes original verification information of the heartbeat message, and before encapsulating the new header information, the method includes:
[0016] Parsing the heartbeat message to obtain data information of the heartbeat message;
[0017] Performing integrity check calculation on the data information according to the new header information to generate new check information for the heartbeat message;
[0018] Comparing the new verification information with the original verification information to determine the integrity of the data information;
[0019] If the new verification information is consistent with the original verification information, encapsulating the new header information and the data information;
[0020] If the new verification information is inconsistent with the original verification information, the heartbeat message is re-acquired until the new verification information is consistent with the original verification information.
[0021] Optionally, the method further includes:
[0022] The recombined heartbeat message that has passed the verification is used as a two-way communication heartbeat message, and the two-way communication heartbeat message is used to indicate that the link where the vehicle-mounted ring network is located is in a normal communication state;
[0023] The reassembled heartbeat message that fails the verification is discarded, and the reassembled heartbeat message that fails the verification is used to indicate that the link where the vehicle-mounted ring network is located is in an abnormal communication state.
[0024] The embodiment of the present invention further discloses a link detection method based on a ring network heartbeat, the method comprising:
[0025] Identify an initial heartbeat message to obtain an outer identifier of the initial heartbeat message;
[0026] Compare the outer identifier with a preset first identifier whitelist, and if there is a first identifier consistent with the outer identifier in the first identifier whitelist, use the initial heartbeat message corresponding to the outer identifier as a one-way communication heartbeat message that has passed the verification;
[0027] If there is no first identifier consistent with the outer identifier in the first identifier whitelist, the initial heartbeat message is not received.
[0028] Optionally, the method further includes:
[0029] Parsing the one-way communication heartbeat message to obtain first header information of the one-way communication heartbeat message, wherein the first header information includes a first outer identifier;
[0030] Removing the first outer identifier from the first header information to obtain an intermediate message that does not carry the first outer identifier and second header information corresponding to the intermediate message;
[0031] randomly selecting a second outer identifier different from the first outer identifier from the first identifier whitelist, and inserting the second outer identifier into the second header information to obtain third header information for the intermediate message;
[0032] The intermediate message is encapsulated according to the third header information to generate a reassembled heartbeat message carrying the second outer identifier.
[0033] The embodiment of the present invention further discloses a link detection method based on a ring network heartbeat, the method comprising:
[0034] Identify the reassembled heartbeat message to obtain a second outer layer identifier of the reassembled heartbeat message;
[0035] Compare the second outer layer identifier with a preset second identifier whitelist, and if there is a second identifier consistent with the second outer layer identifier in the second identifier whitelist, use the reassembled heartbeat message corresponding to the second outer layer identifier as a bidirectional communication heartbeat message that has passed verification;
[0036] If there is no second identifier consistent with the second outer identifier in the second identifier whitelist, the reassembled heartbeat message is not received.
[0037] The embodiment of the present invention further discloses a link detection device based on a ring network heartbeat, which is applied to a vehicle-mounted ring network. The vehicle-mounted ring network includes a first controller and a second controller. The device includes:
[0038] An encapsulation module, used for obtaining the heartbeat message generated by the first controller for the vehicle-mounted ring network, and performing outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message;
[0039] A first verification module, used for sending the initial heartbeat message to the second controller for verification, and using the initial heartbeat message that passes the verification as a one-way communication heartbeat message;
[0040] A repackaging module, used for obtaining a reassembled heartbeat message sent by the second controller for the one-way communication heartbeat message, wherein the reassembled heartbeat message is a message obtained by the second controller repackaging the one-way communication heartbeat message;
[0041] A status determination module is used to send the reassembled heartbeat message to the first controller and obtain a verification result for the reassembled heartbeat message, wherein the verification result is used to evaluate the communication status of the link where the vehicle-mounted ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
[0042] The embodiment of the present invention further discloses a vehicle, comprising:
[0043] one or more processors; and
[0044] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the vehicle to perform the method according to the embodiment of the present invention.
[0045] The embodiment of the present invention further discloses a computer-readable storage medium on which instructions are stored. When the instructions are executed by one or more processors, the processors execute the method described in the embodiment of the present invention.
[0046] The embodiments of the present invention include the following advantages:
[0047] The embodiment of the present invention is applied to a vehicle-mounted ring network. A heartbeat message generated by a first controller for the vehicle-mounted ring network is obtained, and an outer identifier encapsulation process is performed on the heartbeat message to obtain an initial heartbeat message. The initial heartbeat message is sent to a second controller for verification. The initial heartbeat message that passes the verification is used as a unidirectional communication heartbeat message. A reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message is obtained. The reassembled heartbeat message is a message obtained by the second controller re-encapsulating the unidirectional communication heartbeat message. The reassembled heartbeat message is sent to the first controller, and a verification result of the reassembled heartbeat message is obtained. The embodiment of the present invention can monitor the status of each link in the vehicle-mounted ring network in real time by regularly sending and verifying the heartbeat message. When the link status is abnormal, the fault point can be quickly located by analyzing the verification result of the heartbeat message, which helps to shorten the fault repair time. Furthermore, encapsulating the outer identifier of the heartbeat message can ensure the integrity of the data during the transmission process, prevent the data from being tampered with or damaged, and help to improve the security of the vehicle-mounted ring network and protect sensitive information from unauthorized access. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of the steps of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention;
[0049] Figure 2 It is a flowchart of the steps of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention;
[0050] Figure 3 It is a flowchart of the steps of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention;
[0051] Figure 4 It is a structural block diagram of a link detection device based on ring network heartbeat provided in an embodiment of the present invention;
[0052] Figure 5 It is a structural block diagram of a link detection device based on ring network heartbeat provided in an embodiment of the present invention;
[0053] Figure 6 It is a structural block diagram of a link detection device based on ring network heartbeat provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0055] The Vehicle Area Network (VAN) is a network system designed for internal vehicle communications. It mainly connects various controllers (ECUs) inside the vehicle to transmit various types of data, including sensor data, control instructions, diagnostic information, etc. Data transmission usually has high real-time requirements to ensure timely response and coordinated work of various vehicle systems. The vehicle area network uses specific communication protocols to manage data transmission, such as CAN (Controller Area Network), LIN (Local Interconnect Network), MOST (Media Oriented Systems Transport), etc. These protocols are optimized for the vehicle environment to meet the requirements of real-time, reliability and anti-interference.
[0056] However, when there is no data exchange between two controllers in the vehicle ring network for a long time, the connection may be closed by the firewall program, or if one of the controllers or routers fails and does not recover for a period of time, resulting in link interruption, the two controllers cannot sense whether the connection with each other is normal.
[0057] Reference Figure 1 , shows a flowchart of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a vehicle-mounted ring network. The vehicle-mounted ring network includes a first controller and a second controller, and specifically may include the following steps:
[0058] Step S11, obtaining a heartbeat message generated by the first controller for the vehicle-mounted ring network, and performing outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message.
[0059] Data is transmitted between controllers in the vehicle ring network through a switch. In an embodiment of the present invention, after obtaining the heartbeat message sent by the first controller, the switch encapsulates an outer layer identifier for the heartbeat message and uses the heartbeat message with the outer layer identifier as the initial heartbeat message.
[0060] Step S12, sending the initial heartbeat message to the second controller for verification, and using the initial heartbeat message that passes the verification as a one-way communication heartbeat message.
[0061] In the vehicle ring network, the switch is connected to several controllers. In order to enhance the isolation and security of the network, the switch is configured with an additional VLAN ID, for example, VLAN ID 30. When the heartbeat message sent by the first controller reaches the switch, the switch marks the outer layer of the message with another VLAN ID according to its configured VLAN ID, that is, the heartbeat message without the outer layer identifier becomes the initial heartbeat message with the outer layer identifier of the switch VLAN ID after being processed by the switch.
[0062] Step S13, obtaining a reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message, where the reassembled heartbeat message is a message obtained by the second controller repackaging the unidirectional communication heartbeat message.
[0063] The switch sends the initial heartbeat message to the second controller, and the second controller verifies the outer identifier of the initial heartbeat message based on its own preset VLAN ID database. If an identifier identical to the outer identifier of the initial heartbeat message can be matched in the VLAN ID database, then it is determined that the initial heartbeat message is successfully verified with the second controller, and the second controller receives the successfully verified initial heartbeat message.
[0064] In the case where the VLAN ID database fails to match an identifier identical to the outer identifier of the initial heartbeat message, it is determined that the initial heartbeat message fails to be verified with the second controller, and the second controller will not be able to receive the initial heartbeat message that fails to be verified. In one embodiment of the present invention, when the second controller responds to the initial heartbeat message sent by the first controller through the switch, it can be determined that the first controller cannot communicate unidirectionally with the second controller, and thus it can be further determined that the link between the first controller and the second controller is in an abnormal state.
[0065] In a feasible embodiment of the present invention, after the second controller receives the initial heartbeat message, the initial heartbeat message is forwarded to the interior of the second controller for further processing. Specifically, after forwarding to the interior of the second controller, the outer identifier of the initial heartbeat message is stripped off, and the initial heartbeat message from which the outer identifier has been stripped is encapsulated with a new outer identifier to generate a reassembled heartbeat message, and the new outer identifier is randomly selected from the VLAN ID database of the second controller.
[0066] Step S14, sending the reassembled heartbeat message to the first controller, and obtaining a verification result for the reassembled heartbeat message, the verification result is used to evaluate the communication status of the link where the vehicle ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
[0067] After the second controller generates a reassembled heartbeat message, the switch obtains the reassembled heartbeat message from the second controller and sends the reassembled heartbeat message to the first controller for verification. If an identifier identical to the outer identifier re-encapsulated in the reassembled heartbeat message can be matched in the VLAN ID database preset at the first controller, then it is determined that the reassembled heartbeat message is successfully verified with the first controller, so that the first controller and the second controller can pass the bidirectional verification. It can be understood that the bidirectional verification between the first controller and the second controller indicates that the link where the vehicle-mounted ring network is located is in a normal communication state.
[0068] In an optional embodiment of the present invention, the heartbeat message carries an inner layer identifier corresponding to the first controller, and step S11 specifically includes the following steps:
[0069] In an optional embodiment of the present invention, the first controller has an inner identifier (VLAN ID) inside, and this inner identifier is included in the sent heartbeat message and is used to identify the virtual local area network to which the message belongs. It can be understood that the heartbeat message obtained by the switch from the first controller carries the inner identifier, and after the switch encapsulates the outer identifier, the initial identifier forwarded to the second controller carries both the inner identifier and the outer identifier.
[0070] Parse the heartbeat message to obtain the header information of the heartbeat message.
[0071] A heartbeat message is a signal sent periodically to monitor the status of a network link. In a vehicle-mounted ring network, after receiving the heartbeat message sent by the first controller, the switch first needs to parse it to extract the header information of the message. The header information usually contains key data such as the source address, destination address, protocol type, and inner layer identifier (VLAN ID).
[0072] Insert the preset outer identifier into the header information to generate new header information of the heartbeat message.
[0073] The switch inserts a preset outer identifier into the parsed heartbeat message header information. After inserting the outer identifier, the original heartbeat message header information is updated and a new header information is generated. This new header information contains the original inner identifier and the newly inserted outer identifier. The generation of the new header information ensures that the heartbeat message can be correctly identified and processed by other controllers during network transmission.
[0074] The new header information is encapsulated to obtain an initial heartbeat message including an outer identifier and an inner identifier.
[0075] The newly generated heartbeat message header information is encapsulated and combined with the data information part of the heartbeat message to form a complete initial heartbeat message. This initial heartbeat message now contains the outer identifier and the inner identifier and can be sent to other nodes or controllers in the vehicle ring network.
[0076] In an optional embodiment of the present invention, the header information includes the original verification information of the heartbeat message. Before encapsulating the new header information, the following steps may also be included:
[0077] Parse the heartbeat message to obtain the data information of the heartbeat message.
[0078] An integrity check calculation is performed on the data information according to the new header information to generate new check information for the heartbeat message.
[0079] Before sending the heartbeat message, the first controller usually first uses one or more verification algorithms to calculate the verification value of the heartbeat message, and then sends the verification value together with the message to the switch. After the switch encapsulates the outer identifier for the heartbeat message, it recalculates the verification value using the same algorithm and compares it with the transmitted verification value to verify the integrity of the initial heartbeat message. The embodiment of the present invention does not specifically limit the calculation method of the verification value.
[0080] The new verification information is compared with the original verification information to determine the integrity of the data information. If the new verification information is consistent with the original verification information, the new header information and data information are encapsulated; if the new verification information is inconsistent with the original verification information, the heartbeat message is re-obtained until the new verification information is consistent with the original verification information.
[0081] Through the above-mentioned heartbeat message integrity verification process, the heartbeat message in the vehicle-mounted ring network is effectively verified and processed, ensuring the integrity and reliability of data transmission.
[0082] In an optional embodiment of the present invention, step S14 specifically includes the following steps:
[0083] The reassembled heartbeat message that passes the verification is used as a two-way communication heartbeat message, and the two-way communication heartbeat message is used to indicate that the link where the vehicle-mounted ring network is located is in a normal communication state.
[0084] The reassembled heartbeat message that fails the verification is discarded. The reassembled heartbeat message that fails the verification is used to indicate that the link where the vehicle-mounted ring network is located is in an abnormal communication state.
[0085] The switch sends the reassembled heartbeat message to the first controller for reverse verification, and obtains the verification result of the first controller on the reassembled heartbeat message. When the verification result is passed, it means that the first controller and the second controller can communicate bidirectionally, that is, the link is in a normal communication state at this time. If the verification result is failed, it means that only the first controller can unilaterally transmit data to the second controller, and the link for the second controller to transmit data to the second controller is abnormal, that is, the link is in an abnormal communication state at this time.
[0086] The embodiment of the present invention is applied to a vehicle-mounted ring network. A heartbeat message generated by a first controller for the vehicle-mounted ring network is obtained, and an outer identifier encapsulation process is performed on the heartbeat message to obtain an initial heartbeat message. The initial heartbeat message is sent to a second controller for verification. The initial heartbeat message that passes the verification is used as a unidirectional communication heartbeat message. A reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message is obtained. The reassembled heartbeat message is a message obtained by the second controller re-encapsulating the unidirectional communication heartbeat message. The reassembled heartbeat message is sent to the first controller, and a verification result of the reassembled heartbeat message is obtained. The embodiment of the present invention can monitor the status of each link in the vehicle-mounted ring network in real time by regularly sending and verifying the heartbeat message. When the link status is abnormal, the fault point can be quickly located by analyzing the verification result of the heartbeat message, which helps to shorten the fault repair time. Furthermore, encapsulating the outer identifier of the heartbeat message can ensure the integrity of the data during the transmission process, prevent the data from being tampered with or damaged, and help to improve the security of the vehicle-mounted ring network and protect sensitive information from unauthorized access.
[0087] Reference Figure 2 , shows a flowchart of the steps of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a second controller in a vehicle-mounted ring network. The specific method may include the following steps:
[0088] Step S21, identifying the initial heartbeat message to obtain an outer identifier of the initial heartbeat message.
[0089] The second controller receives an initial heartbeat message from the switch in the vehicle ring network. The heartbeat message is usually used to monitor the status and health of the network link. The second controller identifies the received initial heartbeat message to obtain the outer identifier (VLAN ID) of the outgoing message.
[0090] Step S22, comparing the outer identifier with a preset first identifier whitelist, if the first identifier whitelist contains a first identifier that is consistent with the outer identifier, taking the initial heartbeat message corresponding to the outer identifier as a verified one-way communication heartbeat message.
[0091] The second controller compares the recognized outer layer identifier with a preset first identifier whitelist, which is a predefined list containing identifiers that are allowed to pass. In a feasible embodiment, the first identifier whitelist can also be in the form of a database, and the present invention does not limit the specific form of the first identifier whitelist. If there is a first identifier that is consistent with the outer layer identifier in the first identifier whitelist, the second controller will consider that the initial heartbeat message is a one-way communication heartbeat message that has passed the verification, that is, the initial heartbeat message comes from a trusted controller and complies with the communication rules in the vehicle ring network.
[0092] For the one-way communication heartbeat message that has passed the verification, the second controller can further process it, for example, forward it to other controllers or network nodes for link status monitoring or other network management tasks.
[0093] Step S23: If there is no first identifier consistent with the outer identifier in the first identifier whitelist, the initial heartbeat message is not received.
[0094] If there is no first identifier consistent with the outer identifier in the first identifier whitelist, the second controller will not receive the initial heartbeat message, that is, the message comes from an unauthorized controller, or the initial heartbeat message does not comply with the preset communication rules in the vehicle ring network.
[0095] For initial heartbeat messages that fail verification, the second controller may discard these messages, or take other measures, such as recording a log, issuing an alarm, etc., which is not specifically limited in the embodiment of the present invention.
[0096] Through the above process, the second controller can effectively filter and process the heartbeat messages in the vehicle ring network, ensuring that only messages that meet the preset rules can be further processed, enhancing the security and reliability of the vehicle ring network, and preventing unauthorized or abnormal heartbeat messages from affecting the network.
[0097] In an optional embodiment of the present invention, after the second controller identifies the unidirectional communication heartbeat message in step S22, it can receive the unidirectional communication heartbeat message and forward the unidirectional communication heartbeat message to the inside of the second controller for further processing. The specific processing method steps are as follows:
[0098] The one-way communication heartbeat message is parsed to obtain first header information of the one-way communication heartbeat message, where the first header information includes a first outer layer identifier.
[0099] After receiving the unidirectional communication heartbeat message, the second controller parses it to extract the first header information of the unidirectional communication heartbeat message, where the first header information includes the first outer layer identifier of the unidirectional communication heartbeat message (ie, the VLAN ID encapsulated by the switch for the message).
[0100] The first outer identifier is removed from the first header information to obtain an intermediate message that does not carry the first outer identifier and second header information corresponding to the intermediate message.
[0101] The second controller removes the first outer identifier from the first header information, thereby stripping the outer identifier of the one-way communication heartbeat message, thereby obtaining an intermediate message that does not carry the first outer identifier, and the second header information corresponding to the intermediate message.
[0102] A second outer identifier different from the first outer identifier is randomly selected from the first identifier whitelist, and the second outer identifier is inserted into the second header information to obtain third header information for the intermediate message.
[0103] The second controller randomly selects a second outer identifier different from the first outer identifier carried by the one-way communication heartbeat message from its own preset first identifier whitelist, and inserts the selected second outer identifier into the second header information, thereby obtaining third header information containing the second outer identifier.
[0104] The CAPL (Communication Access for Land Vehicles) script is a programming language for automotive network communications, developed by Vector Informatik GmbH, and is mainly used in network simulation and analysis tools such as CANoe and CANalyzer. The CAPL script allows users to write custom test scripts, simulate node behavior, monitor network traffic, perform automated testing, etc. The embodiment of the present invention can use the CAPL script to identify the IP and MAC addresses of the heartbeat message that needs to add an outer VLAN, strip the VLAN ID at the location of the outer identifier, and then add the VLAN ID to the VLAN ID position of the intermediate message according to the VLAN ID range supported by the vehicle ring network, such as 10, 20, 30, 40, 50.
[0105] The intermediate message is encapsulated according to the third header information to generate a reassembled heartbeat message carrying the second outer layer identifier.
[0106] For example, if the CAPL script recognizes that the IP of the heartbeat message that needs to add an outer VLAN is 192.168.1.1 and the MAC address is 00-1A-0B-0C-0D-0E, by parsing the frame content of the Ethernet message, the location of the VLAN ID can be seen in the CANoe parsing interface. According to the outer identifier whitelist, the VLAN ID is added to the corresponding position of the middle message. After the addition is successful, the disconnected message is re-encapsulated into a reassembled heartbeat message.
[0107] Through the above process, the second controller can effectively strip and re-encapsulate the heartbeat messages in the vehicle ring network, ensuring that the messages can be correctly classified and forwarded according to the new outer identifier, enhancing the flexibility and manageability of the vehicle ring network, and helping to achieve more refined network control and optimization.
[0108] Reference Figure 3 , shows a flowchart of the steps of a link detection method based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a first controller in a vehicle-mounted ring network. The specific method may include the following steps:
[0109] Step S31, identifying the reassembled heartbeat message to obtain a second outer identifier of the reassembled heartbeat message.
[0110] The first controller obtains the second outer identifier carried in the reassembled heartbeat message by identifying the reassembled identifier forwarded by the switch. The second outer identifier is obtained by repackaging the intermediate message by the second controller.
[0111] Step S32, comparing the second outer identifier with a preset second identifier whitelist, if there is a second identifier consistent with the second outer identifier in the second identifier whitelist, taking the reassembled heartbeat message corresponding to the second outer identifier as a verified two-way communication heartbeat message.
[0112] The first controller compares the second outer layer identifier with its own preset second identifier whitelist, which is a predefined list containing identifiers that are allowed to pass. In a feasible embodiment, the second identifier whitelist can also be in the form of a database, and the present invention does not limit the specific form of the first identifier whitelist. If there is a second identifier that is consistent with the second outer layer identifier in the second identifier whitelist, the first controller will consider that the reassembled heartbeat message is a two-way communication heartbeat message that has passed the verification, that is, the first controller can communicate with the second controller in a two-way manner.
[0113] Step S33: If there is no second identifier consistent with the second outer identifier in the second identifier whitelist, the reassembled heartbeat message is not received.
[0114] If there is no second identifier consistent with the second outer identifier in the second identifier whitelist, the first controller will not receive the initial heartbeat message, that is, the link where the vehicle-mounted ring network is located can realize one-way communication from the first controller to the second controller, but cannot realize two-way communication between them. It can be understood that the link is in an abnormal communication state at this time.
[0115] For initial heartbeat messages that fail verification, the first controller may discard these messages, or take other measures, such as recording a log, issuing an alarm, etc., which is not specifically limited in the embodiment of the present invention.
[0116] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0117] Reference Figure 4 , shows a structural block diagram of a link detection device based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a vehicle-mounted ring network. The vehicle-mounted ring network includes a first controller and a second controller. The device may specifically include the following modules:
[0118] The encapsulation module 401 is used to obtain the heartbeat message generated by the first controller for the vehicle-mounted ring network, and perform outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message.
[0119] The first verification module 402 is used to send the initial heartbeat message to the second controller for verification, and use the initial heartbeat message that passes the verification as a one-way communication heartbeat message.
[0120] The repackaging module 403 is used to obtain a reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message, where the reassembled heartbeat message is a message obtained by the second controller repackaging the unidirectional communication heartbeat message.
[0121] The status determination module 404 is used to send a reassembled heartbeat message to the first controller and obtain a verification result for the reassembled heartbeat message, the verification result is used to evaluate the communication status of the link where the vehicle ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
[0122] Optionally, the encapsulation module 401 includes:
[0123] The first parsing module is used to parse the heartbeat message to obtain the header information of the heartbeat message.
[0124] The first inserting module is used to insert a preset outer layer identifier into the header information to generate new header information of the heartbeat message.
[0125] The first encapsulation submodule is used to encapsulate the new header information to obtain an initial heartbeat message including an outer identifier and an inner identifier.
[0126] Optionally, the encapsulation module 401 further includes:
[0127] The second parsing module is used to parse the heartbeat message to obtain data information of the heartbeat message.
[0128] The first check submodule is used to perform integrity check calculation on the data information according to the new header information to generate new check information for the heartbeat message.
[0129] The first comparison module is used to compare the new verification information with the original verification information to determine the integrity of the data information; if the new verification information is consistent with the original verification information, the new header information and data information are encapsulated; if the new verification information is inconsistent with the original verification information, the heartbeat message is re-acquired until the new verification information is consistent with the original verification information.
[0130] Optionally, the status determination 404 includes:
[0131] The two-way communication heartbeat message determination module is used to use the reassembled heartbeat message that has passed the verification as the two-way communication heartbeat message. The two-way communication heartbeat message is used to indicate that the link where the vehicle-mounted ring network is located is in a normal communication state.
[0132] The first discarding module is used to discard the reassembled heartbeat message that fails the verification. The reassembled heartbeat message that fails the verification is used to indicate that the link where the vehicle-mounted ring network is located is in an abnormal communication state.
[0133] Reference Figure 5 , shows a structural block diagram of a link detection device based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a second controller in a vehicle-mounted ring network. The device may specifically include the following modules:
[0134] The first identification module 501 is used to identify the initial heartbeat message to obtain an outer identifier of the initial heartbeat message.
[0135] The second comparison module 502 is used to compare the outer identifier with the preset first identifier whitelist. If there is a first identifier consistent with the outer identifier in the first identifier whitelist, the initial heartbeat message corresponding to the outer identifier is used as a one-way communication heartbeat message that has passed the verification; if there is no first identifier consistent with the outer identifier in the first identifier whitelist, the initial heartbeat message is not received.
[0136] Optionally, the device further comprises:
[0137] A third parsing module is used to parse the one-way communication heartbeat message to obtain first header information of the one-way communication heartbeat message, where the first header information includes a first outer identifier;
[0138] A stripping module, used to remove the first outer identifier from the first header information to obtain an intermediate message that does not carry the first outer identifier, and second header information corresponding to the intermediate message;
[0139] A second insertion module is used to randomly select a second outer identifier different from the first outer identifier from the first identifier whitelist, and insert the second outer identifier into the second header information to obtain third header information for the intermediate message;
[0140] The re-encapsulation submodule is used to encapsulate the intermediate message according to the third header information to generate a reassembled heartbeat message carrying the second outer layer identifier.
[0141] Reference Figure 6 , shows a structural block diagram of a link detection device based on a ring network heartbeat provided in an embodiment of the present invention, which is applied to a first controller in a vehicle-mounted ring network. The device may specifically include the following modules:
[0142] The second identification module 601 is used to identify the reassembled heartbeat message to obtain a second outer identifier of the reassembled heartbeat message.
[0143] The third comparison module 602 is used to compare the second outer layer identifier with a preset second identifier whitelist. If there is a second identifier consistent with the second outer layer identifier in the second identifier whitelist, the reorganized heartbeat message corresponding to the second outer layer identifier is used as a bidirectional communication heartbeat message that has passed the verification; if there is no second identifier consistent with the second outer layer identifier in the second identifier whitelist, the reorganized heartbeat message is not received.
[0144] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0145] In addition, an embodiment of the present invention further provides a vehicle, comprising:
[0146] one or more processors; and
[0147] One or more machine-readable media having instructions stored thereon, when executed by one or more processors, cause a vehicle to perform the method described in the embodiments of the present invention.
[0148] The embodiment of the present invention further provides a computer-readable storage medium, on which instructions are stored, and when executed by one or more processors, the processors execute the method described in the embodiment of the present invention, and can achieve the same technical effect, which will not be described here to avoid repetition. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0149] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0150] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0151] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0152] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0153] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0154] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0155] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0156] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0157] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0158] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A link detection method based on ring network heartbeat, characterized in that: Applied to a vehicle-mounted ring network, the vehicle-mounted ring network includes a first controller and a second controller, and the method includes: Acquire the heartbeat message generated by the first controller for the vehicle-mounted ring network, and perform outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message; Sending the initial heartbeat message to the second controller for verification, and using the initial heartbeat message that passes the verification as a one-way communication heartbeat message; Obtaining a reassembled heartbeat message sent by the second controller for the unidirectional communication heartbeat message, wherein the reassembled heartbeat message is a message obtained by the second controller repackaging the unidirectional communication heartbeat message; The reassembled heartbeat message is sent to the first controller, and a verification result for the reassembled heartbeat message is obtained, wherein the verification result is used to evaluate the communication status of the link where the vehicle-mounted ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
2. The method according to claim 1, characterized in that The heartbeat message carries an inner layer identifier corresponding to the first controller, and the step of obtaining the heartbeat message generated by the first controller for the vehicle-mounted ring network and performing outer layer identifier encapsulation processing on the heartbeat message includes: Parsing the heartbeat message to obtain header information of the heartbeat message; Inserting a preset outer layer identifier into the header information to generate new header information of the heartbeat message; The new header information is encapsulated to obtain an initial heartbeat message including the outer layer identifier and the inner layer identifier.
3. The method according to claim 2, characterized in that The header information includes original verification information of the heartbeat message. Before encapsulating the new header information, the method includes: Parsing the heartbeat message to obtain data information of the heartbeat message; Performing integrity check calculation on the data information according to the new header information to generate new check information for the heartbeat message; Comparing the new verification information with the original verification information to determine the integrity of the data information; If the new verification information is consistent with the original verification information, encapsulating the new header information and the data information; If the new verification information is inconsistent with the original verification information, the heartbeat message is re-acquired until the new verification information is consistent with the original verification information.
4. The method according to claim 1, characterized in that: The method further comprises: The recombined heartbeat message that has passed the verification is used as a two-way communication heartbeat message, and the two-way communication heartbeat message is used to indicate that the link where the vehicle-mounted ring network is located is in a normal communication state; The reassembled heartbeat message that fails the verification is discarded, and the reassembled heartbeat message that fails the verification is used to indicate that the link where the vehicle-mounted ring network is located is in an abnormal communication state.
5. A link detection method based on ring network heartbeat, characterized in that: The method comprises: Identify an initial heartbeat message to obtain an outer identifier of the initial heartbeat message; Compare the outer identifier with a preset first identifier whitelist, and if there is a first identifier consistent with the outer identifier in the first identifier whitelist, use the initial heartbeat message corresponding to the outer identifier as a one-way communication heartbeat message that has passed the verification; If there is no first identifier consistent with the outer identifier in the first identifier whitelist, the initial heartbeat message is not received.
6. The method according to claim 5, characterized in that The method further comprises: Parsing the one-way communication heartbeat message to obtain first header information of the one-way communication heartbeat message, wherein the first header information includes a first outer identifier; Removing the first outer identifier from the first header information to obtain an intermediate message that does not carry the first outer identifier and second header information corresponding to the intermediate message; randomly selecting a second outer identifier different from the first outer identifier from the first identifier whitelist, and inserting the second outer identifier into the second header information to obtain third header information for the intermediate message; The intermediate message is encapsulated according to the third header information to generate a reassembled heartbeat message carrying the second outer identifier.
7. A link detection method based on ring network heartbeat, characterized in that: The method comprises: Identify the reassembled heartbeat message to obtain a second outer layer identifier of the reassembled heartbeat message; Compare the second outer layer identifier with a preset second identifier whitelist, and if there is a second identifier consistent with the second outer layer identifier in the second identifier whitelist, use the reassembled heartbeat message corresponding to the second outer layer identifier as a bidirectional communication heartbeat message that has passed verification; If there is no second identifier consistent with the second outer identifier in the second identifier whitelist, the reassembled heartbeat message is not received.
8. A link detection device based on ring network heartbeat, characterized in that: Applied to a vehicle-mounted ring network, the vehicle-mounted ring network includes a first controller and a second controller, and the device includes: An encapsulation module, used for obtaining the heartbeat message generated by the first controller for the vehicle-mounted ring network, and performing outer layer identifier encapsulation processing on the heartbeat message to obtain an initial heartbeat message; A first verification module, used for sending the initial heartbeat message to the second controller for verification, and using the initial heartbeat message that passes the verification as a one-way communication heartbeat message; A repackaging module, used for obtaining a reassembled heartbeat message sent by the second controller for the one-way communication heartbeat message, wherein the reassembled heartbeat message is a message obtained by the second controller repackaging the one-way communication heartbeat message; A status determination module is used to send the reassembled heartbeat message to the first controller and obtain a verification result for the reassembled heartbeat message, wherein the verification result is used to evaluate the communication status of the link where the vehicle-mounted ring network is located, wherein the verification result is the result of the first controller and the second controller performing a two-way communication detection on the link.
9. A vehicle, characterized in that: include; one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the vehicle to perform the method of any one of claims 1-8.
10. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to execute the method according to any one of claims 1 to 8.
