Processing method and device in router connection
By setting packet redirection and ebtables filtering in bridge mode in the router, the problem of failed WIFI connection between the router and the terminal device is solved, and stable communication smoothness and user experience improvement is achieved.
Patent Information
- Application Number
- CN202310639227.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-05-31
AI Technical Summary
In the WIFI connection between the router and the terminal device, there is a failure in the connection, especially when the router establishes a network with other routing devices and is in bridge mode, resulting in data packets being forwarded to other routing devices within the network, causing communication Interrupt.
By setting the received packets in the bridge mode in the router to redirect to the local machine and returning the response message to the terminal device, using prerouting and input in ebtables to filter and modify the packets, ensure that the packets are not forwarded to the network The second router within realizes stable communication between the terminal device and the first router.
It effectively solves the problem of WIFI connection failure, ensures smooth communication between the terminal device and the router, and improves the reliability and user experience of WIFI connection.
Smart Images

Figure CN119071878A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a processing method and device in router connection. Background Art
[0002] With the popularization and development of the Internet, wireless fidelity (WIFI) technology has been widely used in daily life and office scenarios. WIFI technology is a wireless local area network technology based on the Institute of Electrical and Electronics Engineers (IEEE) 802.11 standard.
[0003] Normally, a terminal device can connect to a router by scanning the QR code corresponding to the router, and then connect to the Internet.
[0004] However, in some scenarios, there may be a situation where the WIFI connection fails. Summary of the invention
[0005] The embodiments of the present application provide a processing method and device in router connection to achieve a successful WIFI connection between a first router and a terminal device.
[0006] In the first aspect, the embodiment of the present application provides a processing method in router connection, which is applied to a first router, and the method includes: the first router and the second router establish a network, the working mode of the first router is a bridge mode, the first router is a slave router in the network, and the second router is a master router in the network; the first router and the terminal device establish a first WIFI connection based on the first WIFI SSID and the first WIFI password; after the first WIFI connection, the first router receives a first request from the terminal device; the first router sends a first message to the terminal device, the first message includes: a second WIFI SSID and a second WIFI password, and the first message is a message generated by the first router in response to the first request; the first router and the terminal device establish a second WIFI connection based on the second WIFI SSID and the second WIFI password. In this way, when the first router and the second router establish a network, the first router can redirect the data packet received in the bridge mode to the local machine, and return the response message corresponding to the data packet to the terminal device to ensure the communication between the terminal device and the first router, thereby realizing the WIFI connection.
[0007] In a possible implementation, the IP address of the device that initiates the first message indicated in the first message is the IP address of the first router, and / or the MAC address of the device that initiates the first message indicated in the first message is the MAC address of the first router.
[0008] In a possible implementation, the first router includes a first network card and a first bridge, the first network card is mounted under the first bridge, and before the first router sends a first message to the terminal device, the method further includes: when the first router determines that the first network card that transmits the first request is a preset network card based on the first request, the first router modifies the first parameter corresponding to the first request to a second parameter, and modifies the third parameter corresponding to the first request to a fourth parameter, wherein the first parameter is used to indicate the destination MAC address of the first request, the second parameter is the MAC address of the first router, the third parameter is used to indicate the data packet type of the first request, and the fourth parameter is the data packet type sent to the local machine; the first router generates a first message corresponding to the first request based on the second parameter and the fourth parameter. In this way, the router can intercept the data packet transmitted by the terminal device through the preset network card through the preset network card, and redirect it to the local route so that the message will not be transmitted to the second router in the network to reduce the situation of WIFI connection failure. Among them, the first network card is wl1.5 and the first bridge is br2.
[0009] In a possible implementation, the first router includes ebtables, and ebtables includes prerouting. When the first router determines that the first network card transmitting the first request is the preset network card based on the first request, the first router modifies the first parameter corresponding to the first request to the second parameter, and modifies the third parameter corresponding to the first request to the fourth parameter, including: when prerouting determines that the first network card transmitting the first request is the preset network card based on the first request, prerouting modifies the first parameter to the second parameter, and modifies the third parameter to the fourth parameter. In this way, the ebtables of the router can filter data packets at the monitoring entrance prerouting.
[0010] In a possible implementation, ebtables also includes: the first input, prerouting and the first input are all in the data link layer, and the first router generates a first message corresponding to the first request based on the second parameter and the fourth parameter, including: prerouting sends the first request to the network layer through the first input based on the second parameter and the fourth parameter; the network layer sends the first request to the application layer through the transport layer; the application process in the application layer generates the first message corresponding to the first request. In this way, the first input in the router can realize the transmission of the first request to the network layer, and the network layer sends the first request to the application layer through the transport layer, so that the application process in the application layer can respond to the first request, reducing the situation where the forward in ebtables forwards the first request to the second router.
[0011] In a possible implementation, the first router receives the first request from the terminal device, including: the first router receives the first request sent by the terminal device based on the first gateway address; the first gateway address is an address corresponding to the first bridge. In this way, after the first router establishes the first WIFI connection with the terminal device, the terminal device can communicate with the first router through the first gateway address.
[0012] The first gateway address may be preset in a small program of the terminal device.
[0013] In a possible implementation, before the first router receives the first request from the terminal device, the method further includes: the first router receives a second request sent from the terminal device, the second request is used to obtain the IP address of the terminal device; the first router sends the second request to the second router; the first router receives a second message from the second router, the second message includes the IP address allocated by the second router to the terminal device, and the second message is a message generated by the second router in response to the second request; the first router sends the second message to the terminal device.
[0014] It can be understood that in bridge mode, the first router acting as a slave router can forward the second request sent by the terminal device to the second router, and the second router responds to generate a second message, and then the second router can return the second message to the terminal device through the first router, thereby realizing IP address allocation for the terminal device.
[0015] In a possible implementation, the first WIFI connection is a local area network connection. In this way, the first router can automatically obtain the WIFI connection information that can access the Internet from the first router through the local area network connection.
[0016] In a possible implementation manner, the first WIFI SSID and the first WIFI password are determined based on attribute parameters of the first router, and the attribute parameters include: the first router SN.
[0017] In a second aspect, an embodiment of the present application provides a processing device in a router connection, which is applied to a processing unit and a communication unit, the communication unit being used to establish a network with a second router, the working mode of the first router being a bridge mode, the first router being a slave router in the network, and the second router being a master router in the network; the communication unit being also used to establish a first WIFI connection with a terminal device based on a first WIFI SSID and a first WIFI password; after the first WIFI connection, the communication unit being also used to receive a first request from the terminal device; the communication unit being also used to send a first message to the terminal device, the first message including: a second WIFI SSID and a second WIFI password, the first message being a message generated by the first router in response to the first request; the communication unit being also used to establish a second WIFI connection with the terminal device based on the second WIFI SSID and the second WIFI password.
[0018] In a possible implementation, the IP address of the device that initiates the first message indicated in the first message is the IP address of the first router, and / or the MAC address of the device that initiates the first message indicated in the first message is the MAC address of the first router.
[0019] In a possible implementation, the first router includes a first network card and a first bridge, the first network card is mounted under the first bridge, and the processing unit is further used to: when it is determined based on the first request that the first network card transmitting the first request is a preset network card, modify the first parameter corresponding to the first request to a second parameter, and modify the third parameter corresponding to the first request to a fourth parameter, wherein the first parameter is used to indicate the destination MAC address of the first request, the second parameter is the MAC address of the first router, the third parameter is used to indicate the data packet type of the first request, and the fourth parameter is the data packet type sent to the local machine; based on the second parameter and the fourth parameter, generate a first message corresponding to the first request.
[0020] In a possible implementation, the first router includes ebtables, and ebtables includes prerouting. When prerouting determines, based on the first request, that the first network card that transmits the first request is a preset network card, the processing unit is specifically used to modify the first parameter to the second parameter, and to modify the third parameter to the fourth parameter.
[0021] In a possible implementation, ebtables also includes: a first input, prerouting and the first input are all in the data link layer, a processing unit, specifically used to send the first request to the network layer through the first input based on the second parameter and the fourth parameter; the processing unit, further specifically used to send the first request to the application layer through the transport layer; the processing unit, further specifically used to generate a first message corresponding to the first request.
[0022] In a possible implementation, the communication unit is specifically configured to receive a first request sent from a terminal device based on a first gateway address; the first gateway address is an address corresponding to the first network bridge.
[0023] In one possible implementation, the communication unit is further used to: receive a second request sent from the terminal device, the second request is used to obtain the IP address of the terminal device; send a second request to the second router; receive a second message from the second router, the second message includes the IP address allocated by the second router to the terminal device, and the second message is a message generated by the second router in response to the second request; and send the second message to the terminal device.
[0024] In a possible implementation manner, the first WIFI connection is a local area network connection.
[0025] In a possible implementation manner, the first WIFI SSID and the first WIFI password are determined based on attribute parameters of the first router, and the attribute parameters include: the first router SN.
[0026] In a third aspect, an embodiment of the present application provides a router, comprising: a processor and a memory, wherein the memory is used to store a computer program; the processor is used to call and execute the computer program so that the router performs the method in the first aspect and any possible implementation thereof.
[0027] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program. When the computer program is run on a computer, the computer executes the method in the first aspect and any possible implementation thereof.
[0028] In a fifth aspect, the present application provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the method in the first aspect and any possible implementation thereof.
[0029] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can refer to the beneficial effects of the first aspect and any possible implementation thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram of a scenario provided for an embodiment of the present application;
[0031] Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;
[0032] Figure 3 A schematic diagram of the hardware structure of a router provided in an embodiment of the present application;
[0033] Figure 4 A schematic diagram of a network architecture provided for an embodiment of the present application;
[0034] Figure 5 A schematic diagram of the structure of ebtables provided in an embodiment of the present application;
[0035] Figure 6 Another schematic diagram of a network structure provided in an embodiment of the present application;
[0036] Figure 7 A flowchart of a processing method in a router connection provided in an embodiment of the present application;
[0037] Figure 8 A schematic diagram of message transmission provided in an embodiment of the present application;
[0038] Fig. 9 A schematic diagram of the structure of a router connection device provided in an embodiment of the present application;
[0039] Fig.10 A schematic diagram of the hardware structure of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] To facilitate understanding of the embodiments of the present application, some terms involved in the present application are first briefly explained.
[0041] 1. Network interface card
[0042] A network interface card, also known as a NIC, is a piece of computer hardware designed to allow computers to communicate on a computer network. It can also be understood as a computer hardware device that allows network connections.
[0043] The network card may also be called: a network interface controller, an Ethernet card, a local area network card, a network adapter or a network adapter card, etc. The embodiments of the present application do not limit this.
[0044] The main functions of the network card include data encapsulation and decapsulation, link management, data encoding and decoding, etc. The network card can be an intermediate medium between the computer or server and the data network. Specifically, as an interface of the TCP / IP layer, the network card can transmit signals at the physical layer and transmit data packets at the network layer.
[0045] It is understandable that each network card has a unique serial number called a hardware address (media access control address, MAC address).
[0046] According to the network connection method, network cards can include: wired network cards and wireless network cards. A wired network card requires a jumper (e.g., Ethernet jumper, fiber jumper, etc.) to connect a node to the network; a wireless network card has a small antenna and uses radio waves to communicate with an access point to access the wireless network. For example, a wired network card can correspond to an Ethernet interface (or eth interface for short); a wireless network card can correspond to a wireless local area network (WLAN) interface (or wl interface for short).
[0047] 2. Network bridge
[0048] A device that implements relaying and forwarding frames at the link layer. A bridge can also be understood as a device used to forward data at the data link layer. A bridge can also be called a bridge.
[0049] The network bridge can connect the interfaces corresponding to the network cards. For example, the network bridge can connect two Ethernet interfaces, or connect an Ethernet interface with a wireless interface, or connect two wireless interfaces, etc.
[0050] A bridge is a storage / forwarding device that connects two LANs and can forward packets purposefully based on MAC addresses. When a bridge receives a frame, it can determine the network interface to forward the frame based on the destination MAC address in the frame. Alternatively, a bridge can divide a large LAN into multiple segments, or interconnect more than two LANs into a logical LAN, so that all users on the LAN can access the server.
[0051] 3. Bridge mode and routing mode
[0052] Both bridge mode and routing mode are working modes of the router.
[0053] In bridge mode, the router will establish a wireless connection with another wireless router that can access the Internet to amplify the wireless signal on the wireless router that can access the Internet. A router in bridge mode is equivalent to a switch and can perform data forwarding functions.
[0054] For example, a router can be networked with other routing devices, in which case the router can be a slave router, and other routing devices in the network can include a master router. When a slave router in bridge mode receives a data packet, the slave router can forward the data packet to the master router in the network through the bridge.
[0055] In routing mode, the router is equivalent to an ordinary wireless broadband router. It can access the Internet through the point-to-point protocol over Ethernet (PPPOE) or dynamic host configuration protocol (DHCP), and can also respond to received data packets.
[0056] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first value and the second value are only used to distinguish different values, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0057] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0058] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0059] For example, Figure 1 A schematic diagram of a scenario provided in an embodiment of the present application. Figure 1 As shown, the scenario may include: a terminal device 101 and a router 102, and the terminal device 101 may be a mobile phone.
[0060] After the user purchases the router 102, the user may need to configure the router 102 according to different Internet access methods, and access the WIFI network by connecting to the router 102 after the configuration is completed. Further, the terminal device 101 can open the setting function based on the user operation, search for WIFI signals when receiving the user opening WIFI search, establish a connection with the router 102 when receiving the user triggering any WIFI and entering the password corresponding to any WIFI, and realize wireless Internet access.
[0061] In the above scenario, the user needs to manage the WIFI password entered when connecting to the router. It is difficult for the user to connect to the router if he does not know the WIFI password. Therefore, the terminal device and the router in the embodiment of the present application can both support a one-scan connection function, that is, the terminal device connects to the router WIFI by scanning the QR code (such as the mini program code) corresponding to the router.
[0062] Specifically, the terminal device can first establish a local area network connection (such as a first WIFI connection) with the router by directly scanning the small program code preset in the router, and then automatically obtain the WIFI connection information that can access the Internet through the local area network connection, and then establish a WIFI connection that can access the Internet through the router. Users only need to scan the QR code preset in the router (such as the small program code) to achieve automatic WIFI connection without actively entering information such as the WIFI password, which brings a better connection experience to users.
[0063] However, when the router establishes a network with other routing devices and the router works in bridge mode, the data packets sent by the terminal device to the router can be forwarded by the router to other routing devices in the network, causing the WIFI connection between the router and the terminal device to fail.
[0064] In view of this, an embodiment of the present application provides a processing method in router connection. When a first router and a second router establish a network, the first router can redirect the data packet received in bridge mode to the local machine, and return the response message corresponding to the data packet to the terminal device to ensure the communication between the terminal device and the first router, thereby realizing WIFI connection.
[0065] The above-mentioned terminal devices can be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. For example, the terminal device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the terminal device.
[0066] In order to better understand the embodiment of the present application, the structure of the terminal device of the embodiment of the present application is introduced below. Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application.
[0067] like Figure 2As shown, the terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194, etc.
[0068] The sensor module 180 may include one or more of the following, for example: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, or a bone conduction sensor.
[0069] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0070] The processor 110 may include one or more processing units. Different processing units may be independent devices or integrated into one or more processors. The processor 110 may also be provided with a memory for storing instructions and data.
[0071] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal device, and can also be used to transfer data between the terminal device and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other devices, such as AR devices, etc.
[0072] The charging management module 140 is used to receive charging input from a charger, which may be a wireless charger or a wired charger. The power management module 141 is used to connect the charging management module 140 to the processor 110 .
[0073] The wireless communication function of the terminal device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160 and baseband processor.
[0074] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The antenna in the terminal device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna.
[0075] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to terminal devices. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modem for demodulation.
[0076] The wireless communication module 160 can provide wireless communication solutions applied to terminal devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), etc.
[0077] The modem may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker, a receiver, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem may be an independent device. In other embodiments, the modem may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0078] The terminal device realizes the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.
[0079] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the terminal device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0080] The terminal device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0081] The camera 193 is used to capture static images or videos. In some embodiments, the terminal device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0082] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0083] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area.
[0084] The terminal device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
[0085] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Speaker 170A, also known as "speaker", is used to convert audio electrical signals into sound signals. The terminal device can listen to music or listen to hands-free calls through speaker 170A. Receiver 170B, also known as "earpiece", is used to convert audio electrical signals into sound signals. When the terminal device answers a call or voice message, the voice can be answered by placing receiver 170B close to the human ear. Headphone interface 170D is used to connect wired headphones. Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. In an embodiment of the present application, the terminal device may have a microphone 170C.
[0086] The button 190 includes a power button, a volume button, etc. The button 190 may be a mechanical button. It may also be a touch button. The terminal device may receive the button input and generate a key signal input related to the user settings and function control of the terminal device. The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, message, missed call, notification, etc.
[0087] In addition, on top of the above components, the device also runs an operating system, such as an iOS operating system, an Android operating system, or a Windows operating system, etc. Applications can be installed and run on the operating system.
[0088] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture, etc., which will not be elaborated here.
[0089] For example, Figure 3 A schematic diagram of the hardware structure of a router provided in an embodiment of the present application. Figure 3 As shown, the router may include: a processor 210, a wireless communication module 220, a memory 230, a power module 240, a communication interface 250, a switch 260, and an antenna.
[0090] The processor 210 may include one or more processing units, for example, the processor 210 may include a CPU, a GPU, a DSP, an ISP, an AP, an NPU, a modem processor, a controller, a video codec, a baseband processor, etc. In some embodiments, different processing units may be independent devices or integrated into one or more processors. Among them, the CPU is the final execution unit for information processing and program running, and its main tasks include processing instructions, executing operations, controlling time, and processing data. The CPU may include a controller, an arithmetic unit, a cache memory, and a bus for connecting these components.
[0091] The wireless communication module 220 can provide wireless communication such as Wi-Fi, frequency modulation (FM), Bluetooth or NFC. The wireless communication module 220 can be one or more devices integrating at least one communication processing module. The wireless communication module 220 receives electromagnetic waves via an antenna, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 220 can also receive the signal to be sent from the processor 210, modulate and amplify it, and convert it into electromagnetic waves for radiation through the antenna.
[0092] The memory 230 can be used to store computer executable program codes, and the executable program codes include computer instructions. The processor 210 executes various functions and data processing by running the instructions stored in the memory 230. The memory 230 may include a program storage area and a data storage area. Among them, the program storage area may store at least one application required for a function (such as generating a key, sending a request, etc.). The data storage area may store target data, keys, etc. received from other devices. In addition, the memory 230 may include a high-speed random access memory, and may also include a non-volatile memory, etc.
[0093] The power module 240 can be used to receive power input, store electrical energy, and provide power to the processor 210, the wireless communication module 220, the memory 230, etc.
[0094] The communication interface 250 can be used to communicate with external devices such as electronic devices, mobile hard disks, and USB flash drives. The communication interface 250 can be any possible interface such as a network port or a universal serial bus (USB) interface.
[0095] The switch 260 is used to trigger the router to be turned on or off.
[0096] In the above Figure 2 as well as Figure 3 Based on the corresponding hardware architecture, the following combination Figure 4 The network architecture in describes the network connection process.
[0097] For example, Figure 4 A schematic diagram of a network architecture provided in an embodiment of the present application. Figure 4 As shown, the network architecture includes: application layer, transport layer, network layer, data link layer (or link layer for short) and physical layer.
[0098] The application layer is where network applications and their application layer protocols reside. Application layer protocols are distributed on multiple end systems, and applications in two end systems use application layer protocols to exchange information packets. This information packet at the application layer is called a message.
[0099] Application layer protocols include: Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP), Domain Name System (DNS), etc. HTTP provides the request and transmission of web documents; SMTP provides the transmission of email messages; FTP provides file transfer between two end systems; DNS converts the end system name into a 32-bit network address.
[0100] The transport layer transmits application layer messages between application endpoints. The transport layer packets are called segments. The transport layer protocol in a source host submits the transport layer segments and destination addresses to the network layer.
[0101] Transport layer protocols include: transmission control protocol (TCP), user datagram protocol (UDP), etc.
[0102] The TCP protocol provides connection-oriented services to its applications. This service includes guaranteed delivery of application layer messages to the destination and flow control (i.e. sender / receiver rate matching). TCP also divides long messages into short messages and provides congestion control mechanisms so that when the network is congested, the source suppresses its transmission rate.
[0103] The UDP protocol provides a connectionless service to its applications. This is a service that does not provide unnecessary services, no reliability, no flow control, and no congestion control.
[0104] It is used to add a header to the application layer data packet, for example, a port number. The protocol for adding the port can be UDP or TCP.
[0105] Network layer: responsible for sending data from one host to another. Network layer data packets are called datagrams.
[0106] Network layer protocols include: Internet protocol (IP), routing protocol, etc.
[0107] IP protocol: This protocol defines the fields in a datagram and how end systems and routers act on these fields. There is only one IP, and all Internet components with a network layer must run IP.
[0108] Routing Protocol: It transfers the datagram from source to destination according to the route.
[0109] Data Link Layer: The Network layer routes datagrams through a series of routers between the source and destination. To move packets from one node to the next node on the path, the Network layer must rely on the services of the Data Link layer. Specifically, at each node, the Network layer passes the datagram down to the Data Link layer, which passes the datagram to the next node along the path. At that next node, the Data Link layer passes the datagram up to the Network layer. Data Link layer packets are called frames.
[0110] The data link layer may include bridge devices, network cards, etc. The frame forwarding is realized through the bridge device, thereby realizing the communication transmission of data.
[0111] A bridge device can correspond to one or more network cards. The devices connected to the network cards corresponding to the same bridge device are in the same local area network.
[0112] Physical layer: It uses transmission media (e.g., twisted-pair copper wire, single-mode optical fiber, etc.) to provide physical connections for the data link layer and is responsible for handling data transmission (e.g., moving individual bits in a frame from one node to the next). This layer is the data transmission medium for network communications and is composed of cables and devices connecting different nodes.
[0113] The physical layer includes: multiple downstream devices. The downstream devices can be terminal devices with communication functions, and the terminal devices can be mounted under the bridge device through the WL network card.
[0114] Combination Figure 4 In the corresponding embodiment, an Ethernet firewall ebtables may be provided in the data link layer of the router, and ebtables may filter the data packets reported by the router network card. The process of ebtables filtering the data packets may be referred to in Figure 5 The corresponding embodiments.
[0115] For example, Figure 5 A schematic diagram of the structure of ebtables provided in an embodiment of the present application.
[0116] like Figure 5 As shown in the figure, there are five stages in ebtables, namely prerouting, input, forward, output, and postrouting. Each stage includes some nodes, and each node is a filtering opportunity. When a data packet travels to a node, the node can filter the data packet according to the filtering rules to report the data packet to the network layer or forward the data packet from the data link layer to other devices.
[0117] When the router is in routing mode, the data packets sent by the terminal device can be sent to the ebtables in the router via the network card. The prerouting in ebtables can send the data packets to the input through the bridging decision, so that the data packets are reported from the data link layer to the network layer.
[0118] It is understandable that the data transmission process in routing mode can be seen in Figure 6 The network architecture shown in a. Figure 6 Another schematic diagram of a network structure provided for an embodiment of the present application.
[0119] like Figure 6As shown in a, when the router is in routing mode, the data packets sent by the terminal device can be reported to the network layer via ebtables in the router, the network layer can report the data packets to the transport layer, and the transport layer reports the data packets to the application layer. Suitably, the application process in the application layer can respond to the data packets and return the response data packets to the terminal device attached to the physical layer via the transport layer, network layer, and data link layer.
[0120] When the router is in bridge mode and can be a slave router, the terminal device can send data packets to ebtables in the slave router via the network card. The prerouting in ebtables can send the data packets to forward through bridging decision. Forward can send the data packets to other devices through postrouting. In this scenario, the data packets cannot reach the network layer of the router and the application layer of the router.
[0121] like Figure 6 As shown in b, when the router works in bridge mode, the data packets sent by the terminal device can be forwarded through ebtables, so that the data packets are forwarded from the data link layer to other devices, such as forwarding the data packets to other routing devices in the same network as the router.
[0122] It is understandable that prerouting in ebtables can send received data packets to different nodes.
[0123] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0124] The present application embodiment provides a processing method for router connection, so that the terminal device can scan the small program code of the router machine, pull up the small program page and connect to the router WIFI. Among them, the small program can be The applet in the application can be understood that the embodiment of the present application can make full use of The social attributes of the application and the convenient attributes of the mini program make it possible for terminal devices to Scan the mini program code associated with the router to automatically and quickly connect to the router WIFI.
[0125] In the embodiment of the present application, the correspondence between each network card and the bridge in the router can be seen in Table 1.
[0126] Table 1 Schematic diagram of the correspondence between network cards and bridges
[0127]
[0128]
[0129] As shown in Table 1, eth0.3, eth0.4, wl0, and wl1 are all network cards mounted under the br0 bridge, and wl1.5 is a network card mounted under the br2 bridge.
[0130] Based on the description corresponding to Table 1, Figure 7 A flowchart of a processing method in a router connection provided in an embodiment of the present application. Figure 7 In the corresponding embodiment, the router includes a first network card wl1.5 and a second network card wl0. The first network card is mounted under the first bridge br2, and the second network card is mounted under the second bridge br0. The first gateway address corresponding to the first bridge can be preset in the applet of the terminal device.
[0131] like Figure 7 As shown, the processing method in the router connection may include the following steps:
[0132] Before S701, the first router may establish a network with the second router, the first router may be a slave router in the network, and the second router may be a master router in the network.
[0133] It is understandable that the first router may be set to a default routing mode when leaving the factory.
[0134] Exemplarily, the terminal device can implement the wizard configuration of the first router by scanning the applet code of the first router for the first time. At this time, the working mode of the first router is the routing mode. When the first router is networked with the second router based on user operations, the working mode of the first router can be changed from the routing mode to the bridge mode. When the working mode of the first router is the bridge mode and the first router is a slave router in the network, the terminal device and the first router can be connected through the following Figure 7 The corresponding embodiment realizes WIFI connection.
[0135] S701. The terminal device receives an operation in which a user scans a mini-program code.
[0136] The mini program code can be attached to the body of the first router or to the instruction manual or other location corresponding to the first router, which is not limited in the embodiments of the present application.
[0137] The applet code may be generated by the applet uniform resource locator (URL) and the attribute parameters of the first router, etc. The attribute parameters of the first router may include: the first router serial number (SN) and other parameters used to uniquely indicate the first router.
[0138] It is understandable that, since the first router SN is unique, the mini-program code is also unique, that is, one first router can correspond to one mini-program code. The WIFI carried by the mini-program code can be non-hidden, that is, the user can search for the WIFI corresponding to the first router through the terminal device. If the WIFI carried by the mini-program is hidden, the terminal device cannot successfully connect to the first router WIFI.
[0139] S702. The terminal device obtains the mini-program URL and the first router SN from the mini-program code.
[0140] For example, the terminal device can obtain the mini-program URL and the first router SN by scanning the mini-program code, and save them in the terminal device.
[0141] S703: The terminal device uses the mini-program URL to pull the mini-program page from the server.
[0142] For example, the terminal device may send a request for obtaining a mini-program page to the server, and the request for obtaining the mini-program page may include the mini-program URL.
[0143] The server (or first server) described in S703 can be understood as Application public platform, used for terminal devices The application provides various mini-program pages. For example, a terminal device can send a request to the server to obtain a mini-program page, and the server can obtain the page information corresponding to the mini-program URL and return the page information corresponding to the mini-program to the terminal device, so that the terminal device can pull up the mini-program page from the server according to the mini-program URL parsed in the mini-program code.
[0144] S704. The server returns page information corresponding to the mini-program to the terminal device.
[0145] Among them, the page information corresponding to the mini program may include: page information corresponding to any interface in the mini program described in the embodiments of the present application, such as page information corresponding to the homepage of the mini program.
[0146] Exemplarily, after receiving the page information corresponding to the mini-program, the terminal device may perform operations such as drawing and rendering on the page information, so that the terminal device can display different interface contents in the mini-program.
[0147] S705. The terminal device displays the homepage of the mini program and uses the SN to calculate the first WIFI SSID and the first WIFI password.
[0148] The first WIFI may be the initial WIFI of the first router or called a fixed WIFI. The first WIFI SSID and the first WIFI password are both obtained based on SN resolution, so the first WIFI SSID and the first WIFI password are also unique.
[0149] It can be understood that the first WIFI SSID and the first WIFI password are determined based on attribute parameters of the first router, such as the SN of the first router.
[0150] S706: The terminal device sends a request for connecting to the first WIFI of the first router to the first router.
[0151] The request for connecting to the first WIFI of the first router may include: a first WIFI SSID and a first WIFI password.
[0152] S707: The first router returns a message indicating that the first WIFI connection is successful to the terminal device.
[0153] The first WIFI SSID and the first WIFI password are fixed, so the terminal device can use the first WIFI to access the first router, and the first WIFI SSID and the first WIFI can serve as a bridge to achieve a LAN connection between the terminal device and the first router. In this scenario, the first router has been set up in the firewall to ensure that the terminal device cannot access the Internet through the first WIFI connection connected to the first router.
[0154] After S707, the terminal device can request the first router to obtain the first IP address. The first router in bridge mode is currently a slave router, so the instruction for obtaining the first IP address can be forwarded to the second router. The second router allocates the first IP address to the terminal device and returns the first IP address to the terminal device through the first router. In this scenario, since the first router forwards the instruction for obtaining the first IP address, the DHCPS process in the first router cannot allocate an IP address to the terminal device, and the first IP address may not be in the network segment corresponding to the first WIFI.
[0155] S708: The terminal device sends a request for obtaining a symmetric key to the first router.
[0156] The request for obtaining the symmetric key may include: the first router SN and signature information, where the signature information is information obtained after the terminal device signs the first router SN using the private key.
[0157] The private key of the RSA asymmetric encryption algorithm filled with 1024-bit public key cryptography standards (PKCS) #8 can be preset in the applet of the terminal device, and the public key of the RSA asymmetric encryption algorithm filled with 1024-bit PKCS #8 can be preset in the routing plug-in process of the first router.
[0158] S709: The first router returns the symmetric key to the terminal device.
[0159] Suitably, after the first router receives the first router SN and signature information in the request for obtaining the symmetric key, the first router can use the public key to decrypt the signature information, and compare the decrypted information with the consistency of the first router SN. After the signature verification is successful, the first router can determine that the request for obtaining the symmetric key is a message sent by the applet in the terminal device, and then return the generated symmetric key to the terminal device. The symmetric key can be a 16-bit advanced encryption standard (AES) symmetric encryption key.
[0160] Based on the steps shown in S708-S709, the communication link between the subsequent terminal device and the first router can be encrypted based on the symmetric key to ensure the security of data transmission; in a possible implementation, the steps shown in S708-S709 may not be performed between the terminal device and the first router, and this is not specifically limited in the embodiments of the present application.
[0161] S710. The terminal device sends a UDP request message to the first router based on the gateway IP address of br2.
[0162] The UDP request message (or referred to as the first request) is used to request to obtain the routing information in the first router.
[0163] For example, the terminal device The gateway IP address of br2 can be preset in the applet, so that the terminal device can communicate data with the first router through the gateway IP address of br2 after establishing a connection with the first WIFI of the first router. For example, the terminal device can send a UDP request message to the first router through the gateway IP address of br2.
[0164] S711. The first router determines whether the network card that transmits the UDP request message is a preset network card.
[0165] Among them, the preset network card can be wl1.5.
[0166] It is understandable that after the first WIFI connection, the terminal device The applet can communicate with the first router through the br2 bridge, and the network card under the br2 bridge is wl1.5, so the first router in bridge mode can judge the network card that transmits the data packet in the monitoring entry prerouting of ebtables. For example, prerouting intercepts the data packet transmitted through the preset network card and modifies the target parameters corresponding to the data packet, so that when the first router is in bridge mode, the received data packet is redirected to the local machine instead of being forwarded to the second router in the network.
[0167] Combination Figure 5 In the corresponding embodiment, when the working mode of the first router is the bridge mode and the first router is a slave router, the prerouting monitoring point in the ebtables of the first router can determine whether the network card that transmits the UDP request message is the preset network card through the skb->dev->name corresponding to the UDP request message. For example, prerouting can intercept the UDP request message reported from the preset network card, modify the target parameter corresponding to the UDP request message, so that the UDP request message can be reported to the network layer.
[0168] Among them, skb is a parameter added by the Linux kernel in the first router when encapsulating the data packet. Struct sk_buff can be a core structure in the Linux network system, and the encapsulation and decapsulation of all data packets in the Linux network are performed based on this structure.
[0169] Exemplarily, when the working mode of the first router is the bridge mode and the first router is a slave router, when the first router determines that the parameter wl1.5 indicated by skb->dev->name in the UDP request message is the preset network card, the first router can execute the step shown in S713. Alternatively, when the first router determines that the parameter indicated by skb->dev->name is not the preset network card, the first router can execute the step shown in S712.
[0170] In a possible implementation, the first router may also determine whether the network card that transmits the UDP request message is a preset network card when it is determined that the working mode of the first router is the bridge mode and the first router is a slave router.
[0171] S712: The first router sends the UDP request message to the second router.
[0172] For example, the ebtables in the first router can be based on Figure 6 The path shown in b in FIG. 1 forwards the UDP request message from the data link layer to the second router.
[0173] It is understandable that when the first router sends the UDP request message to the second router, the second router may not be able to respond to the UDP request message because it cannot recognize the gateway IP address of br2 or does not have br2. Therefore, the terminal device will not be able to obtain the routing information returned by the first router, resulting in the failure of the WIFI connection process between the first router and the terminal device.
[0174] S713: The first router modifies the target parameters corresponding to the UDP request message, and generates a response message corresponding to the UDP request message.
[0175] The target parameter may include: an h_dest parameter in the skb parameter and a pkt_type parameter in the skb parameter. The h_dest parameter is used to indicate the destination MAC address to which the data packet is sent, and the pkt_type parameter is used to indicate the type of the data packet.
[0176] Exemplarily, prerouting in the ebtables of the first router may modify the parameter in the h_dest parameter to the MAC address of the first router, and modify the parameter in the pkt_type parameter to PACKET_HOST, where PACKET_HOST is used to indicate that the type of the data packet is a data packet sent to a host.
[0177] Then, prerouting in ebtables can send the UDP request message to the network layer through input based on the MAC address of the first router and PACKET_HOST, and the network layer can continue to send the UDP request message to the transport layer, and the transport layer sends the UDP request message to the application layer. The application process in the application layer can generate a response message (or first message) corresponding to the UDP request message, and return the response message to the terminal device through the steps shown in S714.
[0178] It is understandable that the process of the first router in the bridge mode processing the message can be seen in Figure 8 The corresponding embodiment, Figure 8 A schematic diagram of a message transmission provided in an embodiment of the present application. Figure 8 In the corresponding embodiment, the preset network card is wl1.5 as an example for illustration, but this example is not sufficient to limit the embodiments of the present application.
[0179] The terminal device sends a UDP request message to the first router. The UDP request message can be reported by the network card wl1.5 in the first router to the bridge device br2. The prerouting in the ebtables of the first router can determine whether the network card that transmits the UDP request message is a preset network card.
[0180] When prerouting determines that the network card that transmits the UDP request message is the preset network card, prerouting can modify the target parameters corresponding to the UDP request message so that the UDP request message can be transmitted from the data link layer to the network layer, transport layer, and application layer. Figure 8 The solid arrows in the figure correspond to the process.
[0181] The application layer receives the UDP request message, generates a response message, and transmits the response message to the bridge device br2 through the application layer, transport layer, and network layer. The bridge device br2 returns the response message to the terminal device through the attached wl1.5. See Figure 8 The dotted arrows in the figure correspond to the process.
[0182] When prerouting determines that the network card that transmits the UDP request message is not the preset network card, prerouting can forward the UDP request message to the second router. The specific method of forwarding the UDP request message can be found in Figure 5 The corresponding embodiments and Figure 6 The embodiment corresponding to b in the figure will not be described in detail here.
[0183] S714. The first router returns a response message corresponding to the UDP request message to the terminal device.
[0184] The response message corresponding to the UDP request message may include: routing information, which may be information stored in the first router. For example, the routing information may include: a second WIFI SSID, a second WIFI password, and a gateway IP address corresponding to br0, or the routing information may also include: information used to indicate whether the wizard configuration of the first router is completed, etc.
[0185] Exemplarily, the response message can be forwarded to the br2 bridge in the data link layer through the application layer, transport layer, and network layer. br2 can return the response message to the terminal device through wl1.5 based on the correspondence between the network card and the MAC address recorded in the switch self-learning (forwarding database, FDB) table.
[0186] Among them, the FDB table may include: the correspondence between wl1.5 and the terminal device MAC, and the correspondence between wl1.5 and the terminal device MAC may be recorded when br2 receives the UDP request message sent by the terminal device.
[0187] S715. The terminal device sends a request for connecting to the second WIFI of the first router to the first router.
[0188] The request for connecting to the second WIFI of the first router may include: a second WIFI SSID and a second WIFI password.
[0189] S716. The first router returns a message indicating that the second WIFI connection is successful to the terminal device.
[0190] Exemplarily, when the first router receives a request from a terminal device for connecting to the second WIFI of the first router, the first router can verify the correctness of the second WIFI SSID and the second WIFI password; after successful verification, the first router can allocate a second IP address to the terminal device through the second router. In a possible implementation, the first router can also allocate a second IP address to the terminal device, which is not limited in the embodiments of the present application.
[0191] Exemplarily, based on the second WIFI connection, the terminal device sends a first data packet to the first router, and the first router can send the first data packet to the network server through the second router; adaptively, the network server can respond to the received first data packet and generate a second data packet corresponding to the first data packet, and then the network data packet can return the second data packet to the terminal device through the second router and the first router, so that the terminal device can access the Internet through the second WIFI connection.
[0192] Referring to the description of the first WIFI and the second WIFI, it can be understood that since the user usually modifies the first WIFI SSID and the first WIFI password to obtain the second WIFI SSID and the second WIFI password, when the terminal device is connected to the first router, the terminal device cannot directly obtain the second WIFI SSID and the second WIFI password modified by the user. Therefore, the terminal device can effectively access the first router through the fixed first WIFI SSID and the first WIFI password, and then further obtain the second WIFI SSID and the second WIFI password to connect to the first router WIFI. Among them, the benefit of using the first WIFI SSID and the first WIFI password to realize the LAN communication between the terminal device and the first router is that no matter how the second WIFI SSID and the second WIFI password change, the terminal device can use the first WIFI to realize the LAN communication and obtain the changed WIFI SSID and WIFI password.
[0193] Based on this, an embodiment of the present application provides a processing method in router connection, so that the first router in bridge mode can intercept the message reported via the preset network card, modify the target parameter corresponding to the message, so that the message can be redirected to the local machine, and return the response data corresponding to the message to the terminal device, thereby realizing the WIFI connection between the terminal device and the first router.
[0194] Furthermore, the processing method in the router connection can also expand the usage scenarios of the one-scan-to-connect function, so that the one-scan-to-connect function can be used in the scenario where the router is in bridge mode and the router is a slave router, so as to improve the user experience of using the one-scan-to-connect function.
[0195] 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 laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0196] Combined with the above Figure 4-Figure 8 , the method provided in the embodiment of the present application is explained, and the device for executing the above method provided in the embodiment of the present application is described below.
[0197] For example, Fig. 9A structural schematic diagram of a processing device in a router connection provided in an embodiment of the present application. The processing device in the router connection may be the first router in the embodiment of the present application, or may be a chip or chip system in the first router.
[0198] like Fig. 9 As shown, the processing device 900 in the router connection can be used in a communication device, circuit, hardware component or chip, and the processing device in the router connection includes: a processing unit 901 and a communication unit 902. The processing unit 901 is used to support the processing device 900 in the router connection to perform information processing steps; the communication unit is used to support the processing device 900 in the router connection to perform data sending and data receiving steps. The communication unit 902 can be an input or output interface, a pin or a circuit, etc.
[0199] In a possible embodiment, the processing device in the router connection may further include: a storage unit 903. The processing unit 901 and the storage unit 903 are connected via a line. The storage unit 903 may include one or more memories, and the memory may be a device used to store programs or data in one or more devices or circuits. The storage unit 903 may exist independently and be connected to the processing unit 901 of the processing device in the router connection via a communication line. The storage unit 903 may also be integrated with the processing unit 901.
[0200] The storage unit 903 may store computer-executable instructions of the method in the first router, so that the processing unit 901 executes the method in the above embodiment. The storage unit 903 may be a register, a cache, or a RAM, etc. The storage unit 903 may be integrated with the processing unit 901. The storage unit 903 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, and the storage unit 903 may be independent of the processing unit 901.
[0201] Fig.10 A schematic diagram of the hardware structure of a device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the device may be a router, and the device may include a processor 1001, a communication line 1004, and at least one communication interface ( Fig.10 The communication interface 1003 is used as an example for explanation).
[0202] The processor 1001 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0203] Communications link 1004 may include circuitry to transmit information between the above-described components.
[0204] The communication interface 1003 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0205] Possibly, the device may further include a memory 1002 .
[0206] The memory 1002 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a communication line 1004. The memory may also be integrated with the processor.
[0207] The memory 1002 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 1001. The processor 1001 is used to execute the computer-executable instructions stored in the memory 1002, thereby implementing the method provided by the embodiment of the present application.
[0208] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.
[0209] In a specific implementation, as an embodiment, the processor 1001 may include one or more CPUs, such as Fig.10 CPU0 and CPU1 in.
[0210] In a specific implementation, as an embodiment, the device may include multiple processors, such as Fig.10 1 and 1005. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0211] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatile disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0212] The embodiments of the present application also provide a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.
[0213] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.
[0214] The above combinations should also be included in the scope of computer-readable media. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A processing method in a router connection, characterized in that: Applied to a first router, the method includes: The first router and the second router establish a network, the working mode of the first router is a bridge mode, the first router is a slave router in the network, and the second router is a master router in the network; The first router and the terminal device establish a first WIFI connection based on the first WIFI SSID and the first WIFI password; After the first WIFI is connected, the first router receives a first request from the terminal device; The first router sends a first message to the terminal device, the first message including: a second WIFI SSID and a second WIFI password, the first message being a message generated by the first router in response to the first request; The first router and the terminal device establish a second WIFI connection based on the second WIFI SSID and the second WIFI password.
2. The method according to claim 1, characterized in that The IP address of the device that initiates the first message indicated in the first message is the IP address of the first router, and / or the MAC address of the device that initiates the first message indicated in the first message is the MAC address of the first router.
3. The method according to claim 1 or 2, characterized in that: The first router includes a first network card and a first network bridge, the first network card is mounted under the first network bridge, and before the first router sends the first message to the terminal device, the method further includes: When the first router determines, based on the first request, that the first network card transmitting the first request is a preset network card, the first router modifies a first parameter corresponding to the first request into a second parameter, and modifies a third parameter corresponding to the first request into a fourth parameter, wherein the first parameter is used to indicate a destination MAC address of the first request, the second parameter is the MAC address of the first router, the third parameter is used to indicate a data packet type of the first request, and the fourth parameter is a data packet type sent to the local device; The first router generates the first message corresponding to the first request based on the second parameter and the fourth parameter.
4. The method according to claim 3, characterized in that The first router includes ebtables, and the ebtables includes prerouting. When the first router determines, based on the first request, that the first network card transmitting the first request is a preset network card, the first router modifies a first parameter corresponding to the first request into a second parameter, and modifies a third parameter corresponding to the first request into a fourth parameter, including: When the prerouting determines, based on the first request, that the first network card transmitting the first request is the preset network card, the prerouting modifies the first parameter into the second parameter and modifies the third parameter into the fourth parameter.
5. The method according to claim 4, characterized in that The ebtables also includes: a first input, the prerouting and the first input are both in the data link layer, and the first router generates the first message corresponding to the first request based on the second parameter and the fourth parameter, including: The prerouting sends the first request to the network layer through the first input based on the second parameter and the fourth parameter; The network layer sends the first request to the application layer through the transport layer; The application process in the application layer generates the first message corresponding to the first request.
6. The method according to any one of claims 3 to 5, characterized in that: The first router receives a first request from the terminal device, including: The first router receives a first request sent from the terminal device based on a first gateway address; the first gateway address is an address corresponding to the first bridge.
7. The method according to any one of claims 1 to 6, characterized in that: Before the first router receives the first request from the terminal device, the method further includes: The first router receives a second request sent by the terminal device, where the second request is used to obtain an IP address of the terminal device; The first router sends the second request to the second router; The first router receives a second message from the second router, where the second message includes an IP address allocated by the second router to the terminal device, and the second message is a message generated by the second router in response to the second request; The first router sends the second message to the terminal device.
8. The method according to any one of claims 1 to 7, characterized in that: The first WIFI connection is a local area network connection.
9. The method according to any one of claims 1 to 8, characterized in that: The first WIFI SSID and the first WIFI password are determined based on attribute parameters of the first router, and the attribute parameters include: the first router SN.
10. A router, characterized in that: include: processor and memory, wherein The memory is used to store computer programs; The processor is configured to call and execute the computer program so as to enable the router to perform the method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Access method and system and electronic equipment
CN114615660A
Equipment network distribution method and device
CN115987705A
Communication Method and Electronic Device
US20220158972A1
Network topology management system and method for home networking
WO2022037322A1
