Router mode switching method, device, electronic device and storage medium

By obtaining and recording the network port identification in the router's wizard mode, and performing the network port offline and online operations when switching modes, the problem of disconnection when the router mode is switched is solved and the user experience is improved.

CN117692329BActive Publication Date: 2024-10-22HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310906224.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2024-10-22
Estimated Expiration
2043-07-21

AI Technical Summary

Technical Problem

When the router switches working modes, it needs to disconnect all network port links and reassign IP addresses, causing users to experience link disconnection and page refresh problems during the configuration process, affecting the user experience.

Method used

In the wizard mode, obtain the target network port identification, perform offline and online operations on other network ports except the target network port, and perform offline and online operations on the target network port after the wizard mode is completed to reduce link disconnection.

Benefits of technology

By recording the network port identification in wizard mode and performing precise control when switching modes, it reduces disconnections caused by router mode switching, improves user experience, and avoids the need for users to refresh the page and reconfigure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117692329B_ABST
    Figure CN117692329B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a router mode switching method, device, electronic device and storage medium, which are applied in the field of information technology. In wizard mode, in response to a mode switching instruction, the network port identifier recorded in the wizard management list is obtained to obtain the target network port identifier; the other network ports in the router except the network port represented by the target network port identifier are downlinked; after the wizard mode is completed, the network port represented by the target network port identifier is downlinked. By applying the method of the embodiment of the present application, the downlink operation of the network port represented by the target network port identifier can be performed after the wizard mode is completed, and the downlink operation of other network ports except the network port represented by the target network port identifier can be performed immediately in the wizard mode, thereby avoiding the client accessing the router in wizard mode from being disconnected due to the router mode switching operation, so that the client user needs to refresh the wizard page and re-operate, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a router mode switching method, device, electronic device and storage medium. Background Art

[0002] With the popularization of Internet technology, the Internet has penetrated into every aspect of people's lives. Common ways to access the Internet include broadband, fiber broadband, wireless, and many other ways. Most of them use routers. Specifically, routers have multiple ways to access the Internet, and users can determine the way to access the Internet by configuring the way to access the Internet in the wizard interface.

[0003] However, in the related art, when the router switches its working mode, it is necessary to disconnect all LAN (Local Area Network) port links, including all wired LAN port links and WiFi (WIreless Fidelity) network card port links, and then assign a new IP address and reconnect. Therefore, a broken link may occur. If the corresponding user is configuring the router on the wizard interface, the connection will be disconnected and the page will be refreshed to enter the wizard page operation. Summary of the invention

[0004] The present application provides a router mode switching method, device, electronic device and storage medium to solve the problem of disconnection and reconnection of the wizard interface when the router switches the working mode.

[0005] In a first aspect of the present application, a method for switching a router mode is provided, the method comprising:

[0006] In the wizard mode, in response to the mode switching instruction, obtaining the network port identifier recorded in the wizard management list to obtain the target network port identifier, wherein the wizard management list records the network port identifier of the client accessing the router in the wizard mode;

[0007] Performing a downlink operation on other network ports in the router except the network port indicated by the target network port identifier;

[0008] After the wizard mode is completed, a down operation is performed on the network port indicated by the target network port identifier.

[0009] In a possible implementation, before executing the step of obtaining the target network port identifier by acquiring the network port identifier recorded in the wizard management list in response to the mode switching instruction in the wizard mode, the method further includes:

[0010] In response to the client login wizard interface, entering wizard mode and obtaining the IP address of the client;

[0011] Determine the Mac address to be operated corresponding to the IP address of the client according to the IP address of the client through the pre-stored mapping relationship between the IP address and the MAC address;

[0012] Match the Mac address to be operated with the Mac address list to obtain the target network port identifier of the network port to which the Mac address to be operated belongs; wherein the Mac address list records the MAC address and network port identifier of each network port;

[0013] The target network port identifier is recorded in the wizard management list.

[0014] In a possible implementation manner, the configuration file of the router includes a wizard completion flag, and the method further includes:

[0015] After the wizard mode is completed, the wizard completion flag is set to a first value, wherein the first value indicates that the wizard mode is completed; when the router is in wizard mode, the wizard completion flag is a second value, wherein the second value indicates that the wizard mode is not completed.

[0016] In a possible implementation, in the wizard mode, in response to the mode switching instruction, obtaining the network port identifier recorded in the wizard management list to obtain the target network port identifier includes:

[0017] In response to the mode switching instruction, querying the wizard completion flag;

[0018] When the wizard completion flag is a second value, obtaining a target network port identifier in the wizard management list;

[0019] Creating a downtime task for the network port indicated by the target network port identifier;

[0020] After the wizard mode is completed, performing a down operation on the network port indicated by the target network port identifier includes:

[0021] After the wizard mode is completed, the downtime task is executed to perform a downtime operation on the network port indicated by the target network port identifier.

[0022] In a possible implementation, the method further includes:

[0023] In response to the mode switching instruction, querying the wizard completion flag;

[0024] When the wizard completion flag is a first value, a down operation is performed on each network port of the router.

[0025] In a possible implementation, the method further includes:

[0026] When an exit message of the client is obtained or an abnormal exit of the client is detected, the network port identifier of the client is deleted from the wizard management list, wherein the exit message of the client indicates the wizard setting of the client to exit the router.

[0027] In a possible implementation, the method further includes:

[0028] When it is detected that the web process of the wizard mode of the router is closed or abnormally exited, the wizard management list is cleared.

[0029] In a second aspect of the present application, a router mode switching device is provided, the device comprising:

[0030] a target network port identification acquisition module, configured to obtain a network port identification recorded in a wizard management list in response to a mode switching instruction in wizard mode to obtain a target network port identification, wherein the wizard management list records network port identifications of clients accessing the router in wizard mode;

[0031] The first mode switching module is used to perform downlink operations on other network ports in the router except the network port indicated by the target network port identifier;

