Data frame transmission method and device, computer equipment, readable storage medium and program product
By performing frame protocol, identification and period detection in the data receiving buffer, combined with the use of photoelectric isolation devices, the problem of low security in traditional data frame transmission is solved, and efficient data frame security detection and transmission is achieved.
Patent Information
- Application Number
- CN202411071505.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-01
AI Technical Summary
Traditional data frame transmission technology has the problem of low security in data frame transmission and is vulnerable to network attacks caused by abnormal data frames.
After determining the target input data frame in the data receiving buffer, frame protocol detection, frame identification detection and frame period detection are performed to ensure that the data frame complies with the protocol and identification and then transmitted, and data transmission is carried out when the electrical state is normal by using the photoelectric isolation device. , reduce unnecessary detection times and improve safety.
It effectively improves the security of data frame transmission, reduces the number of detections, enhances the reliability and security of data frame transmission, and prevents the propagation of malicious data frames.
Smart Images

Figure CN118890195A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data frame transmission method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of computer technology, a technology has emerged that uses a data bus to achieve high-speed data transmission between terminals or modules with different functions. The data bus is a bridge for data frame transmission and communication between terminals. For example, the data bus can be a CAN (Controller Area Network) bus.
[0003] However, in the traditional data frame transmission technology, the process of data transmission through the data bus may be subject to network attacks caused by abnormal data frames, and there is a problem of low security of data frame transmission. Summary of the invention
[0004] Based on this, it is necessary to provide a data frame transmission method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the security of data frame transmission in response to the above technical problems.
[0005] In a first aspect, the present application provides a data frame transmission method, comprising:
[0006] Determine a target input data frame from a data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store a to-be-processed input data frame transmitted from an external bus to the target terminal, the to-be-processed input data frame carrying a data frame identifier;
[0007] According to the reference data frame protocol corresponding to the external bus, a frame protocol detection is performed on the target input data frame to obtain a frame protocol detection result corresponding to the target input data frame;
[0008] When the frame protocol detection result is detection passed, based on the data frame identification list corresponding to the target terminal, a frame identification detection is performed on the data frame identification corresponding to the target input data frame to obtain a frame identification detection result corresponding to the target input data frame;
[0009] When the frame identifier detection result is detection passed, based on the data frame identifier corresponding to the target input data frame, a frame period detection is performed on the target input data frame to obtain a frame period detection result corresponding to the target input data frame;
[0010] When the frame period detection result is detection passed, the target input data frame is transmitted to the target terminal.
[0011] In one of the embodiments, the data frame transmission method further includes:
[0012] When receiving the output data frame sent by the target terminal, detecting the electrical state of the target terminal, and obtaining the terminal electrical detection result corresponding to the target terminal;
[0013] When the electrical detection result of the terminal is normal, the photoelectric isolation device is started, and the output data frame is transmitted to the external bus through the photoelectric isolation device.
[0014] In one of the embodiments, the data frame transmission method further includes:
[0015] When receiving a data transmission request for a target terminal from an external bus, detecting the electrical state of the external bus and obtaining an external electrical detection result; the data transmission request carries an input data frame to be processed;
[0016] When the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is written into the data receiving buffer corresponding to the target terminal through the photoelectric isolation device.
[0017] In one of the embodiments, the reference data frame protocol includes a plurality of reference data frame types and reference data frame formats corresponding to each reference data frame type;
[0018] According to the reference data frame protocol corresponding to the external bus, a frame protocol detection is performed on the target input data frame to obtain a frame protocol detection result corresponding to the target input data frame, including:
[0019] Determining a target data frame type corresponding to the target input data frame from various reference data frame types according to a data frame identifier corresponding to the target input data frame;
[0020] Based on the reference data frame format corresponding to the target data frame type, verify the target data frame format corresponding to the target input data frame to obtain a frame format detection result;
[0021] Based on the frame format detection result, a frame protocol detection result corresponding to the target input data frame is determined.
[0022] In one of the embodiments, the reference data frame protocol further includes reference frame transmission modes corresponding to respective reference data frame types, and based on the frame format detection result, determining the frame protocol detection result corresponding to the target input data frame includes:
[0023] Obtain the historical input data frame sequence corresponding to the target input data frame;
[0024] Based on the reference frame transmission mode corresponding to the target data frame type, the data frame types corresponding to each historical input data frame in the historical input data frame sequence are detected to obtain the frame transmission mode detection result corresponding to the target data frame type;
[0025] Based on the frame format detection result and the frame transmission mode detection result, a frame protocol detection result corresponding to the target input data frame is determined.
[0026] In one of the embodiments, based on the data frame identifier corresponding to the target input data frame, the frame period detection is performed on the target input data frame to obtain the frame period detection result corresponding to the target input data frame, including:
[0027] Based on the data frame identifier corresponding to the target input data frame, obtaining the frame period type corresponding to the target input data frame;
[0028] Acquire a forward input data frame corresponding to the target input data frame based on the frame cycle type; the forward input data frame and the target input data frame belong to the same frame cycle type;
[0029] The transmission interval between the target input data frame and the forward input data frame is compared with the frame period corresponding to the frame period type to obtain a frame period detection result corresponding to the target input data frame.
[0030] In a second aspect, the present application also provides a data frame transmission device, including:
[0031] The data acquisition module is used to determine the target input data frame from the data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store the input data frame to be processed transmitted from the external bus to the target terminal, and the input data frame to be processed carries the data frame identifier;
[0032] The protocol detection module is used to perform frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus, and obtain the frame protocol detection result corresponding to the target input data frame;
[0033] The identification detection module is used to perform frame identification detection on the data frame identification corresponding to the target input data frame based on the data frame identification list corresponding to the target terminal when the frame protocol detection result is detection passed, so as to obtain the frame identification detection result corresponding to the target input data frame;
[0034] A period detection module, used for, when the frame identification detection result is detection passed, performing frame period detection on the target input data frame based on the data frame identification corresponding to the target input data frame, to obtain a frame period detection result corresponding to the target input data frame;
[0035] The data transmission module is used to transmit the target input data frame to the target terminal when the frame period detection result is detection passed.
[0036] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned data frame transmission method when executing the computer program.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above-mentioned data frame transmission method when executed by a processor.
[0038] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data frame transmission method when executed by a processor.
[0039] The above-mentioned data frame transmission method, device, computer equipment, computer-readable storage medium and computer program product, through the data receiving buffer buffer, transmits the to-be-processed data frame from the external bus to the target terminal, and after determining the target input data frame from the data receiving buffer, first performs frame protocol detection on the target input data frame. When the frame protocol detection passes, it indicates that the format of the data frame conforms to the data frame protocol. If the attacker sends a data frame without a frame identification field, it can be discarded at the stage of frame protocol detection, and there is no need to perform the next step of frame identification detection, which can improve the efficiency of data frame security detection. For the data frame that passes the frame protocol detection, the data frame identification of the target input data frame is detected based on the data frame identification list corresponding to the target terminal. When the frame identification detection passes, the frame period detection is further performed on the target input data frame. Because there is no corresponding data frame period for the data frame with abnormal data frame identification, if the attacker sends a data frame with abnormal data frame identification, it can be discarded at the stage of frame identification detection, and there is no need to perform the next step of frame period detection. Finally, the target input data frame that passes the frame period detection is sent to the target terminal. In this way, by performing frame protocol detection, frame identification detection and frame period detection on the target input data frame in sequence, unnecessary data frame detection can be minimized, the number of data frame detections can be reduced, the efficiency of data frame detection can be improved, and the security of data frame transmission can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] FIG1 is an application environment diagram of a data frame transmission method in one embodiment;
[0042] FIG2 is a schematic diagram of a flow chart of a data frame transmission method in one embodiment;
[0043] FIG3 is an application environment diagram of a data frame transmission method in another embodiment;
[0044] FIG4 is a schematic diagram of the structure of a control terminal in one embodiment;
[0045] FIG5 is a schematic diagram of a process for determining a frame protocol detection result in one embodiment;
[0046] FIG6 is a schematic diagram of a process for determining a frame protocol detection result in another embodiment;
[0047] FIG7 is a block diagram of a data frame transmission device according to an embodiment;
[0048] FIG. 8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] The data frame transmission method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the control terminal 102 has two groups of communication interfaces, which are connected and communicated with the external bus and the target terminal 104 respectively. A control terminal 102 is deployed between each target terminal 104 and the external bus, and the control terminal 102 contains a data receiving buffer for caching the data frame sent from the external bus to the target terminal 104. The control terminal 102 determines the target input data from the data receiving buffer corresponding to the local target terminal 104, and performs frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus, and obtains the frame protocol detection result corresponding to the target input data frame. When the frame protocol detection result is that the detection is passed, the control terminal 102 performs frame identification detection on the data frame identification corresponding to the target input data frame based on the data frame identification list corresponding to the target terminal, and obtains the frame identification detection result corresponding to the target input data frame. When the frame identification detection result is that the detection is passed, the control terminal 102 performs frame period detection on the target input data frame based on the data frame identification corresponding to the target input data frame, and obtains the frame period detection result corresponding to the target input data frame. When the frame period detection result is detection passed, the control terminal 102 transmits the target input data frame to the target terminal 104. The target terminal 104 may be, but is not limited to, various microprocessors, ECUs (Electronic Control Units), personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, and projection devices. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, and the like. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, and the like.
[0051] In an exemplary embodiment, as shown in FIG2 , a data frame transmission method is provided, which is described by taking the method applied to the control terminal in FIG1 as an example, and includes the following steps 202 to 210. Among them:
[0052] Step 202, determining a target input data frame from a data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store the input data frame to be processed transmitted from the external bus to the target terminal, and the input data frame to be processed carries a data frame identifier.
[0053] Among them, the target terminal refers to each terminal that transmits and communicates data through an external bus. The external bus refers to a bridge for data frame transmission and communication between each terminal, and can be various data buses. For example, as shown in Figure 3, the data bus can be a CAN (Controller Area Network) bus. The CAN bus sends data frames in the form of broadcast. When a target terminal on the CAN bus needs to send a message to other target terminals, it will be sent to all target terminals on the bus in the form of broadcast; the data bus can also be an I2C (Inter-Integrated Circuit) bus, SPI (Serial Peripheral Interface) bus, etc. The input data frame refers to the data frame received from the data bus that needs to be transmitted to the target terminal.
[0054] The control terminal has two sets of communication interfaces, which are connected and communicated with the external bus and the target terminal respectively. A control terminal is deployed between each target terminal and the external bus. The control terminal contains a data receiving buffer for caching input data frames sent from the external bus to the target terminal. The target input data frame refers to the input data frame determined from the data receiving buffer for data frame detection. The pending input data frame refers to the input data frame temporarily stored in the data receiving buffer waiting for data frame detection. The data frame identifier is the unique identifier of the data frame, which is used to distinguish different data frames to ensure that the data in the communication process can be correctly identified and processed.
[0055] Exemplarily, when the control terminal receives an input data frame transmitted by the external bus, the input data frame is written to the tail of the first-in-first-out queue in the data receiving buffer corresponding to the target terminal. Specifically, the input data frame, the data frame identifier corresponding to the input data frame, and the data frame sending time can be written into the data receiving buffer. The input data frame to be processed at the head of the first-in-first-out queue in the data receiving buffer corresponding to the target terminal is determined as the target input data frame, and the data frame identifier corresponding to the target input data frame is obtained.
[0056] Step 204 , performing frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus, and obtaining a frame protocol detection result corresponding to the target input data frame.
[0057] The reference data frame protocol refers to the standardized data frame protocol corresponding to the external bus. Different types of external buses have different corresponding data frame protocols. The data frame protocol defines the format and rules for data transmission on the CAN bus, including the formats and rules for transmission corresponding to different reference data frame types.
[0058] Exemplarily, the control terminal performs frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus and the reference data frame type corresponding to the target input data frame to obtain a frame protocol detection result corresponding to the target input data frame.
[0059] Step 206, when the frame protocol detection result is detection passed, based on the data frame identification list corresponding to the target terminal, a frame identification detection is performed on the data frame identification corresponding to the target input data frame to obtain a frame identification detection result corresponding to the target input data frame.
[0060] The data frame identification list corresponding to the target terminal refers to a list of data frame identifications corresponding to each input data frame required for the target terminal to execute its own business. The data frame identification list is determined according to the business requirements and business logic of the target terminal.
[0061] Exemplarily, when the frame protocol detection result is that the detection fails, the control terminal discards the target input data frame. When the frame protocol detection result is that the detection passes, based on the data frame identification list corresponding to the target terminal, the data frame identification of the target input data frame is subjected to frame identification detection to obtain the frame identification detection result corresponding to the target input data frame. Specifically, when the data frame identification corresponding to the target input data frame exists in the data frame identification list, it is determined that the frame identification detection result corresponding to the target input data frame is that the detection passes. When the data frame identification corresponding to the target input data frame does not exist in the data frame identification list, it is determined that the frame identification detection result corresponding to the target input data frame is that the detection fails, and the target input data frame is discarded.
[0062] Step 208 , when the frame identifier detection result is detection passed, based on the data frame identifier corresponding to the target input data frame, a frame period detection is performed on the target input data frame to obtain a frame period detection result corresponding to the target input data frame.
[0063] Exemplarily, the control terminal determines the frame period corresponding to the target input data frame based on the data frame identifier corresponding to the target input data frame. The time interval between the target input data frame and the forward input data frame is calculated. When the time interval matches the frame period corresponding to the target input data frame, the frame period detection result is determined to be a passed detection. When the time interval does not match the frame period corresponding to the target input data frame, the frame period detection result is determined to be a failed detection, and the target input data frame is discarded. Specifically, if the time interval is equal to the frame period corresponding to the target input data frame, it indicates that the frame periods match. It can also be that the difference between the time interval and the frame period corresponding to the target input data frame is less than a preset threshold, and so on.
[0064] Step 210: When the frame period detection result is detection passed, the target input data frame is transmitted to the target terminal.
[0065] Exemplarily, when the frame period detection result is detection passed, the control terminal transmits the target input data frame to the target terminal.
[0066] In the above data frame transmission method, the data frame to be processed transmitted from the external bus to the target terminal is cached by the data receiving buffer. After the target input data frame is determined from the data receiving buffer, the frame protocol detection is first performed on the target input data frame. When the frame protocol detection passes, it indicates that the format of the data frame conforms to the data frame protocol. If the attacker sends a data frame without a frame identification field, it can be discarded at the stage of frame protocol detection, and there is no need to perform the next step of frame identification detection, which can improve the efficiency of data frame security detection. For the data frame that passes the frame protocol detection, the data frame identification of the target input data frame is detected based on the data frame identification list corresponding to the target terminal. When the frame identification detection passes, the frame period detection is further performed on the target input data frame. Because the data frame with abnormal data frame identification does not have a corresponding data frame period, therefore, if the attacker sends a data frame with abnormal data frame identification, it can be discarded at the stage of frame identification detection, and there is no need to perform the next step of frame period detection. Finally, the target input data frame that passes the frame period detection is sent to the target terminal. In this way, by performing frame protocol detection, frame identification detection and frame period detection on the target input data frame in sequence, unnecessary data frame detection can be minimized, the number of data frame detections can be reduced, the efficiency of data frame detection can be improved, and the security of data frame transmission can be effectively improved.
[0067] In an exemplary embodiment, the data frame transmission method further includes:
[0068] When receiving the output data frame sent by the target terminal, detecting the electrical state of the target terminal, and obtaining the terminal electrical detection result corresponding to the target terminal;
[0069] When the electrical detection result of the terminal is normal, the photoelectric isolation device is started, and the output data frame is transmitted to the external bus through the photoelectric isolation device.
[0070] Among them, the output data frame refers to the data frame sent by the target terminal to the external bus. The electrical state refers to the electrical characteristics and state. The electrical fault state will seriously affect the transmission quality and stability of the communication line, and needs to be checked and repaired in time. The photoelectric isolation device refers to the use of light as a medium to establish an optical isolation between the input circuit and the output circuit to achieve electrical isolation. This device usually includes a transmitter (light-emitting part) and a receiver (photosensitive part), and realizes signal isolation and transmission through photoelectric conversion.
[0071] Exemplarily, when the control terminal receives the output data frame sent by the target terminal, it detects the electrical state of the target terminal and obtains the terminal electrical detection result corresponding to the target terminal. When the terminal electrical detection result is normal, the photoelectric isolation device is started, the output data frame is converted into an optical signal by the transmitter in the photoelectric isolation device, the optical signal is converted into an electrical signal by the receiver in the photoelectric isolation device, and the electrical signal corresponding to the converted output data frame is transmitted to the external bus. When the terminal electrical detection result is abnormal, a corresponding warning message can be generated and sent to the terminal used by the control personnel.
[0072] In the actual implementation process, the voltage corresponding to the target terminal can be collected by the voltage sensor, and based on the collected voltage, it can be determined whether the target terminal has an overvoltage or undervoltage condition. Overvoltage refers to the voltage exceeding the rated voltage range for normal operation of the device or system. Undervoltage refers to the voltage being lower than the rated voltage range for normal operation of the device or system. When the target terminal has an overvoltage or undervoltage condition, the terminal electrical detection result corresponding to the target terminal is determined to be abnormal.
[0073] In this embodiment, when an output data frame sent by a target terminal is received, the electrical state of the target terminal is first determined. When the electrical detection result of the terminal is normal, the photoelectric isolation device is started, and the output data frame is transmitted to the external bus through the photoelectric isolation device. This can cut off the direct circuit connection between the target terminal and the external bus, achieve electrical isolation, and help improve the safety and reliability of the system.
[0074] In an exemplary embodiment, the data frame transmission method further includes:
[0075] When receiving a data transmission request for a target terminal from an external bus, detecting the electrical state of the external bus and obtaining an external electrical detection result; the data transmission request carries an input data frame to be processed;
[0076] When the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is written into the data receiving buffer corresponding to the target terminal through the photoelectric isolation device.
[0077] The data transmission request refers to a request carrying an input data frame to be processed and requesting to transmit the data frame to be processed to a target terminal.
[0078] Exemplarily, when a data transmission request for a target terminal is received from an external bus, the electrical state of the external bus is detected to obtain an external electrical detection result. When the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is converted into an optical signal by a transmitter in the photoelectric isolation device, and the optical signal is converted into an electrical signal by a receiver in the photoelectric isolation device, and the electrical signal corresponding to the input data frame to be processed obtained by the conversion is written into the data receiving buffer corresponding to the target terminal. When the external electrical detection result is abnormal, a corresponding warning message can be generated and sent to the terminal used by the control personnel.
[0079] In some embodiments, the structural diagram of the control terminal is shown in FIG4. Among them, the data transceiver 1 in the control terminal is connected to the external bus, and the data transceiver 2 is connected to the target terminal. When the data transceiver 1 receives a data transmission request for the target terminal from the external bus, the communication control unit detects the electrical state of the external bus. When the external electrical detection result is normal, the communication control unit starts the photoelectric isolation device, and transmits the input data frame to be processed to the data reading unit through the photoelectric isolation device, and the data reading unit writes the input data frame to be processed into the data receiving buffer. The control terminal then determines the target input data frame from the data receiving buffer, performs data frame protocol detection, data frame identification detection and data frame cycle detection on the target input data frame in turn, and transmits the target input data frame that passes the detection to the data transceiver 2. The target input data frame is transmitted to the target terminal by the data transceiver 2. When the data transceiver 2 receives the output data frame sent by the target terminal, the communication control unit detects the electrical state of the target terminal. When the terminal electrical detection result is normal, the communication control unit starts the photoelectric isolation device, and transmits the output data frame to the external bus through the photoelectric isolation device.
[0080] In this embodiment, when a data transmission request for a target terminal is received from an external bus, the electrical state of the external bus is first determined. When the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is written into the data receiving buffer through the photoelectric isolation device. This can cut off the direct circuit connection between the target terminal and the external bus, achieve electrical isolation, and help improve the safety and reliability of the system.
[0081] In an exemplary embodiment, the reference data frame protocol includes a plurality of reference data frame types and reference data frame formats corresponding to the respective reference data frame types;
[0082] As shown in FIG5 , according to the reference data frame protocol corresponding to the external bus, the target input data frame is subjected to frame protocol detection to obtain the frame protocol detection result corresponding to the target input data frame, including:
[0083] Step 502, determining a target data frame type corresponding to the target input data frame from various reference data frame types according to a data frame identifier corresponding to the target input data frame;
[0084] Step 504, based on the reference data frame format corresponding to the target data frame type, verify the target data frame format corresponding to the target input data frame to obtain a frame format detection result;
[0085] Step 506: Determine the frame protocol detection result corresponding to the target input data frame based on the frame format detection result.
[0086] The reference data frame type refers to a preset data frame type included in the reference data frame protocol, and different reference data frame types correspond to different data frame formats, i.e., reference data frame formats. For example, when the external bus is a CAN bus, the reference data frame type may include data frames, remote control frames, error frames, overload frames, frame intervals, and other types.
[0087] The data frame format refers to a form of organization of data in the communication process, which defines the key parameters such as the specific structure, bit order, bit length, number and arrangement of data bits, number and position of stop bits, and verification method of data in the transmission process. The data frame format mainly focuses on the transmission details of data on the physical layer or data link layer to ensure the correct transmission and parsing of data. The data frame format usually includes the header, data part, frame tail and other parts. For example, when the external bus is the CAN bus, the data frame format usually includes the following parts: frame start, arbitration segment, control segment, data segment, CRC (Cyclic Redundancy Check) segment, ACK (Acknowledgment) segment, and frame end.
[0088] Exemplarily, different reference data frame types correspond to different reference data frame formats. The control terminal determines the target data frame type corresponding to the target input data frame from each reference data frame type based on the data frame identifier corresponding to the target input data. Based on the reference data frame format corresponding to the target data frame type, the target data frame format corresponding to the target input data frame is verified to obtain a frame format detection result. Specifically, the target input data frame can be verified according to the reference data frame format corresponding to the target data frame type to determine whether it contains the essential components in the reference data frame format corresponding to the target data frame type. After the verification is passed, it is further verified whether the order between the various components is the same as the order in the reference data frame format corresponding to the target data frame type, and the frame format detection result corresponding to the target input data frame that passes the verification is determined as the detection passing. In the actual implementation process, the cyclic redundancy check code corresponding to the target input data frame can be further calculated according to the content of each component in the target data frame format, and the calculated cyclic redundancy check code is matched with the cyclic redundancy check carried in the target input data frame. If the two are the same, the frame format detection result corresponding to the target input data frame is determined to be the detection passing.
[0089] In this embodiment, by performing frame format verification on the target input data through the reference data frame format corresponding to the target input data frame, malicious data frames whose frame formats do not meet the requirements can be quickly identified, thereby quickly and comprehensively filtering most of the malicious data frames, ensuring the reliability, consistency and security of data transmission, and promptly preventing network attacks caused by malicious data frames.
[0090] In an exemplary embodiment, as shown in FIG6 , based on the frame format detection result, determining the frame protocol detection result corresponding to the target input data frame includes steps 602 to 606. Wherein:
[0091] Step 602: Acquire a historical input data frame sequence corresponding to the target input data frame.
[0092] Step 604 , based on the reference frame transmission mode corresponding to the target data frame type, detect the data frame type corresponding to each historical input data frame in the historical input data frame sequence, and obtain the frame transmission mode detection result corresponding to the target data frame type.
[0093] Step 606: Determine the frame protocol detection result corresponding to the target input data frame based on the frame format detection result and the frame transmission mode detection result.
[0094] Among them, the historical input data frame sequence refers to a sequence composed of various input data frames that have been received by the target terminal. Different reference data frame types correspond to different reference data frame sending modes. The reference data frame sending mode refers to the preset sending rules corresponding to the reference data frame type. For example, when the external bus is a CAN bus, the reference data frame sending mode corresponding to the reference data frame type of the frame interval includes: the frame interval is a frame used to separate data frames and remote control frames. The data frame and the remote control frame can be separated from any previous frame by inserting a frame interval, and the frame interval cannot be inserted before the overload frame and the error frame.
[0095] Exemplarily, the control terminal obtains a historical input data sequence corresponding to the target input data frame, and based on the reference frame transmission mode corresponding to the target data frame type, detects the data frame type and input order corresponding to each historical input data frame in the historical input data sequence, and obtains a frame transmission mode detection result corresponding to the target data frame type. When the frame format detection result and the frame transmission mode detection result are both detection passed, it is determined that the frame protocol detection result corresponding to the target input data frame is detection passed.
[0096] In this embodiment, after the target input data frame is subjected to frame protocol detection, the target input data frame is further subjected to frame transmission mode detection to obtain a final frame protocol detection result. The frame protocol detection result obtained in this way is more accurate, and the input data frame that does not conform to the frame protocol can be filtered more accurately, thereby improving the security of data frame transmission.
[0097] In an exemplary embodiment, based on a data frame identifier corresponding to a target input data frame, performing frame period detection on the target input data frame to obtain a frame period detection result corresponding to the target input data frame includes:
[0098] Based on the data frame identifier corresponding to the target input data frame, obtaining the frame period type corresponding to the target input data frame;
[0099] Acquire a forward input data frame corresponding to the target input data frame based on the frame cycle type; the forward input data frame and the target input data frame belong to the same frame cycle type;
[0100] The transmission interval between the target input data frame and the forward input data frame is compared with the frame period corresponding to the frame period type to obtain a frame period detection result corresponding to the target input data frame.
[0101] Among them, the frame cycle type refers to the classification of each data frame identifier in the data frame identifier list corresponding to the target terminal according to the transmission cycle of the data frame in advance, and multiple frame cycle types are obtained. The transmission cycle of the data frames corresponding to the same frame cycle type is the same. For example, when the data frame identifiers 001, 002 and 003 all belong to the same frame cycle type, and the frame cycle type is 5s, the input data frames with data frame identifiers 001, 002 and 003 can only be sent in sequence at intervals of 5s. When the data frame with data frame identifier 001 is currently sent, if the data frame with data frame identifier 003 is to be sent, it must be sent after 5s.
[0102] Exemplarily, based on the data frame identifier corresponding to the target input data frame, the frame cycle type corresponding to the target input data frame is determined. Based on the frame cycle type, a forward input data frame corresponding to the target input data frame is obtained. The forward input data frame refers to an input data frame received on the target terminal that belongs to the same frame cycle type as the target input data frame. Based on the data frame sending time corresponding to the target input data frame and the data frame sending time corresponding to the forward input data frame, the transmission interval between the target input data frame and the forward input data frame is calculated. When the transmission interval matches the frame cycle corresponding to the frame cycle type, it is determined that the frame cycle detection result corresponding to the target input data frame is a detection pass.
[0103] In this embodiment, for each target terminal, each data frame identifier in the data frame identifier list corresponding to the target terminal is classified to obtain multiple frame cycle types, each frame cycle type corresponds to a frame cycle. After performing frame protocol detection and frame identifier detection on the target input data frame, further performing frame cycle detection on the target input data frame can screen malicious data frames from the perspective of the data frame sending cycle, thereby improving the comprehensiveness of data frame security detection, thereby improving the security of data frame transmission.
[0104] In a specific embodiment, the data frame transmission method proposed in the present application can be applied to the CAN bus of a car to prevent DOS attacks (Denial of Service) in the CAN bus. Each ECU in the car communicates via the CAN bus. For each ECU, one end of the control terminal that executes the data frame transmission method is connected to the CAN pin of the ECU, and the other end is connected to the CAN bus. The structure of the control terminal is shown in Figure 4. The data frame transmission method includes the following steps:
[0105] 1. Photoelectric isolation
[0106] When the data transceiver 1 receives a data transmission request for the target terminal (i.e., ECU) from the CAN bus, the communication control unit detects the electrical state of the CAN bus. When the external electrical detection result is normal, the communication control unit starts the photoelectric isolation device, and transmits the input data frame to be processed to the data reading unit through the photoelectric isolation device. The data reading unit writes the input data frame to be processed into the data receiving buffer.
[0107] When the data transceiver 2 receives the output data frame sent by the target terminal, the communication control unit detects the electrical state of the target terminal. When the terminal electrical detection result is normal, the communication control unit starts the photoelectric isolation device and transmits the output data frame to the CAN bus through the photoelectric isolation device.
[0108] 2. Data frame detection
[0109] The control terminal performs frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus and the reference data frame type corresponding to the target input data frame, and obtains the frame protocol detection result corresponding to the target input data frame. When the frame protocol detection result is detection passed, and the data frame identifier corresponding to the target input data frame exists in the data frame identifier list, it is determined that the frame identifier detection result corresponding to the target input data frame is detection passed. The control terminal determines the frame period corresponding to the target input data frame based on the data frame identifier corresponding to the target input data frame. Calculate the time interval between the target input data frame and the forward input data frame. When the time interval matches the frame period corresponding to the target input data frame, it is determined that the frame period detection result is detection passed, and the target input data frame is transmitted to the target terminal.
[0110] In the above embodiment, through the photoelectric coupling module, during the communication process, the electrical state will be first detected to see if there is an overvoltage or undervoltage state, so that the output and input ends are completely electrically isolated to protect the control terminal from electrical interference and damage. At the same time, the photoelectric coupling response time is at the millisecond or microsecond level, which can ensure the complete transmission of the signal and the reliability of data transmission. It also ensures that the ECU connected to the control terminal will not be electrically interfered by the network end, and that the entire network will not be disturbed when an abnormality occurs in the ECU. In addition, since different network protocols have different security features and vulnerabilities, through frame protocol detection, malicious frames based on known vulnerabilities or unsafe protocols can be identified and filtered out, which helps to enhance the security of the network and prevent attackers from exploiting protocol vulnerabilities to attack. The frame identifier provides additional identification information for the frame. Through frame identifier detection, malicious frames can be quickly identified and isolated from the network to prevent them from affecting other devices and services, which can improve the utilization of network resources. Finally, by monitoring the frame cycle, abnormal traffic patterns in the network can be detected in real time. Malicious frames often have irregular transmission cycles, such as sudden large-scale transmission or abnormal low-frequency transmission. By setting a reasonable frame cycle threshold, these abnormal frames can be discovered and filtered in time, so as to quickly respond to network attacks. In addition, the large number of malicious frames sent may cause network congestion and affect the normal operation of services. By monitoring and filtering the frame cycle, the spread of malicious frames in the network can be effectively reduced, the risk of network congestion can be reduced, and the stability and availability of the network can be guaranteed.
[0111] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0112] Based on the same inventive concept, the embodiment of the present application also provides a data frame transmission device for implementing the data frame transmission method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data frame transmission device embodiments provided below can refer to the limitations on the data frame transmission method above, and will not be repeated here.
[0113] In an exemplary embodiment, as shown in FIG. 7 , a data frame transmission device is provided, including: a data acquisition module 702, a protocol detection module 704, an identification detection module 706, a cycle detection module 708 and a data transmission module 710, wherein:
[0114] The data acquisition module 702 is used to determine the target input data frame from the data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store the input data frame to be processed transmitted from the external bus to the target terminal, and the input data frame to be processed carries the data frame identifier;
[0115] The protocol detection module 704 is used to perform frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus, and obtain a frame protocol detection result corresponding to the target input data frame;
[0116] The identification detection module 706 is used to perform frame identification detection on the data frame identification corresponding to the target input data frame based on the data frame identification list corresponding to the target input data frame when the frame protocol detection result is detection passed, so as to obtain a frame identification detection result corresponding to the target input data frame;
[0117] The period detection module 708 is used to perform frame period detection on the target input data frame based on the data frame identifier corresponding to the target terminal when the frame identifier detection result is detection passed, and obtain a frame period detection result corresponding to the target input data frame;
[0118] The data transmission module 710 is used to transmit the target input data frame to the target terminal when the frame period detection result is detection passed.
[0119] In one embodiment, the data frame transmission device further includes:
[0120] The photoelectric isolation module is used to detect the electrical state of the target terminal and obtain the terminal electrical detection result corresponding to the target terminal when receiving the output data frame sent by the target terminal; when the terminal electrical detection result is normal, the photoelectric isolation device is started to transmit the output data frame to the external bus through the photoelectric isolation device.
[0121] In one embodiment, the data frame transmission device further includes:
[0122] The photoelectric isolation module is used to detect the electrical state of the external bus and obtain the external electrical detection result when receiving a data transmission request for the target terminal from the external bus; the data transmission request carries the input data frame to be processed; when the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is written into the data receiving buffer corresponding to the target terminal through the photoelectric isolation device.
[0123] In one embodiment, the reference data frame protocol includes multiple reference data frame types and reference data frame formats corresponding to each reference data frame type; the protocol detection module 704 is further used to:
[0124] According to the data frame identifier corresponding to the target input data frame, the target data frame type corresponding to the target input data frame is determined from various reference data frame types; based on the reference data frame format corresponding to the target data frame type, the target data frame format corresponding to the target input data frame is verified to obtain a frame format detection result; based on the frame format detection result, a frame protocol detection result corresponding to the target input data frame is determined.
[0125] In one embodiment, the reference data frame protocol further includes reference frame transmission modes corresponding to each reference data frame type, and the frame protocol detection module 704 is further used to:
[0126] Obtain a historical input data frame sequence corresponding to a target input data frame; based on a reference frame sending mode corresponding to the target data frame type, detect the data frame types corresponding to each historical input data frame in the historical input data frame sequence, and obtain a frame sending mode detection result corresponding to the target data frame type; based on a frame format detection result and a frame sending mode detection result, determine a frame protocol detection result corresponding to the target input data frame.
[0127] In one embodiment, the data transmission module 710 is further configured to:
[0128] Based on the data frame identifier corresponding to the target input data frame, the frame cycle type corresponding to the target input data frame is obtained; based on the frame cycle type, the forward input data frame corresponding to the target input data frame is obtained; the forward input data frame and the target input data frame belong to the same frame cycle type; the transmission interval between the target input data frame and the forward input data frame is compared with the frame cycle corresponding to the frame cycle type to obtain the frame cycle detection result corresponding to the target input data frame.
[0129] Each module in the above-mentioned data frame transmission device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0130] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a data frame transmission method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0131] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0132] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0133] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0134] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0136] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0138] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data frame transmission method, characterized in that: The method comprises: Determine a target input data frame from a data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store a to-be-processed input data frame transmitted from an external bus to the target terminal, the to-be-processed input data frame carrying a data frame identifier; According to the reference data frame protocol corresponding to the external bus, the target input data frame is subjected to frame protocol detection to obtain a frame protocol detection result corresponding to the target input data frame; When the frame protocol detection result is detection passed, based on the data frame identifier list corresponding to the target terminal, a frame identifier detection is performed on the data frame identifier corresponding to the target input data frame to obtain a frame identifier detection result corresponding to the target input data frame; When the frame identifier detection result is detection passed, based on the data frame identifier corresponding to the target input data frame, performing frame period detection on the target input data frame to obtain a frame period detection result corresponding to the target input data frame; When the frame period detection result is detection passed, the target input data frame is transmitted to the target terminal.
2. The method according to claim 1, characterized in that The method further comprises: Upon receiving the output data frame sent by the target terminal, detecting the electrical state of the target terminal to obtain a terminal electrical detection result corresponding to the target terminal; When the electrical detection result of the terminal is normal, the photoelectric isolation device is started, and the output data frame is transmitted to the external bus through the photoelectric isolation device.
3. The method according to claim 1, characterized in that The method further comprises: When receiving a data transmission request for the target terminal from the external bus, detecting the electrical state of the external bus to obtain an external electrical detection result; the data transmission request carries an input data frame to be processed; When the external electrical detection result is normal, the photoelectric isolation device is started, and the input data frame to be processed is written into the data receiving buffer corresponding to the target terminal through the photoelectric isolation device.
4. The method according to claim 1, characterized in that: The reference data frame protocol includes a plurality of reference data frame types and reference data frame formats corresponding to the reference data frame types respectively; The performing frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus to obtain a frame protocol detection result corresponding to the target input data frame includes: Determining, according to the data frame identifier corresponding to the target input data frame, a target data frame type corresponding to the target input data frame from each of the reference data frame types; Based on the reference data frame format corresponding to the target data frame type, verify the target data frame format corresponding to the target input data frame to obtain a frame format detection result; Based on the frame format detection result, a frame protocol detection result corresponding to the target input data frame is determined.
5. The method according to claim 4, characterized in that The reference data frame protocol also includes reference frame transmission modes corresponding to the reference data frame types respectively, and determining the frame protocol detection result corresponding to the target input data frame based on the frame format detection result includes: Acquire a historical input data frame sequence corresponding to the target input data frame; Based on the reference frame sending mode corresponding to the target data frame type, detecting the data frame types respectively corresponding to the respective historical input data frames in the historical input data frame sequence, and obtaining a frame sending mode detection result corresponding to the target data frame type; Based on the frame format detection result and the frame transmission mode detection result, a frame protocol detection result corresponding to the target input data frame is determined.
6. The method according to claim 1, characterized in that The performing frame period detection on the target input data frame based on the data frame identifier corresponding to the target input data frame to obtain the frame period detection result corresponding to the target input data frame includes: Based on the data frame identifier corresponding to the target input data frame, acquiring the frame period type corresponding to the target input data frame; Acquire a forward input data frame corresponding to the target input data frame based on the frame cycle type; the forward input data frame and the target input data frame belong to the same frame cycle type; The transmission interval between the target input data frame and the forward input data frame is compared with the frame period corresponding to the frame period type to obtain a frame period detection result corresponding to the target input data frame.
7. A data frame transmission device, characterized in that: The device comprises: A data acquisition module, used to determine a target input data frame from a data receiving buffer corresponding to the target terminal; the data receiving buffer is used to store a to-be-processed input data frame transmitted from an external bus to the target terminal, the to-be-processed input data frame carrying a data frame identifier; A protocol detection module, used to perform frame protocol detection on the target input data frame according to the reference data frame protocol corresponding to the external bus, and obtain a frame protocol detection result corresponding to the target input data frame; An identification detection module, configured to, when the frame protocol detection result is detection passed, perform frame identification detection on the data frame identification corresponding to the target input data frame based on the data frame identification list corresponding to the target terminal, to obtain a frame identification detection result corresponding to the target input data frame; A period detection module, configured to, when the frame identifier detection result is detection passed, perform frame period detection on the target input data frame based on the data frame identifier corresponding to the target input data frame to obtain a frame period detection result corresponding to the target input data frame; The data transmission module is used to transmit the target input data frame to the target terminal when the frame period detection result is detection passed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
