Packet transmission method and electronic device
By employing a central device with firewall capabilities to manage IP packet transmission for IoT devices, the security vulnerabilities of IoT devices are addressed at a lower cost without the need for dedicated firewall devices.
Patent Information
- Application Number
- JP2023506360
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-07-31
- Filing Date
- 2021-07-27
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-07-27
AI Technical Summary
IoT devices lack firewall capabilities, making them vulnerable to attacks, and dedicated firewall devices are expensive.
Utilizing a central device with firewall capabilities to manage IP packet transmission for IoT devices, where the IoT device encapsulates the target device's IP address in the packet body and uses the central device to enforce firewall rules, eliminating the need for dedicated IoT firewall devices.
Ensures IoT device security at a lower cost by leveraging a central device's firewall capabilities, reducing the need for expensive dedicated firewall devices.
Smart Images

Figure 0007581483000001 
Figure 0007581483000002 
Figure 0007581483000003
Abstract
Description
[Technical field]
[0001] [CROSS-REFERENCE TO RELATED APPLICATIONS] This application claims priority to Chinese Patent Application No. 202010758606.7, entitled "Packet Transmission Method and Electronic Device," filed with the State Intellectual Property Administration of China on July 31, 2020, the contents of which are incorporated herein by reference in their entirety.
[0002] [Technical field] This application relates to the field of communications, and more particularly to a packet transmission method and electronic device in the field of communications. [Background technology]
[0003] While the Internet of Things (IoT) is developing and the number of IoT devices is increasing, most of these IoT devices have low security capabilities and are highly susceptible to attacks. In order to prevent IoT devices from being attacked, it is necessary to purchase a dedicated firewall device, but the cost of the firewall device is high. Summary of the Invention
[0004] Embodiments of the present application provide a packet transmission method and electronic device to ensure security of IoT devices at low cost.
[0005] According to a first aspect, the application provides a packet transmission method, which may be executed by an IoT device, which may be an apparatus, such as a chip system, capable of assisting the IoT device to implement a function required by the method, the method including the steps of: generating a first internet protocol (IP) packet by the IoT device, a destination address in a packet header of the first IP packet being an IP address of a central device, and a destination address in a packet body of the first IP packet being an IP address of a target device, and transmitting the first IP packet to the central device based on the IP address of the central device, the central device being configured to forward the first IP packet to the target device according to a firewall rule of the IoT device.
[0006] In the above solution, the IoT device can generate a first IP packet, and a destination address in a packet header of the first IP packet is not the IP address of the target device but the IP address of the central device. The IoT device may encapsulate the IP address of the target device in a packet body of the first IP packet. In this way, the central device may determine whether to send the first IP packet to the target device according to a firewall rule of the IoT device, and the central device is used as a firewall device, which can avoid purchasing a dedicated firewall device for the IoT device. This can reduce the cost and ensure the security of the IoT device.
[0007] The IoT device does not have firewall capabilities, the central device has the firewall capabilities, and the central device is configured with the firewall rules of the IoT device.
[0008] In some of several possible implementations, before the IoT device generates a first Internet Protocol IP packet, the method further includes the steps of the IoT device receiving a second IP packet from the central device, wherein a source address in a packet header of the second IP packet is the IP address of the central device, and the IoT device obtaining the IP address of the central device based on the packet header of the second IP packet.
[0009] In this way, the IoT device is able to generate the first IP packet based on the IP address of the central device obtained from the packet header of the second IP packet.
[0010] In some of several possible implementations, before the IoT device generates a first Internet Protocol IP packet, the method further includes the step of the IoT device receiving a second IP packet from the central device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device, and the step of the IoT device obtaining the IP address of the central device based on the IP configuration in the packet body of the second IP packet.
[0011] In this way, the IoT device can generate the first IP packet based on the IP address of the central device obtained from the packet body of the second IP packet.
[0012] In some of several possible implementations, the IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, and the method further includes a step of the IoT device establishing the tunnel between the IoT device and the central device based on the tunnel identifier.
[0013] The IoT device sending the first IP packet to the central device based on the IP address of the central device includes the IoT device sending the first IP packet to the central device based on the IP address of the central device via the tunnel.
[0014] In the above technical solution, the IoT device and the central device transmit the first IP packet through a tunnel, which is helpful to improve security.
[0015] In some of several possible implementations, the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and the packet body of the first IP packet includes the tunnel IP address of the IoT device.
[0016] In the above solution, if the tunnel IP address of the IoT device included in the packet body of the first IP packet is the address of the IoT device indicated by the tunnel identifier assigned by the central device, the central device identifies the IoT device based on the tunnel IP address, and prevents an unauthorized IoT device from sending the first IP packet to the central device, which can improve security.
[0017] In some of several possible implementations, the IoT device generating a first IP packet includes the IoT device generating a first IP packet for the application in the IoT device when the application initiates an IP request.
[0018] According to a second aspect, the application provides a packet transmission method, the packet transmission method including the steps of: a central device receiving a first Internet Protocol IP packet from an IoT device, where a destination address in a packet header of the first IP packet is an IP address of the central device and a destination address in a packet body of the first IP packet is an IP address of a target device; the central device obtaining the IP address of the target device in the packet body of the first IP packet; and the central device determining, according to a firewall rule of the IoT device, whether to send a third IP packet to the target device indicated by the IP address of the target device, where a destination address in a packet header of the third IP packet is the IP address of the target device and a data portion in the packet body of the third IP packet is a data portion in the packet body of the first IP packet.
[0019] In the above solution, the central device may determine whether to send the third IP packet to the target device according to the firewall rule of the IoT device, and the central device can be used as a firewall device to avoid purchasing a dedicated firewall device for the IoT device, which can reduce the cost and ensure the security of the IoT device.
[0020] In some of several possible implementations, prior to the step of receiving, by the central device, the first IP packet from the IoT device, the method further includes:
[0021] The central device sends a second IP packet to the IoT device, where the source address in a packet header of the second IP packet is the IP address of the central device.
[0022] In some of several possible implementations, before the central device receives the first IP packet from the IoT device, the method further includes a step of the central device sending a second IP packet to the IoT device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device.
[0023] In some of several possible implementations, the IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, and the method further includes:
[0024] The central device establishes the tunnel between the central device and the IoT device based on the tunnel identifier; The central device receiving the first IP packet from the IoT device includes:
[0025] The central device receives the first IP packet from the IoT device via the tunnel.
[0026] In some of several possible implementations, the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and a source address in the packet body of the first IP packet is the tunnel IP address of the IoT device.
[0027] In some of several possible implementations, before the central device determines whether to send a third IP packet to the target device in accordance with a firewall rule of the IoT device, the method further includes:
[0028] The central device determines whether the IoT device has permission to send the third IP packet to the target device.
[0029] Determining whether the central device should send a third IP packet to the target device according to a firewall rule of the IoT device includes:
[0030] If the central device determines that the IoT device has permission to send the third IP packet to the target device, the central device determines whether to send the third IP packet to the target device in accordance with the firewall rules of the IoT device.
[0031] In some of multiple possible implementations, a source address in the packet header of the third IP packet is the IP address of the central device, or a source address in the packet header of the third IP packet is the IP address of the IoT device.
[0032] According to a third aspect, there is provided a packet transmission method, comprising: an IoT device generating a first IP packet, a destination address in a packet header of the first IP packet being an IP address of a central device, and a destination address in a packet body of the first IP packet being an IP address of a target device; the IoT device sending the first IP packet to the central device based on the IP address of the central device; the central device obtaining the IP address of the target device in the packet body of the first IP packet; and a step of determining, according to a firewall rule of the IoT device, whether or not the central device should send a third IP packet to the target device indicated by the IP address of the target device, wherein a destination address in a packet header of the third IP packet is the IP address of the target device, and a data portion in the packet body of the third IP packet is a data portion in the packet body of the first IP packet.
[0033] In some of several possible implementations, before the IoT device generates a first IP packet, the method further includes a step of the central device sending a second IP packet to the IoT device, where a source address in a packet header of the second IP packet is the IP address of the central device, and a step of the IoT device obtaining the IP address of the central device based on the packet header of the second IP packet.
[0034] In some of several possible implementations, before the IoT device generates a first IP packet, the method further includes the step of the central device sending a second IP packet to the IoT device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device, and the step of the IoT device obtaining the IP address of the central device based on the IP configuration in the packet body of the second IP packet.
[0035] In some of several possible implementations, the IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, and the method further includes the IoT device and the central device establishing the tunnel between the IoT device and the central device based on the tunnel identifier. The IoT device sending the first IP packet to the central device based on the IP address of the central device includes the IoT device sending the first IP packet to the central device based on the IP address of the central device through the tunnel.
[0036] In some of several possible implementations, the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and a source address in the packet body of the first IP packet is the tunnel IP address of the IoT device.
[0037] In some of multiple possible implementations, the IoT device generating the first IP packet includes:
[0038] When an application initiates an IP request, the IoT device generates the first IP packet for the application within the IoT device.
[0039] In some of several possible implementations, before the central device determines whether to send a third IP packet to the target device in accordance with a firewall rule of the IoT device, the method further includes:
[0040] The central device determines whether the IoT device has permission to send the third IP packet to the target device.
[0041] Determining whether the central device should send a third IP packet to the target device according to a firewall rule of the IoT device includes:
[0042] If the central device determines that the IoT device has permission to send the third IP packet to the target device, the central device determines whether to send the third IP packet to the target device in accordance with the firewall rules of the IoT device.
[0043] In some of multiple possible implementations, a source address in the packet header of the third IP packet is the IP address of the central device, or a source address in the packet header of the third IP packet is the IP address of the IoT device.
[0044] According to a fourth aspect, an apparatus is provided, the apparatus being included in an electronic device, the apparatus having functionality for implementing the behavior of the electronic device in the above aspects and multiple possible implementations of the above aspects. The functionality may be implemented by using hardware or by using hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functionality, such as, for example, a transceiver module or unit, a processing module or unit, or an acquisition module or unit.
[0045] Alternatively, the device may be an IoT device or a central device as described.
[0046] According to a fifth aspect, there is provided an apparatus including a processor, coupled to a memory, the memory configured to store computer programs or instructions, and the processor configured to execute the computer programs or instructions stored in the memory, thereby performing the method of the above aspect and several possible implementations of the above aspect.
[0047] For example, the processor is configured to execute computer programs or instructions stored in the memory, thereby causing the apparatus to perform the methods in the above aspects and multiple possible implementations of the above aspects.
[0048] Optionally, the apparatus includes one or more processors.
[0049] Optionally, the apparatus may further include a memory coupled to the processor.
[0050] Optionally, the device may include one or more memories.
[0051] Alternatively, the memory may be integral to the processor or may be located separately.
[0052] Optionally, the apparatus may further include a transceiver.
[0053] According to a sixth aspect, the present application provides an electronic device including one or more processors, a memory, a plurality of applications, and one or more computer programs, the one or more computer programs being stored in the memory, the one or more computer programs including instructions that, when executed by the electronic device, enable the electronic device to perform a packet transmission method in any possible implementation of any one of the aspects above.
[0054] Optionally, the electronic device may further include a touchscreen and / or a camera, the touchscreen including a touch-sensitive surface and a display.
[0055] Alternatively, the electronic device may be an IoT device or a central device as described above.
[0056] According to a seventh aspect, the present application provides a computer-readable storage medium comprising computer instructions which, when executed by an electronic device, enable the electronic device to perform a packet transmission method in any possible implementation of any one of the aspects described above.
[0057] According to an eighth aspect, the present application provides a computer program product, which, when executed by an electronic device, enables the electronic device to perform a packet transmission method in any possible implementation of any one of the aspects described above. [Brief description of the drawings]
[0058] [Figure 1] FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present application. [Diagram 2] 1 is a schematic block diagram of a packet transmission device according to an embodiment of the present application. [Diagram 3] 1 is a schematic diagram of a packet transmission method according to an embodiment of the present application; [Figure 4] 2 is a schematic diagram of an IP packet format according to one embodiment of the present application; [Diagram 5] 2 is a schematic diagram of the format of an IP packet 3 according to one embodiment of this application. [Figure 6] 2 is a schematic diagram of the format of an IP packet 6 according to one embodiment of the present application. [Figure 7] 2 is a schematic diagram of a response to a transmission of an IP packet according to one embodiment of the present application; [Figure 8] FIG. 2 is a schematic diagram of a software architecture of an IoT device according to an embodiment of the present application. [Figure 9] FIG. 2 is a schematic diagram of another packet transmission method according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0059] The following description will describe several technical solutions in several embodiments of this application with reference to several accompanying drawings in several embodiments of this application.
[0060] The terms "first" and "second" referred to below are intended for descriptive purposes only and should not be understood as an indication or suggestion of relative importance or an implicit indication of the number of technical features shown. Thus, a feature qualified by "first" or "second" may explicitly indicate one or more such features or may implicitly include such features.
[0061] As the Internet of Things develops and the number of IoT devices increases, the cost of the IoT devices becomes lower, so most of the IoT devices do not have firewall capabilities. In order to prevent the IoT devices from being attacked, a dedicated firewall device needs to be installed. For example, a router may be used as a firewall device to prevent the IoT devices from being attacked. However, the router is expensive and costs a lot of money. In the Internet of Things, many IoT devices do not have firewall capabilities, and some of the IoT devices have firewall capabilities. In embodiments of this application, some devices with firewall capabilities may be used as central devices of the IoT devices to protect the IoT devices, and the IP packets of the IoT devices may be securely transmitted to the target device. As shown in FIG. 1, two IoT devices are used as an example. The two IoT devices 110 transmit IP packets to be transmitted to the target device 130 to the central device 120. The central device 120 has firewall capabilities, and the central device 120 determines whether to forward the IP packets from the IoT device 110 to the target device 130 according to the firewall rules of the central device 120. The central device 120 may be used as a hub to aggregate traffic of IoT devices. For example, a home Internet of Things may include IoT devices such as power meters, water meters, wristbands, and watches. If a firewall device is not provided for the IoT devices, the data of the IoT devices may be attacked. The home Internet of Things includes some devices with firewall capabilities such as a TV or a sound box. In this case, the TV or the sound box may be used as a central device for the IoT devices, and send IP packets from the IoT devices to the server, cloud, or third-party device of the IoT devices.
[0062] For example, Fig. 2 is a schematic diagram of a configuration of an electronic device 200 according to an embodiment of the present application. The electronic device may be an IoT device, a central device, or a target device. The electronic device 200 may include a processor 210, a memory 220, a communication module 230, and a display 240, etc.
[0063] The processor 210 may include one or more processing units, and the memory 220 is configured to store program codes and data. In this embodiment of the application, the processor 210 may execute computer-executable instructions stored in the memory 220 to control and manage the operation of the electronic device 200.
[0064] The communication module 230 may be used for communication between multiple internal modules of the electronic device 200, or communication between the electronic device 200 and other external electronic devices, etc. For example, when the electronic device 200 communicates with other electronic devices through a wired connection method, the communication module 230 may include an interface such as a USB port. The USB port may be a port according to the USB standard specification, specifically, a mini USB port, a micro USB port, a USB type-C port, etc. The USB port may be configured to connect to a charger to charge the electronic device 200, or may be configured to transmit data between the electronic device 200 and a peripheral device, or may be configured to connect to a headset to play audio by using the headset. The port may further be configured to connect to other electronic devices such as an AR device.
[0065] Alternatively, communications module 230 may include audio components, radio frequency circuitry, a Bluetooth chip, a wireless fidelity (Wi-Fi) chip, a near-field communication (NFC) module, etc., and may implement interaction between electronic device 200 and other electronic devices in a number of different ways.
[0066] The display 240 is configured to display images, videos, etc. Optionally, the electronic device 200 may further include peripheral devices 250, such as, for example, a mouse, a keyboard, a speaker, or a microphone.
[0067] It should be understood that, except for the various components or modules listed in Figure 2, the configuration of electronic device 200 is not particularly limited in this embodiment of the application. In some of the other embodiments of the application, electronic device 200 may further include more or fewer components than those shown in the figure, may combine some components, may divide some components, or may have a number of different component arrangements. The components shown in the figure may be implemented using hardware, software, or a combination of software and hardware.
[0068] 3, the following describes a packet transmission method 300 according to an embodiment of the present application. The method 300 is performed by a central device and an IoT device.
[0069] S310: The central device may establish a session connection to the IoT device.
[0070] Specifically, in S310, the central device and the IoT device may negotiate a key for transmitting IP packets. The negotiated key is used to encrypt and authenticate subsequent session contents between the central device and the IoT device. In this way, the security of the session contents between the central device and the IoT device can be guaranteed.
[0071] Optionally, in the process of establishing a session connection between the central device and the IoT device, the IoT device can know the IP address of the central device, and the central device can also know the IP address of the IoT device. If the IoT device can know the IP address of the central device, the following process of sending IP packet 1 and obtaining the IP address of the central device in S320 and S330 may be omitted.
[0072] S320: The central device sends IP packet 1 to the IoT device, and the IoT device receives the IP packet 1 from the central device. For example, the IP packet 1 may be the above-mentioned second IP packet.
[0073] For example, the central device may encrypt IP packet 1 that it sends to the IoT device by using the encryption key negotiated in S310.
[0074] S330: The IoT device obtains the IP address of the central device based on IP packet 1.
[0075] For example, the IoT device may decrypt IP packet 1 based on the decryption key negotiated in S310 to obtain the IP address of the central device.
[0076] Specifically, the procedure of obtaining the IP address of the central device by the IoT device in S330 is described by the following two cases:
[0077] In case 1, the source address in the packet header of IP packet 1 is the IP address of the central device, and the IoT device obtains the IP address of the central device based on the packet header of IP packet 1.
[0078] In case 2, the packet body of IP packet 1 includes an IP configuration, which includes an IP address of the central device. The IoT device determines the IP address of the central device based on the IP configuration included in the packet body of IP packet 1.
[0079] Optionally, in case 2, in addition to the IP address of the central device, the IP configuration may further include a tunnel identifier, which is used to establish a tunnel between the central device and the IoT device, and which is used to indicate the tunnel IP address of the IoT device and the tunnel IP address of the central device.
[0080] For ease of explanation, it can be understood that the packet body of IP packet 1 includes an IP configuration, which may include an IP address of a central device and a tunnel identifier. In practical application, the IP address of the central device and the tunnel identifier may be carried in the packet body of multiple different IP packets. For example, the packet body of IP packet 1 includes IP configuration 1, which includes the IP address of the central device, the packet body of IP packet 2 includes IP configuration 2, which includes the tunnel identifier, and IP packet 1 and IP packet 2 are different IP packets. This is not limited in this application.
[0081] Alternatively, the IP configuration may not include the IP address of the central device, but may only include a tunnel identifier.
[0082] S340: If the IP configuration includes a tunnel identifier, the IoT device establishes a tunnel between the IoT device and the central device based on the tunnel IP address of the central device indicated by the tunnel identifier and the tunnel IP address of the IoT device.
[0083] A tunnel may be understood as a channel for transmitting IP packets between an IoT device and a central device. The tunnel established in S340 may also be a security-capable tunnel, supporting encryption and authentication. In this way, it is possible to ensure the security of IP packets transmitted through the tunnel.
[0084] S350: When an application of the IoT device initiates an IP request, the IoT device generates an IP packet 3 based on the IP address of the central device. For example, the IP packet 3 may be the first IP packet mentioned above, and the destination address (DA) in the packet header of the IP packet 3 is the IP address of the central device, and the DA in the packet body of the IP packet 3 is the IP address of the target device.
[0085] In the prior art, the DA in the packet header of the IP packet sent by the IoT device is the IP address of the target device. FIG. 4 shows the format of the IP packet sent by the IoT device in the prior art. As shown in FIG. 4, the source address (SA) is the IP address of the IoT device, and the DA is the IP address of the target device. In contrast, in this embodiment of the application, the IoT device encapsulates the IP address of the target device into the IP packet body based on the IP configuration, and uses the IP address of the central device as the destination address in the packet header of the IP packet to generate IP packet 3. The format of IP packet 3 is shown in FIG. 5. The SA in the packet header of IP packet 3 is the IP address of the IoT device, and the DA in the packet header of IP packet 3 is the IP address of the central device. The IP address of the target device is encapsulated in the packet body as the encapsulated IP data. If the IP configuration includes a tunnel identifier, as shown in FIG. 5, the SA in the packet body of IP packet 3 is the tunnel IP address of the IoT device indicated by the tunnel identifier. If the IP configuration does not include a tunnel identifier, the SA in the packet body of IP packet 3 may be empty and no address information is available.
[0086] When the IP configuration includes a tunnel identifier, as shown in FIG. 5, the SA in the packet body of IP packet 3 is the tunnel IP address of the IoT device indicated by the tunnel identifier. After executing S350, the central device may determine that the IP packet 3 is sent by the IoT device corresponding to the tunnel IP address of the IoT device. In addition, when the central device sends multiple tunnel identifiers to multiple IoT devices, the tunnel identifiers of the IoT devices are different. For example, tunnel identifier 1 indicates tunnel IP address 1 of IoT device 1 and the tunnel IP address of the central device, and tunnel identifier 2 indicates tunnel IP address 2 of IoT device 2 and the tunnel IP address of the central device. IoT device 1 sends IP packet 4 to the central device, and IoT device 2 sends IP packet 5 to the central device. The SA in the packet body of IP packet 4 is tunnel IP address 1, and the SA in the packet body of IP packet 5 is tunnel IP address 2. In this way, the central device may identify that IP packet 4 is an IP packet from IoT device 1 and IP packet 5 is an IP packet from IoT device 2 by identifying the source addresses in the packet bodies of IP packet 4 and IP packet 5.
[0087] For example, the central device may encrypt IP packet 3 that it sends to the IoT device by using the encryption key negotiated in S310. It should be noted that there is no limitation on the order of S340 and S350, and S340 may be performed before S350, after S350, or simultaneously with S350.
[0088] S360: The IoT device sends IP packet 3 to the central device based on the IP address of the central device, and the central device receives the IP packet 3 from the IoT device.
[0089] Optionally, if the IP configuration includes a tunnel identifier, under this circumstance, a tunnel is established between the IoT device and the central device, and S360 includes the steps of the IoT device sending an IP packet 3 to the central device through the established tunnel based on the IP address of the central device, and the central device receiving the IP packet 3 from the IoT device through the established tunnel. In this way, the IoT device and the central device transmit the IP packet 3 through the tunnel, improving security.
[0090] It can be understood that if the IP configuration of IP packet 1 does not include a tunnel identifier, it is not possible to establish any tunnel between the IoT device and the central device, and the IoT device may send IP packet 3 directly to the central device based on the IP address of the central device.
[0091] For example, the IoT device may decrypt IP packet 3 based on the decryption key negotiated at S310.
[0092] S370: The central device obtains the IP address of the target device in the packet body of IP packet 3.
[0093] Specifically, in S370, the central device parses IP packet 3, obtains the IP address of the target device in the packet body of IP packet 3, and uses the IP address of the target device as the destination address in the packet header of IP packet 6. For example, IP packet 1 may be the above-mentioned third IP packet.
[0094] S380: The central device determines whether or not to send IP packet 6 to the target device according to the firewall rules of the IoT device.
[0095] Specifically, the central device may set firewall rules for multiple IoT devices, and the central device may determine whether to send the IP packet 6 to the target device according to the firewall rules for the IoT devices in the method 300. For example, the firewall rules for the IoT devices stored by the central device may include at least one of an IP address, a port, and a protocol type of the target device. For example, the central device determines whether the IP address of the target device obtained in S370 is the IP address of the target device in the firewall rules that the IoT device is allowed to send, and if the IP address of the target device in the firewall rules, the central device sends the IP packet 6 to the target device. As another example, the central device determines the protocol type of the IP address of the target device obtained in S370, and if the protocol type of the IP address of the target device obtained in S370 is the allowed protocol type in the firewall rules, the central device sends the IP packet 6 to the target device. In yet another example, the central device determines a port corresponding to the IP address of the target device obtained in S370, and if the port corresponding to the IP address of the target device obtained in S370 is an allowed port in the firewall rules, the central device sends IP packet 6 to the target device.
[0096] Except that IP packet 3 and IP packet 6 have different packet headers, the data portion of IP packet 3 and the data portion of IP packet 6 are the same, and the destination address in the packet header of IP packet 3 is the IP address of the central device, and the destination address in the packet header of IP packet 6 is the IP address of the destination device.
[0097] If, at S380, the central device determines according to the central device's firewall rules that the IoT device is able to send IP packets to the target device, the central device executes S390, or if the central device determines according to the central device's firewall rules that the target device is disabled, the central device stops sending IP packet 6.
[0098] S380 is explained below in two cases.
[0099] In case 1, before S380, the central device determines whether the IoT device is authorized to send IP packets 6 to the target device. If the central device determines that the IoT device is authorized to send IP packets 6 to the target device, it executes S380. If the central device determines that the IoT device is not authorized to send IP packets 6 to the target device, it does not execute S380.
[0100] In case 2, if the central device determines to send the IP packet 6 to the target device according to the firewall rules of the central device after executing S380, the central device determines whether the IoT device has permission to send the IP packet 6 to the target device. If the central device has permission to send the IP packet 6 to the target device, the central device sends the IP packet 6 to the target device. If the central device does not have permission to send the IP packet 6 to the target device, the central device does not send the IP packet 6 to the target device. If the central device determines not to send the IP packet 6 to the target device according to the firewall rules of the central device after executing S380, the central device does not need to also determine whether the IoT device has permission to send the IP packet 6 to the target device.
[0101] S390: The central device transmits an IP packet 6 to the target device, and the target device receives the IP packet 6 from the central device.
[0102] In S390, IP packet 6 is explained below in two cases.
[0103] In case 1, the format of the IP packet 6 is shown in FIG. 6. The DA in the packet header of the IP packet 6 is the IP address of the target device, and the SA in the packet header of the IP packet 6 is the IP address of the central device. In the case of the target device, it is possible to know that the received IP packet 6 is an IP packet from the central device. In particular, the central device uses the IP address DA in order to transmit through the tunnel. , IP packet 6 encryption doAt times, the target device may decrypt the IP packet 6 by using a key between the target device and the central device and analyze the IP packet 6 from the central device.
[0104] In case 2, the format of the IP packet 6 may alternatively be shown in Fig. 4. The DA in the packet header of the IP packet 6 is the IP address of the target device, and the SA in the packet header of the IP packet 6 is the IP address of the IoT device. In the case of the target device, it is possible to know that the received IP packet 6 is not an IP packet from the central device but an IP packet from the IoT device.
[0105] It can be understood that in S320, the central device may send IP packet 1 to the IoT device once, and then execute S350 to S390 multiple times. Similarly, in S330, the IoT device may obtain an IP address of the central device once, and in S340, the IoT device may establish a tunnel once, and then execute S350 to S390 multiple times. In other words, the IoT device may receive IP packet 1 from the central device once, and then establish a tunnel based on the IP configuration in IP packet 1 once, and the IoT device may generate multiple IP packets to transmit data based on the obtained IP address of the central device.
[0106] In the method 300, the IoT device transmits IP packet 3 (or IP packet 6) to the target device by using the central device. Similarly, when the target device receives IP packet 6 from the IoT device forwarded by the central device, the target device may alternatively send the response of IP packet 6 to the IoT device by using the central device, rather than sending the response of IP packet 6 directly to the IoT device. With reference to the method 700 of FIG. 7, the following description describes a case where the target device is able to send the response of IP packet 6 to the IoT device by using the central device.
[0107] S710: After the target device receives IP packet 6, if the source address in the packet header of the IP packet 6 is the central device, the target device may send a response of IP packet 6 to the central device, and the central device receives the response of IP packet 6, and the response of IP packet 6 may be an IP packet.
[0108] In an alternative manner of S710, after the target device receives the IP packet 6, if the source address in the packet header of the IP packet 6 is the IP address of the IoT device, the target device may send a response of the IP packet 6 to the IoT device. In this case, the steps of the method 700 are not performed.
[0109] S720: After receiving the response of IP packet 6, the central device determines whether the response of IP packet 6 is valid according to the firewall rules of the central device. If the response is valid, that is, if the response of IP packet 6 is the response of IP packet 3, S730 is executed. If the response is not valid, the central device discards the response of IP packet 6.
[0110] S730: The central device sends a response of IP packet 3 to the IoT device via the tunnel established in S330, and the IoT device receives the response of IP packet 3.
[0111] It should be noted that the tunnel established in S340 may be a bidirectional tunnel. The IoT device may send the IP packet 3 to the central device through the bidirectional tunnel. The IoT device may also receive a response of the IP packet 3 from the central device, which may alternatively be an IP packet. Specifically, the IoT device determines whether the response IP packet is an IP packet from the central device based on the source address of the response IP packet. If the source address of the response IP packet is the IP address of the central device, it keeps the response IP packet, or if the source address of the response IP packet is not the source address of the central device, it discards the response IP packet. This can ensure that the IoT device does not receive packets from non-central devices, improving security.
[0112] FIG. 8 is a block diagram of a software configuration of an IoT device according to an embodiment of this application. In a layered architecture, the software is divided into multiple layers, each of which has a clear role and task. The layers communicate with each other through software interfaces. In some of the embodiments, the software configuration of the IoT device may include, from top to bottom, an application layer, an application framework layer, a system layer, and a kernel layer. The application layer is configured to store applications. The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes multiple predefined functions. The system layer may include multiple function modules of an operating system. The kernel layer is a layer between the hardware and the software. The kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver. A configuration module in the application layer of the IoT device and an operating system (OS) IP protocol stack module in the system layer may help complete the packet transmission method provided in the embodiments of this application. The processor 210 of the IoT device corresponds to the configuration module and the OS IP protocol stack module. For details, please refer to the description of the method 900 in Fig. 9. Fig. 9 mainly includes two processes of transmitting IP configuration and processing IP packets. For one transmission of IP configuration, multiple IP packets may be transmitted.
[0113] S901: The central device establishes a session connection to a configuration module of the IoT device.
[0114] It can be seen that in the process of establishing a session connection between the central device and the configuration module of the IoT device, a key for transmitting IP packets between the central device and the IoT device is negotiated.
[0115] Optionally, in the process of establishing a session connection between the central device and the configuration module of the IoT device, the configuration module of the IoT device can know the IP address of the central device, and the central device can also know the IP address of the IoT device. If the configuration module of the IoT device can know the IP address of the central device, the following processes of sending IP packet 1 and obtaining the IP address of the central device in S902 and S903 may be omitted.
[0116] S902: The central device sends IP packet 1 to the configuration module.
[0117] S903: The configuration module obtains the IP address of the central device based on the IP packet 1.
[0118] Specifically, the two cases of S903 and S330 are the same, except that the IoT device obtains the IP address of the central device in S330, whereas the configuration module obtains the IP address of the central device in S903. Specifically, the two cases are described as follows:
[0119] In case 1, the source address in the packet header of the IP packet 1 is the IP address of the central device, and the configuration module obtains the IP address of the central device based on the packet header of the IP packet 1. S904 is executed. In S904, the configuration module sends the IP address of the central device to the OS IP protocol stack module.
[0120] In case 2, the packet body of IP packet 1 includes an IP configuration, and the IP configuration includes an IP address of the central device. The configuration module determines the IP address of the central device based on the IP configuration included in the packet body of IP packet 1. S904 is executed. In S904, the configuration module sends the IP address of the central device to the OS IP protocol stack module.
[0121] Optionally, in case 2, in addition to the IP address of the central device, the IP configuration may further include a tunnel identifier. If the IP configuration includes the IP address of the central device and the tunnel identifier, S904 is executed. In S904, the IP address of the central device and the tunnel identifier are sent to the OS IP protocol stack module.
[0122] S904: The configuration module sends the IP address of the central device to the OS IP protocol stack module, or sends the IP address of the central device and a tunnel identifier.
[0123] S905: The OS IP protocol stack module stores the IP address of the central device, or stores the IP address of the central device and a tunnel identifier.
[0124] S906: If the OS IP protocol stack module stores the tunnel identifier, the OS IP protocol stack module establishes a tunnel based on the tunnel identifier.
[0125] It should be noted that S906 may be performed before S908, but there is no limitation on the order of S906, S907, and S908. S906 may be performed before S907 or S908, or S906 may be performed after S907 or S908, or S906 may be performed simultaneously with S907 or S908.
[0126] S907: When starting an application, the configuration module may send an IP request to the OS IP protocol stack module.
[0127] S908: The OS IP protocol stack module generates IP packet 3 based on the IP address of the central device.
[0128] Specifically, for the manner in which the OS IP protocol stack module generates IP packet 3, please refer to the description of S350.
[0129] S909: The OS IP protocol stack module forwards IP packet 3 to the central device through the tunnel established in S906.
[0130] S910 to S912 are the same as S370 to S390.
[0131] The following description describes typical application scenarios that are applied to the packet transmission methods provided in the embodiments of this application.
[0132] A user purchases a smart refrigerator from vendor A and has a smart TV from vendor A at home. The smart refrigerator does not have a firewall function, and the smart TV has a firewall function. Meanwhile, the router at home is a router from vendor B, and the router from vendor B at home is not configured with the firewall rules of the smart refrigerator from vendor A. In the prior art, in order to prevent the smart refrigerator from being attacked, it is necessary to purchase a dedicated router configured with the firewall rules of the smart refrigerator from vendor A, but the cost of purchasing a router is high. According to the packet transmission method provided in the embodiments of this application, after starting up the smart refrigerator from vendor A, the smart refrigerator from vendor A is discovered by the smart TV from vendor A, and then a secure session is established between the smart refrigerator from vendor A and the smart TV from vendor A. In addition, the smart TV from vendor A may be pre-configured with the firewall rules of the smart refrigerator from vendor A. Vendor A's smart refrigerator generates IP packet 3 according to the embodiment of the above method, the destination address in the packet header of IP packet 3 is Vendor A's smart TV, and the IP address of the actual target device of IP packet 3 is in the packet body of IP packet 3. Thus, Vendor A's smart refrigerator may first route IP packet 3 to Vendor A's smart TV, which parses IP packet 3 to obtain the IP address of the target device in the packet body of IP packet 3. Vendor A's smart TV determines whether the target device is valid according to the smart refrigerator's firewall rules. If the target device is valid, Vendor A's smart TV sends IP packet 6 to the target device, the data portion of IP packet 6 is the data portion of IP packet 3, and the destination address in the packet header of IP packet 6 is the IP address of the target device.In this way, the smart TV of Vendor A routes IP packets 3 from the smart refrigerator of Vendor A to the target device, avoiding the purchase of a dedicated routing device just for the smart refrigerator of Vendor A. This can reduce costs.
[0133] It can be understood that in addition to the above household Internet of Things scenario, the packet transmission method provided in the embodiments of this application may alternatively be applied to scenarios such as smart grid, smart agriculture, intelligent transportation, and environment detection, etc. In order to avoid repetitive description, details will not be described in this embodiment of this application.
[0134] In this embodiment, in addition to dividing the IoT device in FIG. 9 into configuration modules and OS IP modules, the IoT device and the central device may be divided into multiple functional modules according to the above method example. For example, each functional module may be obtained by dividing the respective functions, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in the form of hardware. It should be noted that in the embodiments, the division into multiple modules is just one example and is merely a logical division of functions, and may be other divisions in actual implementation.
[0135] It should be noted that all relevant contents of the steps in the above method embodiments may be cited in the functional description of the corresponding functional modules, and the details will not be described repeatedly in this specification.
[0136] The IoT device and the central device provided in this embodiment are configured to execute the above packet transmission method, and thus can achieve the same effect as the above implementation method. When using an integrated unit, each of the IoT device and the central device may include a processing module, a storage module, and a communication module. The processing module may be configured to control and manage the operation of the IoT device, and the central device may be configured, for example, to assist the electronic device to execute the steps executed by the processing unit. The storage module may be configured to assist the IoT device and the central device to execute stored program codes, data, etc. The communication module may be configured to assist the IoT device and the central device to communicate with other devices.
[0137] The processing module may be a processor or a controller. The processing module may implement or execute the logic blocks, modules, and circuits in the various examples described with reference to the disclosed subject matter in this application. The processor may alternatively be a combination including one or more microprocessors, and a combination implementing a computing function, such as a combination of a digital signal processor (DSP) and a microprocessor. The storage module may be a memory. The communication module may be a device such as a radio frequency circuit, a Bluetooth chip, or a Wi-Fi chip that interacts with other electronic devices, among others.
[0138] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device in this embodiment may be a device having the configuration shown in FIG.
[0139] This embodiment further provides a computer-readable storage medium, which stores computer instructions that, when executed by an electronic device, enable the electronic device to implement the steps of the relevant method above to implement the secure data access method in the above embodiments.
[0140] This embodiment further provides a computer program product, which, when executed by a computer, enables the computer to execute the relevant steps above to implement the secure data access method in the above embodiments.
[0141] In addition, an embodiment of this application further provides an apparatus, which may specifically be a chip, a component, or a module, and which may include a processor and a memory connected to each other. The memory is configured to store computer-executable instructions. When the apparatus operates, the processor may execute the computer-executable instructions stored in the memory, thereby causing the chip to perform the secure data access method in the above method embodiments.
[0142] The electronic device, computer storage medium, computer program product, or chip provided in this embodiment is all configured to execute the corresponding method provided above. Therefore, the beneficial effects that the electronic device, computer storage medium, computer program product, or chip can achieve should be referred to the beneficial effects in the corresponding method provided above. Details are not described repeatedly in this specification.
[0143] Based on the above description of the implementations, those skilled in the art can understand that, for convenience and simplicity of description, the above division into the multiple functional modules is used as an example in the illustration. In actual application, the above functions may be assigned to multiple different functional modules and implemented based on requirements, i.e., the internal configuration of a device is divided into multiple different functional modules to implement all or part of the above described functions.
[0144] It should be understood that in some of the embodiments provided in this application, the disclosed apparatus and method can be implemented in other ways. For example, the embodiment of the described apparatus is merely one example. For example, the division into multiple modules or multiple units is merely a logical division of functions, and other divisions may be used in actual implementation. For example, multiple units or components may be combined or integrated into another apparatus, or some of the features may be ignored or not implemented. In addition, the mutual coupling, direct coupling, or communication connection shown or described may be implemented by some of the interfaces. Indirect coupling or communication connection between multiple apparatuses or multiple units may be implemented by electrical, mechanical, or other forms.
[0145] The units described as separate parts may or may not be physically separated, and the parts shown as units may be one or more physical units, located in one place or distributed across multiple different places. Based on actual requirements, some or all of the units may be selected to achieve the objectives of the solutions of the embodiments.
[0146] In addition, multiple functional units in multiple embodiments of this application may be integrated into one processing unit, and each of the multiple units may exist physically alone, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware or a software functional unit.
[0147] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of this application may be essentially implemented in the form of a software product, or the part contributing to the prior art or all or part of the technical solutions. The software product is stored in a storage medium and includes some instructions, which instruct a device or processor (which may be a single-chip microcomputer or chip, etc.) to execute all or part of the steps of the methods in the embodiments of this application. The above storage medium includes any medium, such as a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, capable of storing program code.
[0148] The above description is merely a specific implementation of this application, but is not intended to limit the scope of protection of this application. Any variations or replacements that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application shall fall within the scope of protection of this application. Therefore, the scope of protection of this application shall be subject to the scope of protection of the claims.
Claims
1. A packet transmission method, comprising: generating, by an Internet of Things (IoT) device, a first Internet Protocol (IP) packet, a destination address in a packet header of the first IP packet being an IP address of a central device and a destination address in a packet body of the first IP packet being an IP address of a target device; sending, by the IoT device, a third IP packet to the central device based on the IP address of the central device, wherein the central device is configured to forward the third IP packet to the target device according to a firewall rule of the IoT device, a destination address in a packet header of the third IP packet is the IP address of the target device, and a data portion in a packet body of the third IP packet is a data portion in the packet body of the first IP packet; the IoT device does not have firewall capabilities, the central device has the firewall capabilities, and the central device is configured with the firewall rules of the IoT device; method.
2. Prior to the step of generating, by the IoT device, a first Internet Protocol (IP) packet, the method further comprises: receiving, by the IoT device, a second IP packet from the central device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device; and obtaining, by the IoT device, the IP address of the central device based on the IP configuration in the packet body of the second IP packet.
3. The IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, the method comprising: establishing, by the IoT device, the tunnel between the IoT device and the central device based on the tunnel identifier; The step of transmitting, by the IoT device, the first IP packet to the central device based on the IP address of the central device, further comprising:
3. The method of claim 2, comprising transmitting, by the IoT device, the first IP packet through the tunnel to the central device based on the IP address of the central device.
4. 4. The method of claim 3, wherein the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and a source address in the packet body of the first IP packet is the tunnel IP address of the IoT device.
5. Prior to the step of generating, by the IoT device, a first Internet Protocol (IP) packet, the method further comprises: receiving, by the IoT device, a second IP packet from the central device, where a source address in a packet header of the second IP packet is the IP address of the central device; and obtaining, by the IoT device, the IP address of the central device based on the packet header of the second IP packet.
6. The step of generating a first IP packet by the IoT device includes:
6. A method according to any one of claims 1 to 5, comprising generating, by the IoT device, a first IP packet of the application in the IoT device when the application initiates an IP request.
7. A packet transmission method, comprising: receiving, by a central device, a first Internet Protocol (IP) packet from an Internet of Things (IoT) device, where a destination address in a packet header of the first IP packet is an IP address of the central device and a destination address in a packet body of the first IP packet is an IP address of a target device; obtaining, by the central device, the IP address of the target device in the packet body of the first IP packet; determining, by the central device, according to a firewall rule of the IoT device, whether to send a third IP packet to the target device indicated by the IP address of the target device, where a destination address in a packet header of the third IP packet is the IP address of the target device, and a data portion in a packet body of the third IP packet is a data portion in the packet body of the first IP packet; the IoT device does not have firewall capabilities, the central device has the firewall capabilities, and the central device is configured with the firewall rules of the IoT device; method.
8. Prior to the step of receiving, by the central device, a first IP packet from the IoT device, the method further comprises:
8. The method of claim 7, further comprising the step of sending, by the central device, a second IP packet to the IoT device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device.
9. The IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, the method comprising: Establishing, by the central device, the tunnel between the central device and the IoT device based on the tunnel identifier; The step of receiving, by the central device, a first IP packet from the IoT device, 9. The method of claim 8, comprising receiving, by the central device, the first IP packet from the IoT device via the tunnel.
10. 10. The method of claim 9, wherein the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and a source address in the packet body of the first IP packet is the tunnel IP address of the IoT device.
11. Prior to the step of receiving, by the central device, a first IP packet from the IoT device, the method further comprises:
8. The method of claim 7, further comprising the step of sending, by the central device, a second IP packet to the IoT device, wherein a source address in a packet header of the second IP packet is the IP address of the central device.
12. Prior to the step of determining, by the central device, whether to send a third IP packet to the target device according to a firewall rule of the IoT device, the method further comprises: determining, by the central device, whether the IoT device is authorized to send the third IP packet to the target device; determining, by the central device, whether to send a third IP packet to the target device according to a firewall rule of the IoT device; 12. The method of claim 7, further comprising: if the central device determines that the IoT device is authorized to send the third IP packet to the target device, determining by the central device whether to send the third IP packet to the target device in accordance with the firewall rules of the IoT device.
13. 13. The method of claim 7, wherein a source address in the packet header of the third IP packet is the IP address of the central device or a source address in the packet header of the third IP packet is the IP address of the IoT device.
14. A packet transmission method, comprising: generating, by an Internet of Things (IoT) device, a first Internet Protocol (IP) packet, a destination address in a packet header of the first IP packet being an IP address of a central device and a destination address in a packet body of the first IP packet being an IP address of a target device; sending, by the IoT device, the first IP packet to the central device based on the IP address of the central device; obtaining, by the central device, the IP address of the target device in the packet body of the first IP packet; determining, by the central device, according to a firewall rule of the IoT device, whether to send a third IP packet to the target device indicated by the IP address of the target device, where a destination address in a packet header of the third IP packet is the IP address of the target device, and a data portion in a packet body of the third IP packet is a data portion in the packet body of the first IP packet; the IoT device does not have firewall capabilities, the central device has the firewall capabilities, and the central device is configured with the firewall rules of the IoT device; method.
15. Prior to the step of generating, by the IoT device, a first IP packet, the method further comprises: sending, by the central device, a second IP packet to the IoT device, a packet body of the second IP packet including an IP configuration, the IP configuration including the IP address of the central device; 15. The method of claim 14, further comprising: obtaining, by the IoT device, the IP address of the central device based on the IP configuration in the packet body of the second IP packet.
16. The IP configuration further includes a tunnel identifier used to establish a tunnel between the IoT device and the central device, the method comprising: establishing, by the IoT device and the central device, the tunnel between the IoT device and the central device based on the tunnel identifier; The step of transmitting, by the IoT device, the first IP packet to the central device based on the IP address of the central device, further comprising:
16. The method of claim 15, comprising transmitting, by the IoT device, the first IP packet via the tunnel to the central device based on the IP address of the central device.
17. 17. The method of claim 16, wherein the tunnel identifier is used to indicate a tunnel IP address of the IoT device and a tunnel IP address of the central device, and a source address in the packet body of the first IP packet is the tunnel IP address of the IoT device.
18. Prior to the step of generating, by the IoT device, a first IP packet, the method further comprises: sending, by the central device, a second IP packet to the IoT device, where a source address in a packet header of the second IP packet is the IP address of the central device; 15. The method of claim 14, further comprising: obtaining, by the IoT device, the IP address of the central device based on the packet header of the second IP packet.
19. The step of generating a first IP packet by the IoT device includes:
19. A method according to any one of claims 14 to 18, comprising generating, by the IoT device, a first IP packet of the application in the IoT device when the application initiates an IP request.
20. Prior to the step of determining, by the central device, whether to send a third IP packet to the target device according to a firewall rule of the IoT device, the method further comprises: determining, by the central device, whether the IoT device is authorized to send the third IP packet to the target device; determining, by the central device, whether to send a third IP packet to the target device according to a firewall rule of the IoT device; 20. The method of claim 14, further comprising: if the central device determines that the IoT device is authorized to send the third IP packet to the target device, determining by the central device whether to send the third IP packet to the target device in accordance with the firewall rules of the IoT device.
21. 21. The method of claim 14, wherein a source address in the packet header of the third IP packet is the IP address of the central device or a source address in the packet header of the third IP packet is the IP address of the IoT device.
22. 14. An electronic device including a processor, coupled to a memory, the processor configured to execute computer programs or instructions stored in the memory, whereby the electronic device implements a method according to any one of claims 1 to 13.
23. A computer readable storage medium storing computer instructions that, when executed by an electronic device, enable the electronic device to perform the method of any one of claims 1 to 13.
24. A computer program, when executed by an electronic device, enabling said electronic device to carry out the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Data communication method, data communication system, data relay device, server, program and recording medium
JP2002358253A
System and method for protecting network device
JP2019208219A
Methods and systems for identifying data sessions at a VPN gateway
US20170272554A1