[0032] The second mode switching module is used to perform a down operation on the network port represented by the target network port identifier after the wizard mode is completed.

[0033] In a possible implementation, the device further includes:

[0034] The IP address acquisition submodule is specifically used to respond to the client login wizard interface, enter the wizard mode and obtain the IP address of the client;

[0035] The MAC address determination submodule is specifically used to determine the MAC address to be operated corresponding to the IP address of the client according to the IP address of the client through the pre-stored mapping relationship between the IP address and the MAC address;

[0036] The MAC address matching submodule is specifically used to match the Mac address to be operated with the Mac address list to obtain the target network port identifier of the network port to which the Mac address to be operated belongs; wherein the MAC address and network port identifier of each network port are recorded in the Mac address list;

[0037] The target network port identification recording submodule is specifically used to record the target network port identification in the wizard management list.

[0038] In a possible implementation manner, the configuration file of the router includes a wizard completion flag, and the device further includes:

[0039] The wizard completion flag setting module is used to set the wizard completion flag to a first value after the wizard mode is completed, wherein the first value indicates that the wizard mode is completed; when the router is in the wizard mode, the wizard completion flag is a second value, and the second value indicates that the wizard mode is not completed.

[0040] In a possible implementation, the target network port identification acquisition module includes:

[0041] A wizard completion flag query submodule, specifically configured to query the wizard completion flag in response to a mode switching instruction;

[0042] A target network port identification acquisition submodule, specifically used to obtain the target network port identification in the wizard management list when the wizard completion flag is a second value;

[0043] A downup task creation submodule, specifically used to create a downup task for the network port represented by the target network port identifier;

[0044] The mode switching second module includes:

[0045] The downup task execution submodule is specifically used to execute the downup task after the wizard mode is completed, so as to perform a downup operation on the network port represented by the target network port identifier.

[0046] In a possible implementation, the device further includes:

[0047] A wizard completion flag query module, used to query the wizard completion flag in response to a mode switching instruction;

[0048] The downup operation module is used to perform a downup operation on each network port of the router when the wizard completion flag is a first value.

[0049] In a possible implementation, the device further includes:

[0050] The network port identification deletion module is used to delete the network port identification of the client in the wizard management list when the exit message of the client is obtained or the abnormal exit of the client is detected, wherein the exit message of the client indicates the wizard setting of the client to exit the router.

[0051] In a possible implementation, the device further includes:

[0052] The wizard management list clearing module is used to clear the wizard management list when it is detected that the web process of the wizard mode of the router is closed or abnormally exited.

[0053] In a third aspect of the implementation of the present application, an electronic device is provided, the electronic device comprising:

[0054] one or more processors and memory;

[0055] The memory is coupled to the one or more processors, and the memory is used to store computer program code, wherein the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to the first aspect of the implementation of the present application.

[0056] In a fourth aspect of the implementation of the present application, a computer-readable storage medium is provided, comprising a computer program. When the computer program is executed on an electronic device, the electronic device executes the router mode switching method as described in any one of the first aspects of the implementation of the present application.

[0057] Another aspect of the present application provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the router mode switching method described in any one of the present application is implemented.

[0058] Beneficial effects of the embodiments of the present application:

[0059] By applying the method of the embodiment of the present application, the network port identifier of the client accessing the router in wizard mode is recorded in the wizard management list. In the wizard mode, the target network port identifier in the wizard management list is obtained, and the downup operation of the network port represented by the target network port identifier is performed after the wizard mode is completed, thereby reducing the problem of the wizard interface being disconnected and reconnected due to the router mode switching operation when the client accesses the router in wizard mode.

[0060] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0062] Figure 1 A schematic diagram of a downstream device obtaining an IP address provided in an embodiment of the present application;

[0063] Figure 2 A schematic diagram of a wizard interface provided in an embodiment of the present application;

[0064] Figure 3 A flowchart of the wizard configuration provided in the embodiment of the present application;

[0065] Figure 4 A flow chart of a download operation in the prior art provided in an embodiment of the present application;

[0066] Figure 5a A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0067] Figure 5b A schematic diagram of the structure of a router provided in an embodiment of the present application;

[0068] Figure 6 A flow chart of a routing mode switching method provided in an embodiment of the present application;

[0069] Figure 7 A schematic diagram of determining a wizard message provided in an embodiment of the present application;

[0070] Figure 8 A schematic diagram of an ARP cache table provided in an embodiment of the present application;

[0071] Fig. 9 A schematic diagram of determining a Mac address provided in an embodiment of the present application;

[0072] Fig.10 A schematic diagram of a Mac address list provided in an embodiment of the present application;

[0073] Fig.11 A schematic diagram of determining a target network port identifier provided in an embodiment of the present application;

[0074] Fig.12 A schematic diagram of a wizard management list provided in an embodiment of the present application;

[0075] Fig.13 A schematic diagram of a download task created for an embodiment of the present application;

[0076] Fig.14 A schematic diagram of routing mode switching provided in an embodiment of the present application;

[0077] Fig.15 A schematic diagram of deleting a client network port identifier provided in an embodiment of the present application;

[0078] Fig.16 Another schematic diagram of routing mode switching provided in an embodiment of the present application;

[0079] Fig.17 A schematic diagram of message processing by a web service module provided in an embodiment of the present application;

[0080] Fig.18 A schematic diagram of configuring the configuration management module provided in an embodiment of the present application;

[0081] Fig.19 A schematic diagram of the structure of a routing mode switching device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0082] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0083] In the related art, there are multiple working modes for routers, and users can choose the working mode of the router according to their own needs. For example, the working modes of the router include routing mode and bridge mode. When the working mode selected by the user needs to switch modes, that is, switching between routing mode and bridge mode, the LAN port link (including all wired LAN ports and WiFi network card ports) needs to be disconnected and reconnected, commonly known as network port downup. Specifically, the reasons for disconnecting and reconnecting the port link when switching between routing mode and bridge mode are as follows:

