Message forwarding method, device, storage medium, gateway controller, vehicle
By connecting only the UDS diagnostic interface to the OBD diagnostic port in the vehicle, the acquisition device performs safety verification and then turns on the mirroring function, which solves the problem of difficulty in obtaining CAN network segment signals in the existing technology and improves the security of vehicle information.
Patent Information
- Application Number
- CN202310076290.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-18
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-01-18
AI Technical Summary
In the existing technology, the vehicle's CAN network segment wiring harness is directly guided to the OBD diagnostic port, which makes it difficult to obtain signals from the vehicle and affects information security.
Through the UDS diagnostic interface and OBD diagnostic interface, the collection device is verified before obtaining access rights. Only after passing the verification, the target network segment mirroring function is enabled, and the target network segment packets are forwarded to the collection device in a mirrored manner.
It improves the security of vehicle information and ensures that the collection device can only obtain messages from each target network segment after passing verification, thus avoiding signal leakage and data loss.
Smart Images

Figure CN116112246B
Abstract
Description
Technical Field
[0001] The present application relates to the field of automobile technology, and in particular to a message forwarding method, device and storage medium, a gateway controller, and a vehicle. Background Art
[0002] During the vehicle production test process, it is necessary to collect data, debug the system, monitor the status of the electrical system, etc. through the bus. When the vehicle is electrically inspected and debugged, it is necessary to diagnose different CAN buses, so it is necessary to continuously lead the bus to the vehicle CAN (Controller Area Network) bus parallel wiring harness. In the prior art, the wiring harnesses of each CAN segment on the vehicle are directly guided to the OBD (On Board Diagnostics) diagnostic port, and then the messages of each CAN segment are collected through the OBD diagnostic port, and the collected messages are parsed to determine the status of each system of the vehicle. However, when the wiring harnesses of each CAN segment of the vehicle are directly guided to the OBD diagnostic port, the signal of the entire vehicle is easily obtained, which seriously affects the security of the vehicle information. Summary of the invention
[0003] In view of the above defects or deficiencies in the prior art, the present application aims to provide a message forwarding method, wherein the UDS diagnostic interface is connected to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port, and the method comprises:
[0004] Upon receiving a service message including a request seed sent by a collection device, verifying the unlocking of the collection device to unlock the access rights of the collection device;
[0005] After unlocking the access rights of the acquisition device, receiving a service instruction sent by the acquisition device;
[0006] According to the service instruction, the target network segment mirroring function is enabled, and the target network segment message is forwarded to the collection device in a mirroring manner.
[0007] According to the technical solution provided in the embodiment of the present application, the unlocking and verification of the collection device to unlock the access rights of the collection device includes: sending a seed to the collection device to verify the collection device; receiving a service message containing a key fed back by the collection device based on the seed; when the key in the service message is consistent with the key stored inside the electronic control unit, feeding back an affirmative response message to unlock the access rights of the collection device.
[0008] According to the technical solution provided in the embodiment of the present application, the service instruction is a CAN data service instruction, and a mirror function identification bit and a target network segment identification bit are set in the CAN data service instruction. According to the service instruction, the target network segment mirror function is enabled, and the target network segment message is forwarded to the collection device in a mirrored manner, including: judging whether the mirror function identification bit in the service instruction is set to 1, and whether the target network segment identification bit is set to 1; when the mirror function identification bit is set to 1, and the target network segment identification bit is set to 1, enabling the target network segment mirror function and forwarding the target network segment message set to 1 to the collection device in a mirrored manner.
[0009] According to the technical solution provided in the embodiment of the present application, the target network segment includes at least one of a power network segment, a chassis network segment, a body network segment and an infotainment network segment. When the mirror function identifier is in position 1 and the target network segment identifier is in position 1, the target network segment mirror function is enabled and the target network segment message set to 1 is forwarded to the acquisition device in a mirrored manner, including: when there is only one target network segment identifier in position 1 in the CAN data service instruction, the target network segment mirror function is enabled and all messages of the target network segment set to 1 are forwarded in a mirrored manner; when at least two target network segment identifiers in the CAN data service instruction are set to 1, the target network segment mirror function is enabled and the message sent by the target network segment set to 1 is forwarded in a mirrored manner.
[0010] According to the technical solution provided in the embodiment of the present application, it is detected whether the online instructions periodically sent by the acquisition device are received; if detected, the target network segment message set to 1 continues to be forwarded to the acquisition device in a mirrored manner; if not detected, the target network segment message set to 1 is stopped from being forwarded to the acquisition device.
[0011] According to the technical solution provided in the embodiment of the present application, the method also includes: when the key in the service message is inconsistent with the key stored inside the electronic control unit, a negative response message is fed back, and the collection device is prompted to resend the service message containing the request seed.
[0012] The present application also provides a message forwarding device, in which the UDS diagnostic interface is connected to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. The device includes: a verification module, which is used to verify the unlocking of the collection device when receiving a service message containing a request seed sent by the collection device to unlock the access rights of the collection device; a forwarding module, which is used to receive a service instruction sent by the collection device after unlocking the access rights of the collection device, enable the target network segment mirroring function according to the service instruction, and forward the target network segment message to the collection device in a mirrored manner.
[0013] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the message forwarding method as described above is implemented.
[0014] The present application also provides a gateway controller, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the message forwarding method as described above is implemented.
[0015] The present application also provides a vehicle, which includes the gateway controller as described above.
[0016] To summarize, the present application proposes a message forwarding method, device and storage medium, gateway controller and vehicle. The present application only connects the UDS diagnostic interface to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. The devices only exchange information through the UDS diagnostic interface. Before the collection device collects the target network segment message, the gateway performs a security verification on the collection device. Only after the verification is the collection device allowed to have access rights, thereby improving the information security of the entire vehicle. After the verification, according to the service instructions sent by the collection device, the gateway turns on the target network segment mirror copy function, and forwards the target network segment message to the collection device in a mirrored manner, so that the collection device can obtain the messages of each target network segment conveniently. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of a message forwarding method provided in an embodiment of the present application;
[0018] Figure 2 A flowchart for obtaining access rights provided in an embodiment of the present application;
[0019] Figure 3 A signaling diagram for obtaining access rights provided in an embodiment of the present application;
[0020] Figure 4 A flowchart of collecting target network segment messages provided in an embodiment of the present application;
[0021] Figure 5 This is a flowchart of collecting power network segment messages for a specific embodiment of the present application;
[0022] Figure 6 A schematic diagram of a message forwarding device provided in an embodiment of the present application.
[0023] The text annotations in the figure represent:
[0024] 100. Message forwarding device; 10. Verification module; 20. Forwarding module. DETAILED DESCRIPTION
[0025] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0026] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] As mentioned in the background technology, in response to the problems in the prior art, the present application proposes a message forwarding method.
[0028] In an embodiment of the present application, a UDS (Unified Diagnostic Services) diagnostic interface is connected to the OBD diagnostic port, and other CAN network interfaces are not connected to the OBD diagnostic port.
[0029] In order to improve the security of vehicle information, the embodiment of the present application only connects the UDS diagnostic interface to the OBD diagnostic port, and the CAN H and CAN L of other CAN network interfaces other than the UDS diagnostic interface are not connected to the OBD diagnostic port, so that information exchange between devices can only be carried out through the UDS diagnostic interface.
[0030] Figure 1 The flowchart of a message forwarding method provided in the embodiment of the present application. This method is applicable to a gateway controller with a mirroring function (referred to as a gateway), and the gateway executes the message forwarding method of the embodiment of the present application. Figure 1 As shown, the message forwarding method may include:
[0031] S1, upon receiving a service message containing a request sent by a collection device, verifying the unlocking of the collection device to unlock the access rights of the collection device;
[0032] S2, after unlocking the access rights of the acquisition device, receiving the service instruction sent by the acquisition device;
[0033] S3, according to the service instruction, turns on the target network segment mirroring function, and forwards the target network segment message to the collection device in a mirroring manner.
[0034] Specifically, when collecting messages from the target network segment, the collection device sends a service message containing a request through the UDS diagnostic interface. When the gateway receives the service message containing a request sent by the collection device, it verifies the collection device to improve the security of the vehicle information. Only when the collection device passes the verification, the gateway unlocks the access rights of the collection device, and the gateway turns on the mirroring function of the target network segment to collect messages from the target network segment in a mirrored manner. Since there are many types of messages from each network segment of the vehicle, when collecting messages from the target network segment, the collection device can send service instructions as needed, where the service instructions include a mirroring function identification bit and a target network segment identification bit. Based on the service instructions sent by the collection device, the gateway determines whether to turn on the mirroring function of the target network segment and whether to forward the target network segment message to the collection device in a mirrored manner.
[0035] It should be noted that the acquisition device in the embodiment of the present invention may also be a diagnostic tool.
[0036] In one embodiment of the application, Figure 2 As shown, verifying the unlocking of the acquisition device to unlock the access rights of the acquisition device may include:
[0037] S11, sending a seed to the collection device to verify the collection device;
[0038] S12, receiving a service message containing a key fed back by the collection device according to the seed;
[0039] S13, when the key in the service message is consistent with the key stored in the electronic control unit, an affirmative response message is fed back to unlock the access rights of the acquisition device.
[0040] In one embodiment of the present application, the security level of the gateway can be set to Level 1. Figure 3As shown, when verifying the acquisition device, the acquisition device or diagnostic tool sends a service message containing an access request, such as a "SecurityAccess-RequestSeed" service message, to the ECU (Electronic Control Unit) through the UDS diagnostic interface. The gateway forwards the service message containing the access request to the ECU, and the ECU responds to the received service message containing the access request by feeding back a seed, and the gateway sends the seed to the acquisition device. It should be noted that the seed is the input parameter for the acquisition device and the ECU to calculate the key. After receiving the seed, the acquisition device sends a "SecurityAccess-SendKey" service message containing the key to the ECU according to the seed. The ECU compares the key in the "SecurityAccess-SendKey" service message containing the key with the key stored or calculated internally to determine whether the two keys match. If the ECU determines that the two keys match, the ECU unlocks the acquisition device, so that the acquisition device has the authority to open the mirror copy function of the target network segment, and feeds back a "SecurityAccess-SendKey" affirmative response message.
[0041] In an embodiment of the application, the message forwarding method may further include: when the key in the service message is inconsistent with the key stored inside the electronic control unit, a negative response message is fed back, and the collection device is prompted to resend the service message containing the request seed.
[0042] If the ECU determines that the two keys do not match, this access is considered an incorrect access attempt. The ECU does not unlock the acquisition device, feeds back a negative response message, and can prompt the acquisition device to resend the service message containing the access request seed. It should be noted that if the access is rejected for other reasons, this access is not considered an incorrect access attempt.
[0043] In one embodiment of the present application, the request seed is as shown in Table 1:
[0044] Table 1 Request seed
[0045] byte Parameter name Cvt (constraint) Value (hex) #1 RequestServiceIdentifier M(Mandatory) 27 #2 SecurityAccessType=RequestSeed M 01,09
[0046] In one embodiment of the present application, the affirmative response is as shown in Table 2:
[0047] Table 2 Affirmative responses
[0048]
[0049]
[0050] In one embodiment of the present application, the negative response is as shown in Table 3:
[0051] Table 3 Negative response
[0052] byte Parameter name Cvt (constraint) Value (hex) #1 RequestServiceIdentifier M(Mandatory) 27 #2 SecurityAccessType=RequestSeed M 01,09 #3 NegativeResponseCode M
[0053] In one embodiment of the application, Figure 4 As shown, the service instruction is a CAN data service instruction, in which a mirror function identification bit and a target network segment identification bit are set. According to the service instruction, the target network segment mirror function is enabled, and the target network segment message is forwarded to the acquisition device in a mirrored manner, including:
[0054] S21, determining whether the mirroring function flag in the service instruction is set to 1, and whether the target network segment flag is set to 1;
[0055] S22, when the mirroring function flag is at 1 and the target network segment flag is at 1, the target network segment mirroring function is enabled and the target network segment message set to 1 is forwarded to the collection device in a mirroring manner.
[0056] In the embodiment of the present application, the service instruction is a CAN data service instruction. It should be noted that the CAN data service instruction is in hexadecimal, 8 bytes of data, such as 05 31 01 02 10 01 00 00, which are the 1st to 8th bytes from left to right, the 1st byte is 05, which is converted into binary as 0000 0101, a total of 8 bits, 1.0 refers to the address of the rightmost 1, 1.0-1.3 refers to the address of the 0101 part, 1.7 refers to the address of the rightmost 0, and 1.4-1.7 refers to 0000.
[0057] In a specific embodiment of the present application, the service instruction may be specifically: 0x731 05 31 01 0210 01 0000. In the embodiment of the present application, 0x731 is used to represent the gateway diagnostic request ID (0x7B1 is used to represent the gateway reply ID), 05 (the first byte) represents that the valid bytes in the service instruction are 5 bits, 31 (the second byte) represents 31 routine services; 01 (the third byte) represents the sub-function item (where 01 represents execution, 02 represents opening, and 03 represents query results), 02 10 (the fourth byte and the fifth byte) are the gateway mirror function bits; 01 00 00 (the sixth byte, the seventh byte, and the eighth byte) are the target network segment message bits.
[0058] It should be noted that for the fourth and fifth bytes, 02 10 ( 0000 0010 00010000 ) means to enable the gateway mirroring function, and you can also define 02 11( 000000100001 0001) indicates that the gateway mirroring function is enabled. This application does not limit the specific data of the fourth byte and the fifth byte. For the sixth byte, the seventh byte, and the eighth byte, this application can define the corresponding 6.0-6.7, 7.0-7.7, and 8.0-8.7 positions 1 to represent different target network segment messages. Since the first byte in the service instruction is 05, the seventh byte (7.0-7.7) and the eighth byte (8.0-8.7) in the service instruction are invalid bits. For the above service instruction: 0x731 05 31 01 02 10 01 00 00, different target network segment messages can be defined by defining 6.0-6.7.
[0059] As an example, the 6.0 bit can be used as the power segment identification bit. When the acquisition device needs to collect power segment messages, the 6.0 bit is set to 1, which is expressed as 01 (0000 0001) in hexadecimal. The corresponding service instruction sent by the acquisition device is: 0x731 05 31 01 02 10 01 00 00 . The 6.1 bit can be used as the chassis network segment identification bit. When the acquisition device needs to collect chassis network segment messages, the 6.1 bit is set to 1, which is expressed as 02 (0000 0010) in hexadecimal. The corresponding service instruction sent by the acquisition device is: 0x731 05 31 01 02 10 02 00 00 . The 6.2 position can be used as the vehicle body network segment identification position. When the collection device needs to collect the vehicle body network segment message, the 6.2 position is set to 1, which is expressed as 04 (0000 0010) in hexadecimal. The corresponding service instruction sent by the collection device is: 0x731 05 31 01 02 10 04 00 00 . Bit 6.3 can be used as the infotainment identification bit. When the acquisition device needs to collect the infotainment segment message, bit 6.3 is set to 1, which is expressed as 08 (00000010) in hexadecimal. The corresponding service instruction sent by the acquisition device is: 0x731 05 31 01 02 10 08 00 00. The corresponding target segment identification bit can be defined as needed, and this application does not limit the identification bits of different target segments.
[0060] In one embodiment of the application, the target network segment message includes at least one of a power network segment message, a chassis network segment message, a body network segment message, and an infotainment network segment message. When the mirror function flag is at position 1 and the target network segment flag is at position 1, the target network segment mirror function is enabled and the target network segment message set to 1 is forwarded to the collection device in a mirroring manner, including:
[0061] When only one target network segment identification position is set to 1 in the CAN data service instruction, the target network segment mirroring function is enabled and all messages of the target network segment set to 1 are forwarded in a mirroring manner;
[0062] When at least two target network segment identification positions are set to 1 in the CAN data service instruction, the target network segment mirroring function is enabled and the message sent by the target network segment set to 1 is forwarded in a mirroring manner.
[0063] In some embodiments, the collection device may only collect one target network segment message, or may collect multiple (at least two) target network segment messages at the same time. When the collection device only collects one target network segment message, the collection device may only set the target network segment identification position in the CAN data service instruction it sends to 1, and the gateway turns on the target network segment mirroring function and forwards all messages of the target network segment set to 1 in a mirroring manner. When the collection device collects multiple (at least two) target network segment messages at the same time, the collection device needs to set multiple target network segment identification positions in the CAN data service instruction it sends to 1 at the same time, and the gateway turns on the target network segment mirroring function and forwards the messages sent by the target network segment set to 1 in a mirroring manner. When the collection device collects multiple (at least two) target network segment messages at the same time, the load of the mirrored message is too high, and the gateway only mirrors and forwards the target network segment message set to 1, and does not mirror and forward the message from the target network segment set to 1 to another network segment, which can reduce the load of the mirrored message to prevent frame loss in the process of the gateway forwarding the target network segment message set to 1.
[0064] In one embodiment of the application, the message forwarding method also includes: detecting whether the online instructions periodically sent by the collection device are received; if detected, continuing to forward the target network segment message set to 1 to the collection device in a mirrored manner; if not detected, stopping forwarding the target network segment message set to 1 to the collection device.
[0065] In order to further improve the security of vehicle information, when the gateway forwards the target network segment message to the collection device in a mirrored manner, it can also detect whether the online instructions periodically sent by the collection device are received. It should be noted that when the collection device receives the target network segment message forwarded by the gateway in a mirrored manner, it is necessary to send online instructions periodically at the same time, such as sending online instructions every 2S. The gateway determines whether the collection device is still online by detecting whether it has received the online instructions periodically sent by the collection device. Every preset cycle length, such as every 2S, when the online instructions sent by the collection device are received, the target network segment message will continue to be forwarded to the collection device in a mirrored manner. When the preset cycle length is exceeded, such as more than 2S, and no online instructions sent by the collection device are received, the mirror copy function of the target network segment is turned off.
[0066] In an embodiment of the present application, when the acquisition device needs to exit the collection of target network segment messages in a mirroring manner, a gateway mirroring function shutdown instruction can be sent to shut down the mirroring copy function of the target network segment. When exiting the collection device from collecting target network segment messages in a mirroring manner, the data acquisition personnel or diagnostic personnel can also directly unplug the data acquisition device or diagnostic tool.
[0067] As a specific example, when the acquisition device collects power segment segment messages, the acquisition device sends 0x731 through the UDS diagnostic CAN 05310102 10010000 , the gateway controller replies 0x7B1 05710102 10010000 , indicating that the gateway has turned on the power segment mirroring function, and the acquisition device can receive messages normally. At the same time, in order to keep the acquisition device online, the acquisition device or diagnostic tool needs to send 0x731 in a 2S cycle. 02 3E 80 00 00 00 00 00 When the mirroring function needs to be exited, the data acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 04 31 02 02100000 00 to close.
[0068] When the acquisition device collects chassis network segment messages, the acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 05 31 01 02 10 02 00 00 , the gateway controller replies 0x7B1 05 71 01 0210 02 00 00 , indicating that the gateway has turned on the chassis network segment mirroring function, and the acquisition device or diagnostic tool can normally receive messages. At the same time, in order to keep the diagnostic device online, the acquisition device or diagnostic tool needs to send 0x731 in a 2S cycle. 02 3E 80 00 00 00 00 00 When you need to exit the mirroring function, the acquisition device or diagnostic tool sends 0x731 04 31 02 02 through the UDS diagnostic CAN 10 00 00 00 to close.
[0069] When the acquisition device collects the vehicle body network segment message: the acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 05 31 01 02 10 04 0000 , the gateway controller replies 0x7B1 05 71 0102 10 04 0000 , indicating that the gateway has turned on the vehicle segment mirroring function, and the data collection device or diagnostic tool can receive messages normally. At the same time, in order to keep the diagnostic device online, the data collection device or diagnostic tool needs to send 0x731 in a 2S cycle. 023E 80 00 0000 0000 When the mirroring function needs to be exited, the data acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 04 31 0202 10 00 0000 to close.
[0070] When the acquisition device collects the information entertainment segment message: the acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 0531 01 0210 08 00 00 , the gateway controller replies 0x7B1 05 710102 10080000 , indicating that the gateway has turned on the INFOCAN mirroring function, and the data acquisition device or diagnostic tool can normally receive messages. At the same time, in order to keep the diagnostic device online, the data acquisition device or diagnostic tool needs to send 0x731 in a 2S cycle. 02 3E 80 00 00 00 00 00 When the mirroring function needs to be exited, the data acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 04 3102 02 10 00 00 00 to close.
[0071] When the acquisition device simultaneously collects power segment messages, chassis segment messages, body segment messages, and infotainment segment messages, the acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 05 31 01 02 10 0F 00 00 , the gateway controller replies 0x7B1 05 71 01 02 10 0F 00 00 , indicating that the gateway has turned on the power segment, chassis segment, body segment, and infotainment segment message mirroring functions, and the data acquisition device or diagnostic tool can normally record messages from the four segments. At the same time, in order to keep the diagnostic device online, the data acquisition device or diagnostic tool needs to send 0x731 at a 2S cycle. 02 3E 80 00 00 00 0000 When the mirroring function needs to be exited, the data acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 04 31 02 02 10 00 00 00 to close.
[0072] in, Figure 5 The complete signaling diagram for collecting power network segment messages is shown in Figure 1. Figure 5 As shown, the acquisition device or diagnostic tool sends 0x731 02 10 03 00 000000 00 The gateway enters the diagnostic extended session mode. The acquisition device or diagnostic tool receives the 0x7B1 reply from the gateway. 02 50 03 0000 00 00 00 After that, periodically, for example, send online command 0x731 0 every 2 seconds 2 3E 80 00 00 0000 00 , so that the gateway maintains the diagnostic extended session mode. When obtaining the power segment message, the data acquisition device or diagnostic tool sends an access request 0x731 02 27 01 00 00 00 00 00 , the gateway replies 0x7B1 05 67 XX XX XX XX 00 00 (seed), the data acquisition device or diagnostic tool sends a service message containing the key according to the seed 0x731 05 27 XX XX XX XX 00 00 When the key in the service message is consistent with the key stored or generated inside the ECU, the gateway replies 0x7B1 02 67 02 00 00 00 00 00 , unlock the access rights of the acquisition device or diagnostic tool. The acquisition device or diagnostic tool sends 0x731 to the gateway through the UDS diagnostic port. 05 31 01 02 10 01 00 00 , the gateway replies 0x7B1 05 71 01 02 10 01 00 00 , indicating that the gateway has turned on the power segment mirroring function, and the data acquisition device or diagnostic tool can normally record the power segment message. The data acquisition device or diagnostic tool needs to send 0x731 in a 2S cycle. 02 3E 80 00 00 00 00 00 When the mirroring function needs to be exited, the data acquisition device or diagnostic tool sends 0x731 through the UDS diagnostic CAN 04 31 02 02 10 0000 00 to close.
[0073] The message forwarding method in the embodiment of the present application only connects the UDS diagnostic interface to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. Information is exchanged between devices only through the UDS diagnostic interface. Before the collection device collects the target network segment message, the gateway performs a security verification on the collection device. Only after passing the verification is the collection device allowed to have access rights, thereby improving the information security of the entire vehicle. After the verification, according to the service instruction sent by the collection device, the gateway turns on the target network segment mirror copy function, and forwards the target network segment message to the collection device in a mirrored manner, so that the collection device can obtain the messages of each target network segment conveniently.
[0074] The present application also provides a message forwarding device.
[0075] In the embodiment of the present application, only the UDS diagnostic interface is connected to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port.
[0076] In order to improve the security of vehicle information, the embodiment of the present application only connects the UDS diagnostic interface to the OBD diagnostic port, and the CAN H and CAN L of other CAN network interfaces other than the UDS diagnostic interface are not connected to the OBD diagnostic port, so that information exchange between devices can only be carried out through the UDS diagnostic interface.
[0077] Figure 6 Schematic diagram of a message forwarding device provided in an embodiment of the present application. Figure 6 As shown, the message forwarding device 100 may include a verification module 10 and a forwarding module 20 .
[0078] Among them, the acquisition module 10 is used to verify the unlocking of the collection device when it receives a service message containing a request seed sent by the collection device to unlock the access rights of the collection device; the collection module 20 is used to receive the service instruction sent by the collection device after unlocking the access rights of the collection device, and according to the service instruction, enable the target network segment mirroring function, and forward the target network segment message to the collection device in a mirrored manner.
[0079] Specifically, when the collection device or diagnostic tool collects the target network segment message, it sends a service message containing a request through the UDS diagnostic interface. When the gateway receives the service message containing the request sent by the collection device, in order to improve the security of the vehicle information, the collection device is verified. Only when the collection device passes the verification, the gateway unlocks the access rights of the collection device, so that the collection device can turn on the mirroring function of the gateway and collect the target network segment message in a mirroring manner. Since there are many types of messages in each network segment of the whole vehicle, when collecting the target network segment message, the collection device can send a service instruction according to demand, where the service instruction includes a mirroring function identifier and a target network segment identifier. According to the service instruction sent by the collection device, the gateway determines whether to turn on its mirroring function and whether to forward the target network segment message to the collection device in a mirroring manner.
[0080] In one embodiment of the application, the verification module 10 is used to send a seed to the collection device to verify the collection device; receive a service message containing a key fed back by the collection device based on the seed; when the key in the service message is consistent with the key stored inside the electronic control unit, feed back an affirmative response message to unlock the access rights of the collection device.
[0081] In one embodiment of the application, the service instruction is a CAN data service instruction, in which a mirror function identification bit and a target network segment identification bit are set. The forwarding module 20 is used to determine whether the mirror function identification bit in the service instruction is set to 1, and whether the target network segment identification bit is set to 1; when the mirror function identification bit is set to 1 and the target network segment identification bit is set to 1, the target network segment mirroring function is turned on and the target network segment message set to 1 is forwarded to the acquisition device in a mirrored manner.
[0082] In one embodiment of the application, the target network segment message includes at least one of a power network segment message, a chassis network segment message, a body network segment message and an infotainment network segment message, and the forwarding module 20 is used to enable the target network segment mirroring function and forward all messages of the target network segment set to 1 in a mirroring manner when there is only one target network segment identification position 1 in the CAN data service instruction; when at least two target network segment identification positions are 1 in the CAN data service instruction, enable the target network segment mirroring function and forward the messages sent by the target network segment set to 1 in a mirroring manner.
[0083] In one embodiment of the application, the message forwarding device 100 also includes: a detection module, used to detect whether the online instructions periodically sent by the collection device are received; if detected, continue to forward the target network segment message set to 1 to the collection device in a mirrored manner; if not detected, stop forwarding the target network segment message set to 1 to the collection device.
[0084] In one embodiment of the application, the verification module 10 is also used to feedback a negative response message when the key in the service message is inconsistent with the key stored inside the electronic control unit, and prompt the collection device to resend the service message containing the request seed.
[0085] The message forwarding device 100 of the embodiment of the present application only connects the UDS diagnostic interface to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. Information is exchanged between devices only through the UDS diagnostic interface. Before the collection device collects the target network segment message, the gateway performs a security verification on the collection device. Only after passing the verification is the collection device allowed to have access rights, thereby improving the information security of the entire vehicle. After the verification, according to the service instruction sent by the collection device, the gateway turns on the target network segment mirror copy function, and forwards the target network segment message to the collection device in a mirrored manner, so that the collection device can obtain the messages of each target network segment conveniently.
[0086] The present application also provides a computer-readable storage medium.
[0087] In some embodiments, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the message forwarding method as described above is implemented.
[0088] The present application also provides a gateway controller.
[0089] In some embodiments, the gateway controller may include a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the message forwarding method as described above is implemented.
[0090] The present application also provides a vehicle.
[0091] In some embodiments, a vehicle may include the gateway controller described above.
[0092] The computer-readable storage medium, gateway controller and vehicle in the embodiments of the present application, using the message forwarding method as described above, can conveniently obtain the message information of each target network segment from the OBD diagnostic port when the original equipment manufacturer performs vehicle maintenance, while ensuring information security.
[0093] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the scope of protection of this application.
Claims
1. A message forwarding method, characterized in that: The UDS diagnostic interface is connected to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. The method includes: Upon receiving a service message including a request seed sent by a collection device, verifying the unlocking of the collection device to unlock the access rights of the collection device; After unlocking the access rights of the acquisition device, receiving a service instruction sent by the acquisition device; wherein the service instruction includes eight bytes, the first byte represents the valid byte in the service instruction, the second byte represents 31 routine services, the third byte represents the sub-function item, the fourth byte and the fifth byte are the gateway mirror function bits, and the sixth byte, the seventh byte and the eighth byte are the target network segment message bits; Determine whether the mirroring function identification bit in the service instruction is set to 1, and whether the target network segment identification bit is set to 1; wherein the service instruction is a CAN data service instruction, and the CAN data service instruction is provided with a mirroring function identification bit and a target network segment identification bit; When there is only one target network segment identification position 1 in the CAN data service instruction, the target network segment mirroring function is enabled and all messages of the target network segment set to 1 are forwarded to the acquisition device in a mirroring manner; When at least two target network segment identification positions in the CAN data service instruction are set to 1, the target network segment mirroring function is enabled and the message sent by the target network segment set to 1 is forwarded to the acquisition device in a mirroring manner.
2. The message forwarding method according to claim 1, characterized in that: The step of verifying the unlocking of the acquisition device to unlock the access rights of the acquisition device includes: Sending a seed to the collection device to verify the collection device; Receiving a service message containing a key fed back by the collection device according to the seed; When the key in the service message is consistent with the key stored in the electronic control unit, an affirmative response message is fed back to unlock the access rights of the acquisition device.
3. The message forwarding method according to claim 1, characterized in that: The target network segment includes at least one of a power network segment, a chassis network segment, a body network segment, and an infotainment network segment.
4. The message forwarding method according to claim 1, characterized in that: The method further comprises: Detecting whether an online instruction periodically sent by the acquisition device is received; If detected, continue to forward the target network segment message set to 1 to the collection device in a mirroring manner; If not detected, stop forwarding the target network segment message set to 1 to the collection device.
5. The message forwarding method according to claim 2, characterized in that: The method further comprises: When the key in the service message is inconsistent with the key stored in the electronic control unit, a negative response message is fed back and the collection device is prompted to resend the service message containing the request seed.
6. A message forwarding device, characterized in that: The UDS diagnostic interface is connected to the OBD diagnostic port, and the other CAN network interfaces are not connected to the OBD diagnostic port. The device includes: A verification module, configured to verify the unlocking of the collection device upon receiving a service message containing a request seed sent by the collection device, so as to unlock the access rights of the collection device; A forwarding module is used to receive a service instruction sent by the acquisition device after unlocking the access rights of the acquisition device, and determine whether the mirror function identification bit in the service instruction is set to 1, and whether the target network segment identification bit is set to 1; when only one target network segment identification bit is set to 1 in the CAN data service instruction, the target network segment mirror function is enabled and all messages of the target network segment set to 1 are forwarded to the acquisition device in a mirroring manner; when at least two target network segment identification bits are set to 1 in the CAN data service instruction, the target network segment mirror function is enabled and the messages sent by the target network segment set to 1 are forwarded to the acquisition device in a mirroring manner; wherein, the service instruction includes eight bytes, the first byte represents the valid bytes in the service instruction, the second byte represents 31 routine services, the third byte represents the sub-function item, the fourth byte and the fifth byte are the gateway mirror function bits, and the sixth byte, the seventh byte and the eighth byte are the target network segment message bits; the service instruction is a CAN data service instruction, and the mirror function identification bit and the target network segment identification bit are set in the CAN data service instruction.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message forwarding method according to any one of claims 1 to 5 is implemented.
8. A gateway controller, comprising a memory and a processor, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the message forwarding method according to any one of claims 1 to 5 is implemented.
9. A vehicle, characterized in that: The vehicle includes the gateway controller of claim 8.
Citation Information
Patent Citations
Vehicle CAN network data access method
CN106990726A
Diagnosis safety algorithm management system for electronic controller of hydrogen energy automobile
CN112738029A
