Hotspot channel generation method, computing device and readable storage medium
Using a hash algorithm to generate random numbers, reorder and match the channel list, it solves the frequency band interference problem of the Linux operating system when creating hotspot channels, realizes the randomness of hotspot channels, and improves the performance and user experience of wireless networks.
Patent Information
- Application Number
- CN202210946111.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-06-29
AI Technical Summary
The existing Linux operating system lacks randomness when creating hotspot channels, causing frequency band interference problems and affecting the transmission quality of network signals.
Generate random numbers through a hash algorithm, reorder the channel list in the network manager, and match it with the channel list supported by the wireless network driver to generate random hotspot channels to prevent devices from using the same channel for communication and reduce channel interference.
It effectively reduces the interference between hotspot signals, improves the throughput performance and transmission quality of the wireless network, and improves the user's network experience.
Smart Images

Figure CN115334514B_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with application number 2022107457968 filed on June 29, 2022. Technical Field
[0002] The present invention relates to the field of computer technology, and in particular to a method for generating a hotspot channel, a computing device and a readable storage medium. Background Art
[0003] With the development of information technology, a large number of electronic devices rely on wireless networks (WIFI) and communication protocols such as Bluetooth to establish connections, so the space is filled with a large number of frequency band signals (such as 2.4GHz, 5GHz). Moreover, as more and more electronic devices are put into use, the channels become very crowded, resulting in frequency band interference problems.
[0004] Existing Linux operating systems do not have a random solution for hotspot channels. For example, when creating a hotspot, the current mainstream Linux distribution uses channel 1 (2412) by default if the hotspot signal is in the 2.4GHz band, and uses channel 36 (5180) by default if the hotspot signal is in the 5GHz band. This results in a large number of RF signals of the same channel existing in the space during large-scale product use, causing channel interference problems and seriously affecting the transmission quality of network signals.
[0005] Therefore, it is necessary to generate a hotspot channel to solve the problems existing in the existing technical solutions. Summary of the invention
[0006] To this end, the present invention provides a method for generating a hotspot channel, a computing device, and a readable storage medium to solve or at least alleviate the above problems.
[0007] According to a first aspect of the present invention, there is provided a method for generating a hotspot channel, which is executed in a network manager of a computing device, and the method comprises: obtaining first predetermined information from a hotspot configuration file; performing a hash calculation on the first predetermined information through a hash algorithm to generate a random number; reordering the channels in a first channel list preset in the network manager through the random number; obtaining a second channel list supported by a wireless network driver; matching the reordered first channel list with the second channel list to generate a matching hotspot channel.
[0008] Optionally, in the method for generating hotspot channels according to the present invention, the step of reordering the channels in the first channel list preset in the network manager includes: determining the second index position in the first channel list based on the first index position of the elements in the first channel list preset in the network manager, a random number, and the length of the first channel list; exchanging the elements at the first index position and the elements at the second index position in the first channel list in the order of the first index positions of the elements in the first channel list to obtain a reordered first channel list.
[0009] Optionally, in the method for generating a hotspot channel according to the present invention, the step of determining the second index position in the first channel list includes: summing the remainder obtained by dividing the random number by the length of the first channel list with the first index position to obtain the second index position in the first channel list.
[0010] Optionally, in the method for generating a hotspot channel according to the present invention, the step of obtaining a second channel list supported by the wireless network driver includes: calling a wireless network driver interface through a socket for process communication to obtain a second channel list supported by the wireless network driver of the computing device.
[0011] Optionally, in the method for generating hotspot channels according to the present invention, the step of matching the reordered first channel list and the second channel list includes: comparing the elements in the second channel list with each element in the first channel list in turn according to the order of the elements in the second channel list; and taking the elements with the same comparison results as matching hotspot channels.
[0012] Optionally, in the method for generating a hotspot channel according to the present invention, it also includes: generating a hotspot signal based on the hotspot channel, including: transmitting the second predetermined information in the hotspot channel and the hotspot configuration file to the network connection tool, so that the network connection tool calls the wireless network driver interface based on the hotspot channel and the second predetermined information in the hotspot configuration file to generate a hotspot signal.
[0013] Optionally, in the method for generating a hotspot channel according to the present invention, the network manager is communicatively connected with the desktop environment of the computing device, and the method also includes: obtaining hotspot configuration information transmitted by the desktop environment, the hotspot configuration information including a service set identifier and a hotspot frequency band; generating a hotspot configuration file based on the hotspot configuration information, the hotspot configuration file including a service set identifier, a universal unique identifier code, a hotspot frequency band, and an encryption protocol.
[0014] Optionally, in the method for generating a hotspot channel according to the present invention, the hotspot configuration information is set by a control center in a desktop environment. According to a second aspect of the present invention, there is provided a computing device, comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be suitable for being executed by the at least one processor, and the program instructions include instructions for executing the method as described above.
[0015] According to a third aspect of the present invention, there is provided a readable storage medium storing program instructions, which, when read and executed by a computing device, enables the computing device to execute the method described above.
[0016] The technical solution of the present invention generates a random number based on the first predetermined information in the hotspot configuration file through a hash algorithm, reorders the first channel list in the network manager according to the random number, and achieves the effect of randomly disrupting the first channel list, and matches the reordered first channel list with the second channel list supported by the wireless network driver to obtain matching hotspot channels, thereby achieving the effect of randomly generating hotspot channels, making the channel distribution of hotspot signals in space more dispersed, greatly reducing the probability that all devices use the same channel to communicate, and greatly reducing the probability of mutual interference between hotspot signals, thereby improving the throughput performance and wireless transmission quality of the entire network, and improving the user's network experience.
[0017] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.
[0019] Figure 1 A block diagram of the physical components of computing device 100 is shown;
[0020] Figure 2 A schematic diagram of channel distribution in a 2.4 GHz frequency band according to an embodiment of the present invention is shown;
[0021] Figure 3A flow chart of a method 300 for generating a hotspot channel according to an embodiment of the present invention is shown;
[0022] Figure 4 A schematic diagram showing a Linux system network architecture diagram according to an embodiment of the present invention is shown;
[0023] Figure 5 A schematic flow chart of a method 500 for generating a hotspot channel according to another embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0025] Figure 1 A block diagram of the physical components (i.e., hardware) of a computing device 100 is shown. In a basic configuration, the computing device 100 includes at least one processing unit 102 and a system memory 104. According to one aspect, depending on the configuration and type of the computing device, the processing unit 102 can be implemented as a processor. The system memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, the system memory 104 includes an operating system 105 and a program module 106, and the operating system 105 includes a network manager 120 for executing the hotspot channel generation method of the present invention.
[0026] According to one aspect, operating system 105 is suitable for controlling the operation of computing device 100, for example. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other application programs, and are not limited to any particular application or system. Figure 1 This basic configuration is illustrated in FIG. 1 by those components within dashed line 108. According to one aspect, computing device 100 has additional features or functionality. For example, according to one aspect, computing device 100 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes. Such additional storage Figure 1 1 is illustrated by a removable storage device 109 and a non-removable storage device 110.
[0027] As stated above, according to one aspect, a program module 106 is stored in the system memory 104. According to one aspect, the program module 106 may include one or more application programs, and the present invention does not limit the type of application program, for example, the application program may include: email and contact application programs, word processing application programs, spreadsheet application programs, database application programs, slide show application programs, drawing or computer-aided application programs, web browser application programs, etc.
[0028] According to one aspect, the examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 1 Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such a SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") into a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via a dedicated logic integrated with other components of the computing device 100 on a single integrated circuit (chip). Embodiments of the present invention can also be practiced using other technologies capable of performing logical operations (such as AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.
[0029] According to one aspect, the computing device 100 may also have one or more input devices 112, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output devices 114 may also be included, such as a display, a speaker, a printer, etc. The aforementioned devices are examples and other devices may also be used. The computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and / or transceiver circuits; Universal Serial Bus (USB), parallel and / or serial ports.
[0030] The term computer-readable medium as used herein includes computer storage media. Computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules). System memory 104, removable storage device 109, and non-removable storage device 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices, or any other products that can be used to store information and can be accessed by computer device 100. According to one aspect, any such computer storage medium can be a part of computing device 100. Computer storage media does not include carrier waves or other propagated data signals.
[0031] According to one aspect, communication media is implemented by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in a manner that encodes information in the signal. By way of example and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.
[0032] In one embodiment of the present invention, the computing device 100 includes one or more processors and one or more readable storage media storing program instructions. When the program instructions are configured to be executed by one or more processors, the computing device executes the method for generating a hotspot channel in the embodiment of the present invention.
[0033] At present, if a large number of hotspot signals of the same frequency band are in the same hotspot channel, there will be a problem of co-channel interference between the hotspot signals. Among them, co-channel interference refers to the mutual interference between two wireless local area network (WLAN) devices working on the same frequency. WLAN works in the ISM band (Industry, Science and Medicine Band), including 2.4GHz and 5GHz bands. Each band is divided into multiple channels, so that WIFI radio frequency signals are transmitted within a specific frequency range. Figure 2 FIG. 4 shows a schematic diagram of channel distribution in a 2.4 GHz frequency band according to an embodiment of the present invention. Figure 2As shown, the 2.4GHz frequency band includes multiple hotspot channels. When the current mainstream operating system creates a hotspot, if the created hotspot signal is in the 2.4GHz frequency band, the default is to use channel 1 (2412), which creates a co-channel interference problem and will seriously affect the transmission quality of the network signal. Therefore, wireless networks should try to avoid co-channel interference and use non-overlapping channels to create hotspot signals. To this end, the present invention proposes a method for generating hotspot channels to achieve random hotspot channels, avoid a large number of devices establishing communication through the same hotspot channel, greatly reduce the possibility of co-channel interference, and improve the communication quality of devices communicating through wireless networks.
[0034] Figure 3 A flow chart of a method 300 for generating a hotspot channel according to an embodiment of the present invention is shown. The method 300 is suitable for being executed in a network manager of a computing device (such as the aforementioned computing device 100). In the operating system of the computing device, a network manager (nm for short) provides system network management services.
[0035] like Figure 3 As shown, the method 300 starts at step S310 .
[0036] In step S310, hotspot configuration information transmitted by the desktop environment of the computing device is obtained, the hotspot configuration information including a service set identifier and a hotspot frequency band, wherein the hotspot configuration information is set by a control center in the desktop environment.
[0037] Specifically, when a user creates a hotspot in the control center of a computing device, the hotspot configuration information is set, and the hotspot configuration information specifically includes: Service Set Identifier (SSID) and hotspot frequency band (usually 2.4GHz or 5GHz), and the hotspot configuration information may also include encryption type. The desktop environment of the computing device (e.g., DeepinDesktop Environment, DDE) transmits the hotspot configuration information set by the user to the network manager.
[0038] Then, in step S320, a hotspot configuration file is generated based on the hotspot configuration information, and the hotspot configuration file includes: a service set identifier, a universal unique identifier code, a hotspot frequency band, and an encryption protocol.
[0039] The following is an example hotspot configuration file:
[0040] [connection]
[0041] id=test-hotspot / / service set identifier
[0042] uuid=f4cadb37-77a9-43a6-98b9-8f10c8c8d844 / / Universal unique identifier
[0043] type=wifi
[0044] autoconnect=false
[0045] interface-name=wlp2s0 / / Network card name
[0046] permissions=
[0047] [wifi]
[0048] band=bg / / hotspot frequency band
[0049] channel = 1 / / hotspot channel
[0050] mac-address-blacklist=
[0051] mode=ap / / mode is hotspot type
[0052] ssid=test-hotspot / / hotspot SSID
[0053] [wifi-security] / / Hotspot security information, encryption protocol information
[0054] group=ccmp;
[0055] key-mgmt=wpa-psk
[0056] pairwise=ccmp;
[0057] proto=rsn;
[0058] psk=12345678 / / hotspot password
[0059] [ipv4]
[0060] dns-search=
[0061] method=shared
[0062] [ipv6]
[0063] addr-gen-mode=stable-privacy
[0064] dns-search=
[0065] method=ignore
[0066] [proxy]
[0067] According to an embodiment of the present invention, when a user creates a hotspot, through the control center of the DDE, after setting basic information such as SSID, frequency band, encryption type, etc. in the user interaction interface for creating a hotspot, the network manager generates a hotspot configuration file and initializes a structure data of the NMSettingWireless type to represent the information included in the hotspot configuration file. NMSettingWireless is a data structure used in the network manager to describe the hotspot configuration file, and the data structure of the hotspot configuration file can be an NMSettingWireless structure.
[0068] Then, in step S330, the network manager obtains first predetermined information from the hotspot configuration file, wherein the first predetermined information includes a service set identifier or a universal unique identifier.
[0069] Optionally, the acquired first predetermined information is converted into an integer type to facilitate subsequent hash calculation of the first predetermined information.
[0070] Subsequently, in step S340, a hash calculation is performed on the first predetermined information through a hash algorithm to generate a random number based on the first predetermined information.
[0071] Preferably, the hash algorithm adopts the SipHash algorithm, and a random number is generated based on the first predetermined information through the SipHash algorithm. In the method for generating a hotspot channel of the present invention, the use of the SipHash algorithm has the following advantages: the SipHash algorithm can solve the security problems caused by HashFlooding, and the SipHash algorithm can effectively mitigate HashFlooding attacks and improve the security of hotspot channel generation. Moreover, the source code of the existing network manager has integrated SipHash-related function interfaces, which can be used directly, which can greatly improve the implementation efficiency of the technical solution of the present invention and reduce the difficulty of implementing the technical solution. Optionally, other hash algorithms other than SipHash can also be used to perform step S340 of the present invention.
[0072] Then, in step S350, the channels in the first channel list preset in the network manager are reordered by using the generated random numbers.
[0073] According to an embodiment of the present invention, first, the second index position in the first channel list is determined according to the first index position of the element in the first channel list preset in the network manager, a random number, and the length of the first channel list.
[0074] Specifically, the first channel list includes at least one element, each element represents a channel, and each element corresponds to an index (i.e., a first index position). The remainder obtained by dividing the random number generated in step S340 by the length of the first channel list is summed with the first index position to obtain a second index position in the first channel list. The value of the length of the first channel list decreases by 1 with each operation. When the condition that the value of the length of the first channel list is greater than 1 is not met, the operation ends.
[0075] Then, according to the order of the first index positions of the elements in the first channel list, the elements at the first index positions in the first channel list are exchanged with the elements at the second index positions to obtain a reordered first channel list.
[0076] Optionally, the element at the first index position is swapped with the element at the second index position in the positive order (the order from the first element to the last element) or the reverse order (the order from the last element to the first element) of the elements in the first channel list. Whenever the first index position changes, the second index position is also recalculated accordingly.
[0077] Next, a method for reordering channels in a preset first channel list is described in conjunction with an embodiment. The following is an exemplary preset first channel list in a network manager:
[0078] const guint32a_freqs[] = {5180,5200,5220,5745,5765,5785,5805,0}; / / 5GHz frequency band
[0079] const guint32 bg_freqs[] = {2412,2437,2462,2472,0}; / / 2.4GHz frequency band
[0080] The following is an exemplary pseudo code for reordering the channels in the preset first channel list:
[0081] for(i=0,len=freq_len;len>1;i++,len--){
[0082] NM_SWAP(&rand_freqs[i],&rand_freqs[i+(rand%len)]);
[0083] }
[0084] Wherein, len is the length of the preset first channel list, rand_freqs[] is the array of the stored preset first channel list, rand is the random number generated in step S340, and i represents the first index position of rand_freqs[].
[0085] The function (NM_SWAP) for swapping positions continuously randomly swaps the elements in the rand_freqs[] array, thereby disrupting the order of the elements in the preset first channel list. Ultimately, the elements in the rand_freqs[] array are reordered from the original elements in the rand_freqs[] array, achieving a random effect. For example: the channels in the first channel list {2412, 2437, 2462, 2472, 0} of the exemplary 2.4 GHz frequency band are reordered in the order of the first index positions of the elements in the first channel list from front to back. In the first round of exchange, the first index position i=0, the length of the first channel list len=5, assuming that the generated random number rand=9, the second index position is calculated by the first index position, the random number, and the length of the first channel list, the random number 9 is divided by the length 5 of the first channel list to obtain the remainder 4, and the remainder is added to the first index position 0 to obtain the second index position 4, then the element rand_freqs[0] at the first index position in the first channel list (i.e., the first element 2412 in the first channel list) is exchanged with the element rand_freqs[4] at the second index position (i.e., the fifth element 0 in the first channel list) to obtain the first channel list {0, 2437, 2462, 2472, 2412} after the first round of exchange.
[0086] Then, the second round of exchange is performed, the first index position is increased by 1, that is, i=1, and the length of the first channel list is reduced by 1, that is, len=4. Similarly, the second index position is 2. Then, the element rand_freqs[1] at the first index position in the first channel list (that is, the second element 2437 in the first channel list after the previous round of exchange) is exchanged with the element rand_freqs[2] at the second index position (that is, the third element 2462 in the first channel list after the previous round of exchange) to obtain the first channel list {0, 2462, 2437, 2472, 2412} after the second round of exchange. The third and fourth rounds of exchanges are performed in the same way. In the fourth round of exchanges, the first index position increases to i=3, and the length of the first channel list decreases to len=2. If the fifth round of exchanges is performed, the length of the first channel list will not meet the condition of being greater than 1. Therefore, in this example, after the fourth round of exchanges is completed, the preset first channel list is reordered to obtain the reordered first channel list {0, 2462, 2412, 2437, 2472}, achieving the effect of randomly ordering the preset first channels.
[0087] Then, in step S360, a second channel list supported by the wireless network driver is obtained.
[0088] Specifically, the kernel API is called inside the network manager to directly obtain the channel list supported by the driver. The network manager can call the wireless network driver interface through the socket used for process communication to obtain the second channel list supported by the wireless network driver of the computing device. Optionally, the socket used for process communication is Netlink, and the wireless network driver interface is a WIFI driver interface. Usually, the hotspot channels supported by different chip manufacturers are not consistent. The channel list supported by the wireless network driver can be printed through the log information of the network manager. Due to the differences in 802.11b / g / a protocols, the supported channels are also different.
[0089] The following shows an example of the channels supported by the wireless network driver:
[0090] nl80211:Mode IEEE 802.11g:2412 2417 2422 2427 2432 2437 2442 24472452 2457 2462 2467[NO_IR]2472[NO_IR]2484[NO_IR]
[0091] nl80211:Mode IEEE 802.11a:5180[NO_IR]5200[NO_IR]5220[NO_IR]5240[NO_IR]5260[NO_IR][RADAR]5280[NO_IR][RADAR]5300[NO_IR]
[0092] nl80211:Mode IEEE 802.11b:2412 2417 2422 2427 2432 2437 2442 24472452 2457 2462 2467[NO_IR]2472[NO_IR]2484[NO_IR]
[0093] Then, in step S370, the reordered first channel list and the second channel list are matched to generate a matching hotspot channel, so as to generate a hotspot signal based on the hotspot channel. The hotspot signal can be a Bluetooth shared network or WIFI, which is also called a wireless hotspot or wireless network.
[0094] Specifically, the elements in the second channel list are compared with each element in the first channel list in sequence according to the order of the elements in the second channel list, and the elements with the same comparison results are used as matching hotspot channels. Optionally, the elements in the first channel list are compared with each element in the second channel list in sequence according to the order of the elements in the first channel list, and the elements with the same comparison results are used as matching hotspot channels.
[0095] According to one embodiment of the present invention, each element in the second channel list is compared with each element in the first channel list (in order from the first element to the last element) in turn, and the first elements with the same comparison are regarded as matching hotspot channels.
[0096] The following is an exemplary pseudo code for implementing matching of the reordered first channel list and the second channel list according to the present invention:
[0097]
[0098]
[0099] Among them, driver_freqs[] is the second channel list supported by the wireless network driver, j is the index in the second channel list, and rand_freqs[] here is the reordered first channel list, and i is the index in the reordered first channel list.
[0100] In the above example, the reordered first channel list and the second channel list supported by the wireless network driver are stored in two integer type (int type) arrays respectively. By looping through the two arrays and comparing the values in the two arrays, when there are values in the two arrays that are equal, the match is successful and the value is returned. This value is used as the final selected hotspot channel (actually the corresponding frequency).
[0101] According to an embodiment of the present invention, after a matching hotspot channel is generated, the network manager transmits the matched hotspot channel and the second predetermined information in the hotspot configuration file to the network connection tool, so that the network connection tool calls the wireless network driver interface based on the hotspot channel and the second predetermined information in the hotspot configuration file to generate a hotspot signal. The second predetermined information includes a service set identifier, a hotspot frequency band, and an encryption protocol.
[0102] Optionally, the network manager transmits the hotspot channel and the second predetermined information to the network connection tool through an inter-process communication mechanism (D-Bus) optimized for the desktop environment. Subsequently, the network connection tool calls the wireless network driver interface, sets the driver parameters (i.e., the second predetermined information), and generates a hotspot signal according to the specified channel (i.e., the matching hotspot channel). The network connection tool is WPA Supplicant (abbreviated as WPA). Figure 4 A schematic diagram of a Linux system network architecture diagram according to an embodiment of the present invention is shown. Among them, WPA Supplicant is a system service for WIFI connection management, which can be used as a tool for configuring WIFI. In the Linux system, it provides an interface to the network manager through D-Bus upward and calls the nl80211 driver interface downward through Netlink. WPA Supplicant is widely used in operating systems. On operating systems such as Android, Linux, and Hongmeng, WPASupplicant is used as the system service for WIFI connection, but different systems also encapsulate a layer of network management service on it, and in the Linux system it is network-manager.
[0103] Since the existing random numbers generated by the function of generating random numbers are not real random numbers, those skilled in the art usually call them pseudo-random numbers, which are a series of numbers calculated based on a number and a recursive formula. Only when the number of numbers in this series is large enough, the generated random numbers generally conform to the normal distribution. Therefore, the random numbers generated in this way are not effective, prone to conflicts, and have unsatisfactory performance. However, through the hotspot channel generation method of the present invention, a random number is generated based on the first predetermined information in the hotspot configuration file, and then the first channel list is reordered based on this random number. Finally, through the matching of the two channel lists, the hotspot channel finally obtained makes the allocation of hotspot channels have a good dispersion effect, which can avoid interference between hotspot signals.
[0104] In order to more clearly illustrate the method for generating a hotspot channel of the present invention, the technical solution of the present invention is described below with reference to a specific example. Figure 5 FIG. 5 is a flow chart of a method 500 for generating a hotspot channel according to another embodiment of the present invention. Figure 5 As shown, the method 500 starts at step S510 .
[0105] In step S510, the SSID is obtained from the hotspot configuration file. The specific content of step S510 can refer to the description in the above step S330.
[0106] Then, in step S520, the acquired SSID is converted into an integer type (eg, uint8 type).
[0107] In step S522, a hash function seed is obtained.
[0108] Then, in step S524, the converted SSID and the hash function seed are combined with the Siphash function (c_siphash_hash) in the hash function to generate a random number in step S526. The specific contents of steps S520-S526 can refer to the description of the aforementioned step S340.
[0109] Then, in step S528, the preset first channel list is reordered using the random number to obtain a randomized first channel list. The specific content of step S528 can refer to the description of the aforementioned step S350.
[0110] In step S512, a second channel list supported by the driver is obtained. The specific content of step S512 can refer to the description of the aforementioned step S360.
[0111] Then, in step S530, the randomized first channel list and the second channel list are matched to obtain random hotspot channels. The specific content of step S530 can refer to the description of the aforementioned step S370.
[0112] The technical solution of the present invention generates a random number based on the first predetermined information in the hotspot configuration file through a hash algorithm, reorders the first channel list in the network manager according to the random number, and achieves the effect of randomly disrupting the first channel list, and matches the reordered first channel list with the second channel list supported by the wireless network driver to generate matching hotspot channels, thereby achieving the effect of randomly generating hotspot channels, making the channels of wireless radio frequency signals in space more dispersed, greatly reducing the probability that all devices use the same channel for communication, and reducing mutual interference between hotspot signals, thereby improving the throughput performance and wireless transmission quality of the entire network, and improving the user's network experience.
[0113] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0114] In the case where the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the method for generating a hotspot channel of the present invention according to the instructions in the program code stored in the memory.
[0115] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.
[0116] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to implement the content of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of the present invention.
[0117] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0118] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof.
[0119] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0120] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition they can be divided into multiple submodules or subunits or subassemblies. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification and all processes or units of any method or device disclosed in this manner can be combined in any combination. Unless otherwise clearly stated, each feature disclosed in this specification can be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0121] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present invention and to form different embodiments.
[0122] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0123] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0124] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is primarily selected for readability and instructional purposes, rather than for explaining or limiting the subject matter of the present invention.
Claims
1. A method for generating a hotspot channel, executed in a network manager of a computing device, the method comprising: Obtaining first reservation information from a hotspot configuration file; Performing a hash calculation on the first predetermined information by using a hash algorithm to generate a random number; Determining a second index position in the first channel list according to a first index position of an element in the first channel list preset in the network manager, the random number, and the length of the first channel list, comprising: summing a remainder obtained by dividing the random number by the length of the first channel list and the first index position to obtain the second index position in the first channel list; According to the order of the first index positions of the elements in the first channel list, the elements at the first index positions in the first channel list are exchanged with the elements at the second index positions to obtain a reordered first channel list; Calling a wireless network driver interface through a socket for process communication to obtain a second channel list supported by the wireless network driver of the computing device; The reordered first channel list and the second channel list are matched to generate a matching hotspot channel.
2. The method according to claim 1, wherein: The step of matching the reordered first channel list with the second channel list comprises: According to the order of the elements in the second channel list, sequentially compare the elements in the second channel list with each element in the first channel list; Elements with the same comparison results are regarded as matching hotspot channels.
3. The method according to claim 1, further comprising: Generating a hotspot signal based on the hotspot channel includes: The hotspot channel and the second predetermined information in the hotspot configuration file are transmitted to the network connection tool, so that the network connection tool calls the wireless network driver interface to generate a hotspot signal based on the hotspot channel and the second predetermined information in the hotspot configuration file.
4. The method according to claim 1, wherein: The network manager is communicatively connected to a desktop environment of the computing device, and the method further comprises: Acquire hotspot configuration information transmitted by the desktop environment, the hotspot configuration information including a service set identifier and a hotspot frequency band; A hotspot configuration file is generated based on the hotspot configuration information, wherein the hotspot configuration file includes a service set identifier, a universal unique identifier code, a hotspot frequency band, and an encryption protocol.
5. The method according to claim 4, wherein: The hotspot configuration information is set by a control center in the desktop environment.
6. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 5.
7. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, the computing device executes the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
WiFi hotspot channel selection method and system, and storage medium
CN107395297A
Data encryption and decryption method, MCU, electronic equipment and readable storage medium
CN111767553A