[0084] 1. IP address update: In routing mode, the IP of the device connected to the router, that is, the IP of the client connected to the router, is allocated by the router itself. In bridge mode, the IP of the device connected to the router is allocated by the upper router of the router. However, the local area network segments of this router and the upper router are different. Therefore, when the mode is switched, the hardware device of the DHCP (Dynamic Host Configuration Protocol) server changes (when switching from bridge mode to routing mode, the DHCP server changes from the upper router to this router, and when switching from routing mode to bridge mode, the DHCP server changes from this router to the upper router). The device connected to the LAN side needs to re-apply for an IP address from the new DHCP server.

[0085] like Figure 1As shown, taking the IP of this router as 192.168.1.1 and the IP of the upper router as 192.168.2.1 as an example, in routing mode, the IP of the downstream PC (Personal Computer) device is allocated by this router, this router acts as a DHCP server, and the IP obtained by the downstream PC device as a DHCP client is 192.168.1.101; in bridge mode, the IP of the downstream PC device is allocated by the upper router, the upper router acts as a DHCP server, and the IP obtained by the downstream PC device as a DHCP client is 192.168.2.101.

[0086] 2. ARP (Address Resolution Protocol) table: The LAN domain of the router is different when it is in routing mode and bridge mode. The router forwards the received ARP request to all other devices in the LAN. Therefore, when the mode is switched, the LAN domain changes, and it is necessary to ensure that the LAN side devices resend ARP to all new destination addresses.

[0087] In actual applications, client users can complete the configuration of the router working mode through the web (World Wide Web) page, such as Figure 2 As shown, enter the wizard interface of the router and follow the steps below Figure 3 The wizard configuration is performed according to the process shown. First, enter the wizard interface to log in as a user, such as Figure 2 As shown in interface ①, configure the Internet access method as shown in interface ②, then configure the WiFi parameters as shown in interface ③, and finally complete the configuration as shown in interface ④.

[0088] Specifically, the user logs in and configures the Internet access method on the router web interface through a PC or mobile phone, and then configures the WIFI parameters to complete the configuration. However, due to the above-mentioned network port downup strategy, the link between the PC and the router will be temporarily disconnected halfway through the wizard, causing the http (Hypertext Transfer Protocol) connection between the PC and the router backend to be disconnected due to a keep-alive failure. Accordingly, due to the disconnection, the client user needs to refresh the web browser to reconnect, go to the login interface again, enter the login password, and go through the wizard process again. At this point, the router's Internet access mode has been successfully switched, so there is no need to disconnect during the configuration process. Figure 4As shown, the user enters the wizard login interface, logs in on this interface, enters the wizard, and sets the Internet access method. The backend identifies whether there is routing / bridge switching, that is, whether the router has routing switching. If so, all LAN side interfaces are downgraded. At this time, the link will be disconnected and the http connection needs to be re-established. If not, continue to set the WiFi parameters according to the process to complete the wizard.

[0089] In order to solve the technical problem that the user needs to refresh the page to enter the wizard page operation due to the broken link, resulting in a poor user experience, the embodiment of the present application provides an electronic device in a first aspect, which is used to execute the router mode switching method of the embodiment of the present application, such as Figure 5a As shown, the electronic device includes:

[0090] One or more processors 502 and memory 501;

[0091] The memory 501 is coupled to the one or more processors 502, and the memory 501 is used to store computer program codes, where the computer program codes include computer instructions, and the one or more processors 502 call the computer instructions to enable the electronic device to execute the router mode switching method of any one of the embodiments of the present application.

[0092] Specifically, the electronic device in the embodiments of the present application may be an electronic device with display hardware and corresponding software support and capable of network connection. For example, the electronic device may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a notebook computer, an ultra-mobile personal computer (UMPC), a personal digital assistant (PDA), a household device, etc. The present application does not impose any restrictions on the specific type of the electronic device.

[0093] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0094] The communication interface is used for communication between the above electronic device and other devices.

[0095] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0096] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0097] In one example, the electronic device is a router, such as Figure 5b As shown, the processor may include a main processor, and the memory may include a system memory. The system memory may be implemented by ROM (read-only memory), RAM or FLASH (flash memory), and is used to store routing files, routing tables, ARP cache tables and buffers for data packets configured by the system. The processor is mainly responsible for the operation of the router, such as maintaining various table items required for routing and making routing selections. The router may also include multiple network interface cards, such as Figure 5b In the network interface card 1, network interface card 2, ... network interface card N, each interface may correspond to a slave processor and a memory for local cache. The main memory, system memory and network interface card communicate with each other through a shared bus. In an example, the shared bus may be a communication bus, such as an address bus, a data bus, a control bus, etc.

[0098] In a second aspect of an embodiment of the present application, a router mode switching method is provided, the method comprising: Figure 6 Steps shown:

[0099] Step S601: In the wizard mode, in response to a mode switching instruction, the network port identifier recorded in the wizard management list is obtained to obtain a target network port identifier.

[0100] The wizard management list records the network port identifiers of the clients currently accessing the router in wizard mode. Figure 2 When the wizard interface of the router is displayed, it is determined that the client of the user is currently accessing the router in wizard mode.

[0101] The network port identifier is information that can identify the network port, for example, the network port identifier may be the name or number of the network port, etc. In one example, the network port identifier recorded in the wizard management list is eth0.5, which means that the network port corresponding to eth0.5 is the wizard network port.

[0102] Step S602: Perform downlink operations on other network ports in the router except the network port indicated by the target network port identifier.

[0103] In actual applications, the network port indicated by the target network port identifier corresponds to the wizard service, and the disconnection of other services does not require refreshing the wizard interface. Therefore, for other network ports except the network port indicated by the target network port identifier, the down operation can be immediately performed in the wizard mode.

[0104] Step S603: after the wizard mode is completed, a down operation is performed on the network port indicated by the target network port identifier.

[0105] The completion of the wizard mode indicates that the client device has exited the wizard interface. Therefore, the network port indicated by the target network port identifier can be downgraded to reallocate the IP address. In the case that the client device has exited the wizard interface, there is no need to refresh and reconnect the wizard interface.

[0106] By applying the method of the embodiment of the present application, the network port identifier of the client accessing the router in wizard mode is recorded in the wizard management list. In wizard mode, the target network port identifier in the wizard management list is obtained, and the downup operation on the target network port is performed after the wizard mode is completed. The downup operation on other network ports except the target network port can be executed immediately in wizard mode, thereby reducing the situation where the client accessing the router in wizard mode is disconnected due to the router mode switching operation, causing the client wizard interface to need to be refreshed, thereby improving the user experience.

[0107] The network port identifier recorded in the wizard management list may be obtained by the router by detecting the address of the client when the client enters the wizard interface; the target network port identifier may be recorded in the wizard management list in advance. In a possible implementation, before step S601, the method of the embodiment of the present application may further include the following steps:

[0108] Step 1: In response to the client login wizard interface, enter wizard mode and obtain the client's IP address.

[0109] Specifically, the client can enter the wizard interface by logging in to a website or scanning a QR code, and when the client logs in to the wizard interface, the router can confirm that the client is accessed in wizard mode and obtain the IP address of the client, thereby further determining the network port to which the client is connected. The method for obtaining the IP address of the client can refer to the prior art, for example, the IP address of the client can be obtained through a message of a service process between the client and the router.

[0110] In an example, a router can create a listening socket, specify the IP address and port number through bind, and use listen() to listen for connection requests from the client. The IP address is the IP of the router's LAN side, generally the IP of the br0 bridge (bridge interface). This bridge has four network ports eth0.2---eth0.5, corresponding to the four physical network ports of the router. The router uses the select() (monitoring function) + accept() (a connection accepted by the socket) method to wait for the client's connection request. After the connection is successfully established, a client socket will be obtained for communication with the client. The client sends an HTTP request message to the router, and the router reads the request message through the recv() method and parses the message header and message body.

[0111] By matching the keywords of the http url (Uniform Resource Locator), it is confirmed whether the connection to which this message belongs is the connection of the wizard interface. Figure 7 As shown in the figure, it is the http message format for a router to enter wizard mode, which can be confirmed by the method "POST" and the url " / api / app / wizard". In actual applications, it can also be designed according to the actual interface, or by other message headers or message body keywords.

[0112] The specific method of using messages to identify the wizard mode can be designed according to the actual system architecture of the router. In one example, inter-process communication or inter-thread communication can be used. For example, for multiple independent process modules, the embodiment of the present application can use the communication method of unix sockets.

[0113] Using Unix domain sockets for IPC (Inter-Process Communication) can include the following steps:

[0114] Create a socket: Call the socket() function to create a Unix domain socket and specify a path and socket type (stream socket or datagram socket) for it.

[0115] Bind a socket: Call the bind() function to bind the socket to a file path so that other processes can connect to the socket.

[0116] Listening for connections: If a stream socket is created, you need to call the listen() function to start listening for connection requests; if a datagram socket is created, you do not need to listen for connection requests and can start sending and receiving data directly.

[0117] Connecting socket: Call the connect() function or the accept() function to connect to the Unix domain socket of other processes.

[0118] Send data: Send data to the connected socket through the send() function.

[0119] Receive data: Receive data from the socket through the recv() function.

[0120] Close the socket: After the IPC is completed, call the close() function to close the socket.

[0121] Accordingly, the message format design can be designed as shown in Table 1 below:

[0122] Table 1

[0123]

[0124]

[0125] In the message processing flow, the client socket's fd (socket descriptor) can be obtained, and the getpeername function can be called to obtain the client's IP address. Among them, getpeername is a socket function used to obtain the peer connection information (peer IP address and port number) connected to a socket. In an example, the client IP address can be obtained through the following code:

[0126] getpeername(client_socket_fd,(struct sockaddr*)&client_addr,&client_addr_len);

[0127] string ip=inet_ntoa(client_addr.sin_addr)

[0128] Step 2: Determine the Mac address to be operated corresponding to the client's IP address according to the pre-stored mapping relationship between the IP address and the MAC address according to the client's IP address.

[0129] The mapping table between IP addresses and MAC addresses stored in the router can be, in one example, an ARP cache table. Specifically, in the ARP protocol, each host maintains an ARP cache table, which is used to store the mapping relationship between the IP address and MAC address of the local host and other hosts. The ARP cache table may include information such as the client's IP address, MAC address, interface type, and the validity period of the MAC address. For example, the WAN (Wide Area Network) side of the router is connected to an upstream optical modem, and the IP address of the optical modem is 192.168.20.1. A PC is connected to a LAN port on the LAN side, and the IP address of the PC is assigned by the router as 192.168.2.111. Figure 8 In the ARP cache table shown, you can see the IP addresses of the optical modem and PC, their MAC addresses, and interface names. The arp-n command is used to display the ARP cache table of the current machine. In this ARP cache table, you can see that the IP address of the optical modem is 192.168.20.1, the MAC address is 68:a7:b4:63:f1:7b, and the interface name is nas1 1 (Network Attached Storage); the IP address of the PC is 192.168.2.111, the MAC address is 6c:02:e0:66:23:59, and the interface name is br0.

[0130] In actual applications, you can use the client's IP address to traverse the IP addresses in the cache table, match the client's IP address in the ARP table, read the MAC address information corresponding to the IP address, and determine the Mac address to be operated corresponding to the client's IP address. Fig. 9 The code shown operates.

[0131] Step 3: Match the Mac address to be operated with the Mac address list to obtain the target network port identifier of the network port to which the Mac address to be operated belongs; wherein the Mac address list records the MAC address and network port identifier of each network port.

[0132] In step 2, Figure 8 In the example shown, for the LAN side device, the corresponding interface name is br0, and the LAN side network ports eth0.2-eth0.5 of the router are all hung under the br0 bridge, and it is impossible to determine the network port that executes the wizard service. In actual applications, network bridge devices can be used to merge multiple network interfaces into a logical network to achieve functions such as traffic aggregation and high availability. When a network data packet arrives at a network bridge device, its related information will be recorded in the MAC address list of the bridge device.

[0133] For example, in Linux system, the MAC address list is as follows Fig.10 As shown in the figure, the brctl showmacs br0 command is used to display the MAC address list learned by the network bridge device br0 in the Linux system. is local indicates whether the table entry is local to the router. For the downstream device, this item should be no. On this basis, by comparing the MAC address, the corresponding interface is found, which is the network port name corresponding to the actual physical network port. It is a parameter that can be used to determine which physical network port is being guided. In an example, you can use Fig.11 The code shown determines the target network port identifier of the network port corresponding to the wizard service.

[0134] Step 4: Record the target network port ID in the wizard management list.

[0135] The router can support one or more clients to enter the wizard interface at the same time. The wizard management list can record the network port identification of all clients currently logged into the wizard interface. In actual applications, the wizard management list can record the information of multiple network port identifications, such as Fig.12 As shown in FIG. 1 , when two downstream devices log in to the wizard at the same time, the wizard management list records the network port information of the two downstream devices in the form of a linked list. Fig.12 In the wizard management list shown, it can be seen that a PC device with fd 10 and interface name (devName) eth0.3 and a PC device with fd 11 and interface name (devName) eth0.4 are connected to the router. In an example, the wizard management list may include the information shown in Table 2 below. In an example, taking the network port identifier as the network port name as an example, after obtaining the fd and its network port name, the wizard management list is traversed, and if the same fd exists, its network port name is updated; if not, a new node is added.

[0136] Table 2

[0137]

[0138] In one example, when the router supports multiple clients to enter the wizard interface at the same time, only one client can be supported to enter configuration parameters at the same time. Since the network port represented by the target network port identifier corresponds to the wizard service, in order not to affect the wizard service, the network port represented by the target network port identifier is downgraded after the wizard mode is completed. Specifically, a flag bit can be used to identify whether the wizard mode is completed. For example, when the wizard mode is completed, the flag bit is set to 1, and when the wizard mode is not completed, the flag bit is 0.

[0139] By applying the method of the embodiment of the present application, the network port that executes the wizard service can be determined and the target network port identifier can be obtained through the IP address of the client, so that the downup operation of the network port represented by the target network port identifier is performed after the wizard mode is completed, and the downup operations of other network ports except the network port represented by the target network port identifier can be executed immediately in the wizard mode, thereby avoiding the client accessing the router in wizard mode from being disconnected due to the router mode switching operation, so that the client user needs to refresh the wizard page and re-operate, thereby improving the user experience.

[0140] In order to better determine whether the wizard mode is completed, in a possible implementation manner, the configuration file of the router includes a wizard completion flag, and the method of the embodiment of the present application may further include the following steps:

[0141] After the wizard mode is completed, the wizard completion flag is set to a first value, wherein the first value indicates that the wizard mode is completed; when the router is in wizard mode, the wizard completion flag is a second value, and the second value indicates that the wizard mode is not completed.

[0142] The first value and the second value may be specific values ​​or some meaningful values. For example, the wizard completion flag may be set to 1 to indicate that the wizard mode is completed, and the wizard completion flag may be set to 0 to indicate that the wizard mode is not completed; the wizard completion flag may be set to true to indicate that the wizard mode is completed, and the wizard completion flag may be set to false to indicate that the wizard mode is not completed.

[0143] By using the method of the embodiment of the present application, the wizard completion flag can be set, thereby making it easier to determine whether the wizard mode is completed, thereby facilitating down the network port after the wizard is completed.

[0144] In order to determine the timing of performing a down operation on the network port indicated by the target network port identifier, in a possible implementation, the operation may be performed by querying the state of the above-mentioned guide flag. Specifically, the above-mentioned step S601 may be implemented by the following steps:

[0145] Step 1: In response to the mode switching instruction, query the wizard completion flag.

[0146] Specifically, the mode switching command can be triggered in a variety of ways. For example, the user can actively modify the router configuration by entering the Web interface or APP (Application) interface to switch the mode; or the user can switch the mode after the secondary router and the main router are successfully networked in the background easymesh (WiFi self-organizing network) networking scenario; or the user can automatically switch the scenario through WAN detection, for example, some customized products switch the mode if the WAN port is not wanup (connected online) within 10 seconds after the network cable is plugged in.

[0147] Step 2: When the wizard completion flag is the second value, obtain the target network port identifier in the wizard management list.

[0148] When the wizard completion flag is the second value, it means that the wizard mode has not been completed, and it is necessary to identify the target network port identifier of the network port corresponding to the wizard service.

[0149] Step 3: Create a download task for the network port indicated by the target network port ID.

[0150] Specifically, when creating a downtime task for the network port indicated by the target network port identifier, the downtime task can be triggered when the wizard mode is completed through a timer setting. Then step S603 can be implemented through the following steps:

[0151] Step 4: After the wizard mode is completed, execute the downtime task to downtime the network port indicated by the target network port identifier.

[0152] After the wizard mode is completed, the downup task in step 3 is triggered, such as Fig.13 As shown, the internal process of the downup task is to find the corresponding portid (network port number) according to the network port name, perform the link down operation on the network port corresponding to the portid, and create a timer for 5s before linking up. Specifically, register the timer table, and the timer polling thread queries the timer registration table. After the timer time arrives, it processes the timer task that has expired.

[0153] By applying the method of the embodiment of the present application, a downup task can be created when the wizard is not completed through the wizard completion flag, so that the downup task is directly triggered when the wizard is completed, thereby avoiding the client accessing the router in wizard mode from being disconnected due to the router mode switching operation, so that the client user needs to refresh the wizard page and re-operate, thereby improving the user experience.

[0154] When the wizard mode is completed, the user no longer needs to perform wizard configuration, so the disconnection caused by downtime does not cause a poor user experience. In order to switch modes faster, the method of the embodiment of the present application can also be implemented by the following steps:

[0155] Step A: In response to the mode switching instruction, query the wizard completion flag.

[0156] Step B: When the wizard completion flag is the first value, a down operation is performed on each network port of the router.

[0157] When the wizard completion flag is the first value, it means that the wizard mode has been completed, and you can perform a downtime operation on all network ports. In actual applications, after the wizard mode has been completed, the user will no longer be presented with the wizard interface when logging into the web or APP. The specific downtime operation requires knowing the portId corresponding to the network port name (the serial number is the original number of each network port for the chip. When the device is initialized, the correspondence between the network port name and the portId has been loaded into a structure array, which can be found using general methods. For example, it can be implemented by the following code:

[0158]

[0159] The encapsulated function static int GetIdFromIfName(const char*devName) queries portId through the network port name. Use the command ethcmd eth0 lanchip disable port <portid>Complete the link down of the physical network port corresponding to portId. Specifically, this instruction calls the driver layer interface at the bottom layer, and the internal implementation is related to the chip. The encapsulation function static intCommEthEnable(int portID,bool enable) implements the network port link down / up.

[0160] It should be noted that the above is the process of downloading a wired network port. Optionally, the wireless network port is not one physical network port corresponding to one downstream device, generally one network port for 2.4g WiFi and one network port for 5g WiFi. Similarly, according to the network port download interface provided by the driver, the method of the embodiment of the present application can implement a strategy of delaying downloading for all downstream devices connected to 2.4g WiFi or all downstream devices connected to 5g WiFi.

[0161] In an example, Fig.14 The method of implementing the embodiment of the present application is shown. When the mode switching is triggered by the foreground user configuration or the background scene strategy, it is identified whether the device has completed the wizard. If so, the wizard flag guideFinish is set; if not, all LAN ports are traversed, and then the wizard flag guideFinish is queried whether it is set. If so, it means that the wizard has been completed, and a downup task is created for all network ports and triggered immediately; if not, it is necessary to query the wizard management list to determine the target network port identifier of the network port corresponding to the wizard service, that is, the network port name in this example. Inquire in the wizard management list whether there is a corresponding network port name, and then create a downup task for the network port corresponding to the target network port identifier, and trigger it when the wizard is completed. Specifically, when creating a downup task, the task registry is completed by registering the wizard. When the user configures the wizard, the wizard is configured through the wizard completion processing function. After the wizard task is completed, the task registry is queried and the registry task is processed. After the downup task is triggered, it is determined whether the traversal of the LAN port has been completed. If so, the switching of the router mode is completed and ended.

[0162] By applying the method of the embodiment of the present application, the wizard completion flag can be used to directly complete the downtime of all network ports when the wizard is completed, thereby facilitating the judgment of the network port to perform the downtime operation, and determining that the downtime operation is performed on all network ports when the wizard is completed, and performing the downtime operation on other network ports except the network port indicated by the target network port identifier while the wizard is in progress.

[0163] In actual applications, the client may exit in wizard mode. In this case, the embodiment of the present application may further include the following steps:

[0164] When an exit message of the client is obtained or an abnormal exit of the client is detected, the network port identifier of the client is deleted from the wizard management list, wherein the exit message of the client indicates the wizard setting of the client to exit the router.

[0165] In actual application scenarios, the web process of the router can monitor the connection after receiving the connection request from the client. An example summary is that after receiving the connection request from the client, the web process will generate a response socket through accept() and add subsequent select readable monitoring.

[0166] In the TCP (Transmission Control Protocol, transport layer communication protocol) protocol, if the client closes the connection normally, the server will receive a FIN (finish) packet (that is, a data packet with the FIN flag set to 1). The select function can be used to monitor multiple sockets, and the process will be notified when any of the sockets has data to read or an error occurs. When a monitored client socket receives a FIN packet, the socket will also become one of the readable states, and the return value (indicating the length of the reception) of the recv() system call (receive data from a connected socket or a bound connectionless socket) will be 0. Therefore, according to "socket readable + recv() return value is 0", the corresponding client is closed normally, such as the user closing the web page.

[0167] If the client closes the connection abnormally, such as a PC power outage, the server kernel mechanism will capture some error information, such as

[0168] ETIMEDOUT: Indicates that the connection has timed out (i.e., failed to respond to the heartbeat packet in time)

[0169] ECONNRESET: Indicates that the remote host forcibly closed the connection

[0170] EPIPE: Indicates that an error occurred while writing data, usually because the remote host suddenly disconnected.

[0171] This will also trigger select to be readable. Specifically, when the recv return value is less than 0, and errno (error code) is further judged to be not EAGAIN (try again) or EINTR (signal interrupt), it means one of the above-mentioned exceptions. At this time, it can also be confirmed that the client connection is closed.

[0172] When confirming the client exit, if the business corresponding to the socket creation in the web process is a wizard business, before calling the close function, a del (delete) message is sent to the configuration management module, and the corresponding node of the socket in the wizard management list is deleted.

[0173] Specifically, Fig.15 As shown, after the web process is started, the LAN side client IP is bound through the bind function, for example, the LAN side IP port 80 is bound, and then the listen function is used for listening. The select function can listen to the socket and the connection response socket at the same time. When the select listening socket and the connection response socket have readable data, that is, whether there is a readable fd, if so, it is determined whether the fd is a listening socket. If so, a new connection process is added and returned for listening. If not, the recv data of the existing connection is obtained to determine whether the recv data satisfies the return value == 0. If not, that is, the return value is not 0, it is necessary to determine whether there is a return value <0 and an errno exception occurs. If so, or the return value is equal to 0, it is determined whether the socket data corresponds to a wizard socket. If so, the network port identifier of the client in the wizard management list is deleted. In an example, if it is a wizard socket, a del message is sent to the wizard management module to delete the corresponding node of the socket in the wizard management list, and finally the connection is closed, that is, socket close; if the return value is greater than 0, it is processed according to the original connection data.

[0174] By applying the method of the embodiment of the present application, the network port identifier of the client in the wizard management list can be deleted when the client is closed, thereby reducing the waste of computing resources and avoiding error prompts that may occur due to invalid information.

[0175] In actual applications, the wizard mode of the router may be exited when in the wizard mode. In this case, the embodiment of the present application may further include the following steps:

[0176] When it is detected that the web process of the wizard mode of the router is closed or exits abnormally, the wizard management list is cleared.

[0177] Specifically, when the web service process exits, the related sockets will be automatically disconnected. Before disconnection, if there is a socket that is performing wizard business, it has been recorded in the wizard management list, but it can no longer receive del messages. Therefore, when the web service process exits, a clear message needs to be sent to clear the wizard management list.

[0178] Among them, according to the specific architecture of the device, the web service process can be a resident process, or it can be launched when there is a client request, and it will exit after waiting for a period of time without new connections after all connections are processed. When the web exits normally, a clear message is sent to the configuration management module to clear the management list.

[0179] In a possible implementation, considering the possibility of abnormal exit of the web, the router may have a process management module, which is responsible for starting each service process and managing the PID (Process Identifier) ​​and periodically checking whether the PID of the process exists normally. If the web service process has an abnormal situation such as a segmentation error, the process management module can detect this problem, and if it is detected that the abnormal process is a web service process, a clear message is sent.

[0180] The following example is used to specifically illustrate the method of the embodiment of the present application. Fig.16 As shown, the embodiment of the present application may include the following steps:

[0181] Step a: The web service module identifies the socket connection that is following the wizard based on the http request keyword, obtains srcip (source IP), i.e., the client IP, through getpeername, and sends it to the configuration management module.

[0182] Step b: The configuration management module uses the arp and brctl instructions provided by the operating system to respectively use the IP to find the MAC and use the MAC to find the network port, and records the relevant information into the wizard management list.

[0183] Step c: When the router switches between routing / bridge mode and needs to perform a down operation, operations on the wizard network port are postponed until the wizard is completed, and operations on other network ports are processed immediately.

[0184] Step d: When the socket of a node in the management list is disconnected, clear this management node. (The corresponding user wizard was canceled halfway)

[0185] Step e: When the web process exits, the configuration management module is notified to clear the wizard management list.

[0186] The web service module is used to process messages, parse the client IP and send it to the configuration management module. Fig.17 The steps shown are used to process the message. The configuration management module is used to perform configuration and send instructions to the operating system, and the operating system is used to perform specific tasks.

[0187] In one example, after the web service module recognizes that the client initiates a wizard request, it establishes a connection, that is, it adds a new connection process, and then reads and parses the message through the recv() function, that is, it recvs the data and parses it, and identifies whether the message is a configuration wizard interface. If so, it obtains the client IP and sends the message to the configuration management module. If not, it performs related business processing and completes the processing of this message. Among them, the message sent by the web service module to the configuration management module after parsing the client IP can be an add message (fd+IP), that is, a message containing fd and IP. The configuration management module queries the arp table through the operating system and returns the corresponding Mac, and then queries the brctl table and returns the corresponding network port name. The configuration management module records the network port name in the wizard management list. In order to facilitate the immediate processing of the non-wizard network port after the mode switch occurs, the network port down operation is executed, and a scheduled task is created for the network port in the wizard. After the wizard is completed, the network port down operation is executed. When the web service module recognizes that the client wizard is terminated, it sends a del message containing fd to the configuration management list module so that the configuration management module deletes the management node. When it recognizes that the web process exits, it sends a clear message containing fd to the configuration management list module so that the configuration management module clears the wizard management list.

[0188] The configuration management module records the wizard network port related information into the wizard management list through Fig.18 The steps shown are recorded. First, the configuration management module is initialized and the wizard configuration message is subscribed. Then, after receiving the wizard configuration message, the parsed fd and IP are obtained, and the ARP cache table is queried with the IP as the index, that is, the ARP cache table is traversed by the IP address to determine whether there is a related table entry. If so, the corresponding Mac address is obtained, and then the brctl cache table is queried with Mac as the index to determine whether there is a related table entry. If not, the parameter is considered abnormal and no processing is performed; if so, the corresponding network port name is obtained and it is determined whether this IP exists in the wizard network port management list. If so, a new node is created, if not, the corresponding node is refreshed.

[0189] By applying the method of the embodiment of the present application, the wizard management list can be cleared when the web process is closed, thereby preventing the connected client from not receiving the deletion message.

[0190] In a third aspect of an embodiment of the present application, a router mode switching device is provided. The device of the embodiment of the present application includes: Fig.19 The structure shown:

[0191] The target network port identification acquisition module 1901 is used to obtain the network port identification recorded in the wizard management list to obtain the target network port identification in response to the mode switching instruction in the wizard mode, wherein the wizard management list records the network port identification of the client accessing the router in the wizard mode;

[0192] The first mode switching module 1902 is used to perform downlink operations on other network ports in the router except the network port indicated by the target network port identifier;

[0193] The second mode switching module 1903 is used to perform a down operation on the network port indicated by the target network port identifier after the wizard mode is completed.

[0194] In a possible implementation manner, the device further includes:

[0195] The IP address acquisition submodule is specifically used to respond to the client login wizard interface, enter the wizard mode and obtain the IP address of the client;

[0196] The Mac address determination submodule is specifically used to determine the MAC address to be operated corresponding to the IP address of the client according to the IP address of the client through the mapping relationship between the IP address and the MAC address stored in advance;

[0197] The Mac address matching submodule is specifically used to match the Mac address to be operated with the Mac address list to obtain the target network port identifier of the network port to which the Mac address to be operated belongs; wherein the Mac address list records the MAC address and network port identifier of each network port;

[0198] The target network port identification recording submodule is specifically used to record the target network port identification in the wizard management list.

[0199] In a possible implementation manner, the configuration file of the router includes a wizard completion flag, and the device further includes:

[0200] The wizard completion flag setting module is used to set the wizard completion flag to a first value after the wizard mode is completed, wherein the first value indicates that the wizard mode is completed; when the router is in wizard mode, the wizard completion flag is a second value, and the second value indicates that the wizard mode is not completed.

[0201] In a possible implementation, the target network port identification acquisition module includes:

[0202] A wizard completion flag query submodule, specifically used to query the wizard completion flag in response to a mode switching instruction;

[0203] The target network port identification acquisition submodule is specifically used to obtain the target network port identification in the wizard management list when the wizard completion flag is the second value;

[0204] The downup task creation submodule is specifically used to create a downup task for the network port indicated by the target network port identifier;

[0205] The second mode switching module includes:

[0206] The downup task execution submodule is specifically used to execute the downup task after the wizard mode is completed, so as to perform a downup operation on the network port represented by the target network port identifier.

[0207] In a possible implementation, the device further includes:

[0208] A wizard completion flag query module, used to query the wizard completion flag in response to a mode switching instruction;

[0209] The downup operation module is used to perform a downup operation on each network port of the router when the wizard completion flag is the first value.

[0210] In a possible implementation, the device further includes:

[0211] The network port identification deletion module is used to delete the network port identification of the client in the wizard management list when the client's exit message is obtained or the abnormal exit of the client is detected, wherein the client's exit message represents the client's exit router wizard setting.

[0212] In a possible implementation, the device further includes:

[0213] The wizard management list clearing module is used to clear the wizard management list when it is detected that the web process of the router's wizard mode is closed or exits abnormally.

[0214] By using the device of the embodiment of the present application, the downup operation of the network port represented by the target network port identifier can be performed after the wizard mode is completed, and the downup operations of other network ports except the network port represented by the target network port identifier can be immediately executed in the wizard mode, thereby avoiding the client accessing the router in the wizard mode from being disconnected due to the router mode switching operation, so that the client user needs to refresh the wizard page and re-operate, thereby improving the user experience.

[0215] In a fourth aspect of the implementation of the present application, a computer-readable storage medium is provided, comprising a computer program. When the computer program is executed on an electronic device, the electronic device executes the router mode switching method according to any one of the first aspects of the implementation of the present application.

[0216] Another aspect of the present application provides a computer program product, including a computer program, which implements any router mode switching method in the present application when executed by a processor.

[0217] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may 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 may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0218] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0219] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and electronic device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0220] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.< / portid>

Claims

1. A router mode switching method, characterized in that: The method comprises: In the wizard mode, in response to the mode switching instruction, obtaining the network port identifier recorded in the wizard management list to obtain the target network port identifier, wherein the wizard management list records the network port identifier of the client accessing the router in the wizard mode; Performing a downlink operation on other network ports in the router except the network port indicated by the target network port identifier; After the wizard mode is completed, a down operation is performed on the network port indicated by the target network port identifier.

2. The method according to claim 1, characterized in that Before executing the step of obtaining the target network port identifier by acquiring the network port identifier recorded in the wizard management list in response to the mode switching instruction in the wizard mode, the method further includes: In response to the client login wizard interface, entering wizard mode and obtaining the IP address of the client; Determine the MAC address to be operated corresponding to the IP address of the client according to the IP address of the client through the pre-stored mapping relationship between the IP address and the MAC address; Match the MAC address to be operated with the MAC address list to obtain the target network port identifier of the network port to which the MAC address to be operated belongs; wherein the MAC address list records the MAC address and network port identifier of each network port; The target network port identifier is recorded in the wizard management list.

3. The method according to claim 1, characterized in that The configuration file of the router includes a wizard completion flag, and the method further includes: After the wizard mode is completed, the wizard completion flag is set to a first value, wherein the first value indicates that the wizard mode is completed; when the router is in wizard mode, the wizard completion flag is a second value, wherein the second value indicates that the wizard mode is not completed.

4. The method according to claim 3, characterized in that In the wizard mode, in response to the mode switching instruction, obtaining the network port identifier recorded in the wizard management list to obtain the target network port identifier includes: In response to the mode switching instruction, querying the wizard completion flag; When the wizard completion flag is a second value, obtaining a target network port identifier in the wizard management list; Creating a downtime task for the network port indicated by the target network port identifier; After the wizard mode is completed, performing a down operation on the network port indicated by the target network port identifier includes: After the wizard mode is completed, the downtime task is executed to perform a downtime operation on the network port indicated by the target network port identifier.

5. The method according to claim 4, characterized in that After querying the wizard completion flag in response to the mode switching instruction, the method further includes: When the wizard completion flag is a first value, a down operation is performed on each network port of the router.

6. The method according to claim 1, characterized in that The method further comprises: When an exit message of the client is obtained or an abnormal exit of the client is detected, the network port identifier of the client is deleted from the wizard management list, wherein the exit message of the client indicates the wizard setting of the client to exit the router.

7. The method according to claim 1, characterized in that The method further comprises: When it is detected that the web process of the wizard mode of the router is closed or abnormally exited, the wizard management list is cleared.

8. A router mode switching device, characterized in that: The device comprises: a target network port identification acquisition module, configured to obtain a network port identification recorded in a wizard management list in response to a mode switching instruction in wizard mode to obtain a target network port identification, wherein the wizard management list records network port identifications of clients accessing the router in wizard mode; The first mode switching module is used to perform downlink operations on other network ports in the router except the network port indicated by the target network port identifier; The second mode switching module is used to perform a down operation on the network port represented by the target network port identifier after the wizard mode is completed.

9. An electronic device, characterized in that: include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: It comprises a computer program, and when the computer program is run on an electronic device, the electronic device executes the router mode switching method as claimed in any one of claims 1 to 7.