Query method and device of routing table, storage medium and electronic device

By introducing routing table entries with effective fields in wireless ad hoc networks, the problem of complex routing table maintenance is solved, enabling more efficient routing table management and stable data transmission.

CN115767668BActive Publication Date: 2025-12-30HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211349584.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2025-12-30
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

The maintenance process of routing tables in wireless ad hoc networks is complex and cannot effectively balance the complex and ever-changing network environment with stable and efficient routing capabilities.

Method used

By introducing an effectiveness field (effectiveness result and effective time) into the routing table entry, a routing query request is sent when the effectiveness field is in an invalid state, and the routing table is updated based on the response information, thus optimizing the routing query process.

Benefits of technology

It improves the efficiency of routing table maintenance in wireless ad hoc networks, reduces data transmission latency, and enhances data transmission stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115767668B_ABST
    Figure CN115767668B_ABST
Patent Text Reader

Abstract

The application discloses a routing table query method and device, a storage medium and an electronic device, relates to the technical field of smart homes, and comprises the following steps: determining a first routing table corresponding to a first device, wherein the first routing table comprises a routing table item, and the routing table item is used for indicating an address combination and an effective field of the first device for data transmission; the effective field comprises an effective result and an effective time; in the case that the first device is to be used for data transmission to a second device, and a target next-hop address corresponding to the second device exists a matched address combination in the first routing table, identifying a target state of the effective field corresponding to the address combination; in the case that the effective field is in an invalid state, sending a first routing query request, and updating the first routing table according to first response information corresponding to the first routing query request. By adopting the technical scheme, the problems of complex process of effectively maintaining the routing table in the wireless self-organizing network are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of smart home, in particular to a routing table query method and device, a storage medium and an electronic device. BACKGROUND

[0002] Wireless self-organizing network is an independent network autonomous system, which does not depend on fixed backbone network (but can cooperate with it) or base station. The system can be quickly deployed to the site to establish a complete, powerful and high-anti-destroy network communication system, and provide effective data and multimedia communication services. Wireless self-organizing network uses wireless communication technology, and all hosts can be freely moved, and the hosts are connected by wireless links. Since the range covered by wireless signal is limited, the data transmission between end-to-end needs the relay of intermediate nodes (other mobile hosts), so the wireless self-organizing network belongs to multi-hop wireless network, and all hosts are end systems and can be used as routers. In order to carry out effective communication, a suitable routing mechanism must be established between mobile hosts.

[0003] Since there is no central router for forwarding in wireless self-organizing network, each host in the network is both a sender and a receiver of information, and also acts as a router to forward the received information, so the routing protocol of wireless self-organizing network is more complex, and the implementation function is also challenging. At the same time, the structure of wireless self-organizing network is far from the stable topology of traditional network, and the hosts that join and exit at any time may change the routing line, which will lead to a significant increase in the frequency of routing table query; the routing technology of wireless self-organizing network cannot meet the needs of coping with the complex and changeable network environment of wireless self-organizing network and providing stable and efficient routing ability for data transmission in wireless self-organizing network.

[0004] For the problems such as complex process of being unable to effectively maintain the routing table in wireless self-organizing network in the related art, no effective solution has been proposed. SUMMARY

[0005] The embodiments of the present application provide a routing table query method and device, a storage medium and an electronic device, to at least solve the problems such as complex process of being unable to effectively maintain the routing table in wireless self-organizing network in the related art.

[0006] According to one embodiment of this application, a method for querying a routing table is provided, comprising: determining a first routing table corresponding to a first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for the first device to perform data transmission, the effective field including: effective result and effective time; when the first device is about to transmit data to a second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, identifying the target status of the effective field corresponding to the address combination; when the effective field is in an invalid state, sending a first routing query request, and updating the first routing table according to the first response information corresponding to the first routing query request.

[0007] In an exemplary embodiment, after identifying the target state of the effective field corresponding to the address combination, the method further includes: if the effective field is in a valid state, establishing a data transmission relationship between the first device and the second device based on the address combination, and adjusting the effective time corresponding to the effective field in the valid state to the maximum timing duration.

[0008] In an exemplary embodiment, when the effective field is in an invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request, including: sending the first routing query request to the next-hop address corresponding to the address combination; adjusting the effective result corresponding to the effective field in the invalid state from invalid characters to valid characters according to the first response information corresponding to the first routing query request; and adjusting the effective time corresponding to the effective field in the invalid state to the maximum timeout duration.

[0009] In an exemplary embodiment, before updating the first routing table based on the first response information corresponding to the first routing query request, the method further includes: if it is determined that the first routing query request has not obtained the corresponding first response information, determining that the first device broadcasts a second routing query request in its network; determining a first new routing table entry based on the second response information corresponding to the second routing query request; adding the first new routing table entry to the first routing table; setting the effective result included in the effective field of the first new routing table entry to a valid character; and adjusting the effective time included in the effective field of the first new routing table entry to the maximum timing duration.

[0010] In an exemplary embodiment, the method further includes: when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device does not have a matching address combination in the first routing table, sending a third routing query request to obtain the target next-hop address; determining the target next-hop address based on the third response information corresponding to the third routing query request, and determining a second newly added routing table entry corresponding to the target next-hop address; adding the second newly added routing table entry to the first routing table, setting the effective result included in the effective field of the second newly added routing table entry to a valid character, and adjusting the effective time included in the effective field of the second newly added routing table entry to the maximum timing duration.

[0011] In one exemplary embodiment, the method further includes: obtaining a preset time-to-live (TTL) value, wherein the preset TTL value is used to indicate the number of times a routing query request is allowed to be forwarded by other devices, the number of times being less than or equal to the maximum number of hops corresponding to the network currently in which the first device is located; adding the preset TTL value to a routing query request, wherein the routing query request includes at least one of the following: a first routing query request; a second routing query request; and a third routing query request.

[0012] In an exemplary embodiment, after sending the first routing query request when the effective field is in an invalid state, the method further includes: deleting the routing table entry carrying the address combination from the first routing table when it is determined that the first device has received the second routing query request sent by itself.

[0013] According to another embodiment of this application, a routing table query device is also provided, comprising: a determining module, configured to determine a first routing table corresponding to a first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for data transmission by the first device, the effective field including: effective result and effective time; an identifying module, configured to identify the target status of the effective field corresponding to the address combination when the first device is about to transmit data to a second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table; and an updating module, configured to send a first routing query request when the effective field is in an invalid state, and update the first routing table according to the first response information corresponding to the first routing query request.

[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described routing table lookup method at runtime.

[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described routing table lookup method through the computer program.

[0016] In this embodiment, a first routing table corresponding to the first device is determined. The first routing table includes routing table entries, which are used to indicate the address combination and effective field for the first device to transmit data. The effective field includes the effective result and the effective time. When the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, the target status of the effective field corresponding to the address combination is identified. When the effective field is in an invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request. This solves the problem of complex processes that make it impossible to effectively maintain the routing table in the wireless ad hoc network. Through the above-mentioned routing table query method, the efficiency of effectively maintaining the routing table in the wireless ad hoc network can be improved, avoiding the routing query work only starting when data is transmitted, reducing data transmission latency, and improving the stability of data transmission. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the hardware environment for a routing table lookup method according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of a routing table lookup method according to an embodiment of this application;

[0021] Figure 3 This is a schematic diagram of the update after querying the routing table according to an optional embodiment of this application;

[0022] Figure 4 This is a flowchart of a routing table lookup method according to an optional embodiment of this application.

[0023] Figure 5This is a flowchart illustrating the processing of a routing query request by all devices according to optional embodiments of this application;

[0024] Figure 6 This is a structural block diagram of a routing table query device according to an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] According to one aspect of the embodiments of this application, a method for querying a routing table is provided. This method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned routing table query method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0028] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0029] To enable those skilled in the art to better understand the present application, it should be clarified that routing protocols for wireless ad hoc networks are mainly divided into two categories: table-driven routing protocols and on-demand routing protocols.

[0030] Table-driven routing protocols (priority-based) require each node to maintain a routing table containing information about routes to other nodes. Representative protocols include FSR (Fisheye State Routing Protocol) and OLSR (Optimized Link State Routing). This type of routing protocol relies on a relatively stable network topology, which is difficult to achieve in wireless ad hoc networks. Therefore, if table-driven routing protocols are used in wireless ad hoc networks, nodes typically need to frequently send report / detection messages to check network status and update routing information, and almost all nodes in the network need to participate in the routing information maintenance work. This approach usually incurs significant overhead in maintaining routing information. Its advantages lie in its ability to perform accurate and stable data routing based on pre-defined routing information in most cases during data transmission. It also offers low data transmission latency and good stability.

[0031] On-demand routing protocols (reactive) only perform route lookups when information is needed to be transmitted. Representative protocols include AODV (Ad hoc On-Demand Distance Vector Routing) and DSRP (Dynamic Source Routing). These protocols are better suited to the unstable topology of wireless ad hoc networks, where most network nodes are constrained devices with high power consumption and bandwidth requirements. Therefore, on-demand routing protocols dominate in wireless ad hoc networks. However, these protocols typically only begin route lookups when data transmission occurs, leading to high data transmission latency and poor stability. Furthermore, if a large number of network nodes need to transmit data simultaneously, it can cause a sudden surge in network traffic, resulting in significant traffic fluctuations and posing significant challenges to network deployment.

[0032] This embodiment provides a method for querying a routing table, applied to a terminal device. Figure 2 This is a flowchart of a routing table query method according to an embodiment of this application, which includes the following steps:

[0033] Step S202: Determine the first routing table corresponding to the first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for the first device to perform data transmission, and the effective field includes: effective result and effective time;

[0034] Step S204: When the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, identify the target status of the effective field corresponding to the address combination.

[0035] Step S206: If the effective field is in an invalid state, send a first route query request and update the first route table according to the first response information corresponding to the first route query request.

[0036] Through the above steps, the first routing table corresponding to the first device is determined. The first routing table includes routing table entries, which are used to indicate the address combination and effective field for the first device to perform data transmission. The effective field includes the effective result and the effective time. When the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, the target status of the effective field corresponding to the address combination is identified. When the effective field is in an invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request. This solves the problem of complex processes that make it impossible to effectively maintain the routing table in the wireless ad hoc network. Through the above-mentioned routing table query method, the efficiency of effectively maintaining the routing table in the wireless ad hoc network can be improved, avoiding the need to start the routing query work only when data transmission occurs, reducing data transmission latency, and improving the stability of data transmission.

[0037] In an exemplary embodiment, after identifying the target state of the effective field corresponding to the address combination, the method further includes: if the effective field is in a valid state, establishing a data transmission relationship between the first device and the second device based on the address combination, and adjusting the effective time corresponding to the effective field in the valid state to the maximum timing duration.

[0038] Understandably, after establishing the data transmission relationship between the first and second devices based on the address combination corresponding to the effective field of the effective status, in order to ensure stable data transmission, the effective time in the effective field of the effective status is refreshed and reset to the maximum timing duration to ensure the continued validity of the routing table entry during data transmission.

[0039] In an exemplary embodiment, when the effective field is in an invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request, including: sending the first routing query request to the next-hop address corresponding to the address combination; adjusting the effective result corresponding to the effective field in the invalid state from invalid characters to valid characters according to the first response information corresponding to the first routing query request; and adjusting the effective time corresponding to the effective field in the invalid state to the maximum timeout duration.

[0040] In simple terms, a lookup of a routing table entry is triggered only when the first device needs to transmit data to the next-hop address corresponding to the failed entry. To prevent indefinite forwarding of routing query requests, a Time-to-Live (TTL) value is added to the request. This TTL value is related to the maximum hop count of the current ad hoc network. Each time a TTL-enabled routing query request is forwarded by another device, the TTL value is decremented. When the TTL value reaches 0, forwarding of the request stops, effectively preventing routing loops. It's understandable that even if a routing table entry fails, it shouldn't be discarded and a new broadcast routing query performed when access to the device is needed. Instead, a unicast routing query should be performed based on the existing entry. If successful, the routing table entry is refreshed; otherwise, a broadcast routing query is performed. Finally, after obtaining the response information corresponding to the route query request, the response information is used to update the invalid route table entry. The effective result corresponding to the effective field of the invalid route table entry is changed from invalid characters to valid characters, and the effective time corresponding to the effective field is adjusted to the maximum timeout duration. In this way, the invalid route table entry can be restored to a valid route table entry in the route table.

[0041] Understandably, if the first device does not have the next-hop address of the destination address of the second device in its local first routing table before sending data, it will initiate a first routing query request. This first routing query request is a broadcast routing query. When initiating the first routing query request, a Time to Live (TTL) value needs to be set for the request. This TTL value should be set carefully. In addition, the TTL value should theoretically be equal to the maximum number of hops in the wireless ad hoc network.

[0042] In an optional embodiment, the time-to-live (TTL) value can be set to a default value of 5. If the TTL value corresponding to the first routing query request is less than or equal to 5 and the first response information corresponding to the first routing query request is successfully received, it is determined that the routing table query corresponding to the routing query request initiated by the first device has been successfully executed. In addition, after receiving the broadcast first routing query, other devices besides the first device need to respond to the request if they find that it is their own address. If it is not their own address, they first determine whether they have received and forwarded the message. If so, they silently discard the message. If not, they continue to broadcast the request if they determine that the TTL value corresponding to the first routing query request is not zero.

[0043] In an exemplary embodiment, before updating the first routing table based on the first response information corresponding to the first routing query request, the method further includes: if it is determined that the first routing query request has not obtained the corresponding first response information, determining that the first device broadcasts a second routing query request in its network; determining a first new routing table entry based on the second response information corresponding to the second routing query request; adding the first new routing table entry to the first routing table; setting the effective result included in the effective field of the first new routing table entry to a valid character; and adjusting the effective time included in the effective field of the first new routing table entry to the maximum timing duration.

[0044] For example, the target device should first initiate a unicast route query request (equivalent to the first route query request mentioned above) to the destination device corresponding to the next-hop address of the route table entry in the expired state of the routing table. After receiving the request, if the destination device has routing information in its own routing table, it will forward the query request; otherwise, it will discard the request. After sending the unicast route query request, the target device will wait for a period of time. If it receives a response, it will refresh its local routing information (here, the timeout of the expired entry should be directly restored), and complete the unicast route query. If it does not receive a response, the unicast route query fails and is converted to a broadcast route query. That is, when the first route query request fails, the second route query request is rebroadcast in the network where the target device is located, and the new route table entry used to update the routing table is determined according to the second response information corresponding to the second route query request.

[0045] Understandably, since the second route query request corresponds to a broadcast method, it's possible to receive second response messages from multiple other destination devices simultaneously. To improve the data transmission efficiency indicated by the routing table entry, the number of hops the route can reach should be carried in the route query response message, and an appropriate next-hop address should be selected and recorded in the target device's routing table (e.g., the minimum number of hops, the highest next-hop signal strength, etc.). In fact, the first second response message received should have high priority, at least indicating that the current data exchange time is the shortest.

[0046] In an exemplary embodiment, the method further includes: when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device does not have a matching address combination in the first routing table, sending a third routing query request to obtain the target next-hop address; determining the target next-hop address based on the third response information corresponding to the third routing query request, and determining a second newly added routing table entry corresponding to the target next-hop address; adding the second newly added routing table entry to the first routing table, setting the effective result included in the effective field of the second newly added routing table entry to a valid character, and adjusting the effective time included in the effective field of the second newly added routing table entry to the maximum timing duration.

[0047] In simple terms, when the next-hop address of the target device does not have a matching address combination in the first routing table, a third routing query request is broadcast directly in the network where the target device is located, and the new routing table entry for updating the routing table is determined based on the third response information corresponding to the third routing query request.

[0048] In an exemplary embodiment, when the effective field is in an invalid state, after sending the first routing query request, the method further includes: obtaining the waiting response time after the second routing query request is sent; if the waiting response time is greater than the effective time included in the effective field, determining that the state corresponding to the effective field has become invalid; and broadcasting a third routing query request for obtaining the next-hop address within the network where the first device is located.

[0049] Understandably, sending a second route query request based on the address combination of this routing table entry involves a certain waiting time. This is to prevent the second route query request from taking too long to complete, ensuring the timeliness of the route query. Furthermore, if the waiting time for a response exceeds the effective time included in the effective field, it indicates that the routing table entry was not updated in a timely manner while it was in a valid state. When the effective time becomes 0, the routing table changes from a valid state to an invalid state, confirming that the second route query request sent based on the next-hop address in the address combination did not receive a response.

[0050] In practical applications, considering the unreliability of routing query messages, if a request fails, a timeout retry should be performed. The timeout period depends on the application time of the actual scenario, and the number of retries can be flexibly set according to the use case. In one optional embodiment, the number of retries is set to 3. If the number of queries is less than or equal to 3, the first device is allowed to re-initiate the second routing query request; if the number of queries is greater than 3, the first device is prohibited from re-initiating the second routing query request. Furthermore, the query results of the routing table can also be displayed on the first device.

[0051] In one exemplary embodiment, the method further includes: obtaining a preset time-to-live (TTL) value, wherein the preset TTL value is used to indicate the number of times a routing query request is allowed to be forwarded by other devices, the number of times being less than or equal to the maximum number of hops corresponding to the network currently in which the first device is located; adding the preset TTL value to a routing query request, wherein the routing query request includes at least one of the following: a first routing query request; a second routing query request; and a third routing query request.

[0052] To ensure that routing query requests are not forwarded indefinitely, a time-to-live (TTL) value is added to the routing query request. This TTL value is related to the maximum number of hops corresponding to the current ad hoc network. When a routing query request carrying the TTL value is forwarded once by another device, the corresponding TTL value is decremented by one. When the TTL value becomes 0, the forwarding of the routing query request stops, thus effectively avoiding the problem of routing loops in routing queries.

[0053] In an exemplary embodiment, when the effective field is in an invalid state, after sending the first routing query request, the method further includes: if it is determined that the first device has received the second routing query request sent by itself, deleting the routing table entry carrying the address combination from the first routing table. That is, if the device that initiated the unicast routing query (equivalent to the second query request mentioned above) receives the query message it sent, it indicates that a routing loop has occurred, and the expired routing table entry needs to be deleted, the query message is silently discarded, and it cannot be forwarded further.

[0054] As an optional implementation method, an application description is provided to facilitate understanding of the above-mentioned routing table query method, but this does not limit the above scheme.

[0055] Optional, Figure 3 This is a schematic diagram illustrating the update of a routing table after a query, according to an optional embodiment of this application. Assume that the first device has three routing table entries in its first routing table. The node address and next-hop address of each first routing table entry are reachable. The effective result of the effective field of the first routing table entry is a valid character. The effective time of the effective field of the first routing table entry is 180 seconds, indicating that the effective field of the first routing table entry will become invalid after 180 seconds. After 180 seconds, the first routing table entry will become an invalid entry and needs to be updated before it can be used again. Optionally, the maximum allowed value for the effective time is 300 seconds. It should be noted that the maximum allowed value for the effective time can be flexibly set according to the actual usage of the routing table, and this application does not impose excessive limitations on this.

[0056] Secondly, the node address and next-hop address of the second routing table entry are reachable, the effective result corresponding to the effective field of the second routing table entry is an invalid character, and the effective time corresponding to the effective field of the second routing table entry is 0 seconds, indicating that the second routing table entry has become an invalid entry in the routing table, and the second routing table entry cannot indicate the data transmission between the target device and other devices corresponding to the next-hop address in the second routing table entry;

[0057] Secondly, if the node address and next-hop address of the third routing table entry are reachable, the effective result corresponding to the effective field of the third routing table entry is a valid character, the effective time corresponding to the effective field of the third routing table entry is 180 seconds, and there is a route query result for the next-hop address corresponding to the third routing table entry in the routing table, then the effective time corresponding to the effective field of the third routing table entry is adjusted from 180 seconds to the maximum allowed value of 300 seconds.

[0058] Optionally, when the first device is about to transmit data to the second device, and the target next-hop address of the second device is the same as that of the first routing table entry, since the effective field of the first routing table entry is in a valid state, the data transmission relationship between the first device and the second device can be established through the address combination corresponding to the first routing table entry. In order to ensure the stable transmission of data, the effective time in the effective field of the valid state is refreshed and reset to the maximum timeout duration. For example, the effective time of the first routing table entry is reset from 180 seconds to 300 seconds to ensure that the routing table entry remains valid during the data transmission process.

[0059] Optionally, when the first device needs to transmit data to the second device, and the target next-hop address of the second device is the same as that of the second routing table entry, since the effective field of the second routing table entry is in an invalid state, it is necessary to adjust the effective field of the second routing table entry from an invalid state to an effective state through a routing query to ensure smooth data transmission. Specifically, this involves adjusting the effective result corresponding to the invalid effective field in the second routing table entry from an invalid character to a valid character, and adjusting the effective time corresponding to the invalid effective field to the maximum timeout duration. For example, adjusting the effective result of the second routing table entry from an invalid character to a valid character, and incrementing the effective time from 0 seconds to 300 seconds, thereby making the second routing table entry a valid entry in the routing table.

[0060] It should be noted that if a unicast route query request for the address combination corresponding to the second route table entry (equivalent to the first route query request in the above embodiment) does not receive any response, that is, if the unicast route query request sent to the second route table entry does not receive a response after waiting for a period of time, the unicast route query fails and is converted to a broadcast route query. It should be noted that the above-mentioned waiting period of time is the timeout period that allows direct recovery of expired entries.

[0061] Optionally, after converting to a broadcast route query (equivalent to the third route query request in this embodiment of the invention), a new route table entry will be determined based on the response information corresponding to the broadcast route query, and the new route table entry will be added to the route table to complete the route table update.

[0062] Furthermore, when multiple results exist for a broadcast routing query, the routing information that receives the first response is selected as the information for generating a new routing table entry. This is because the response has a high priority, as it indicates that the current data exchange time is the shortest, meaning the route has the shortest number of hops during transmission, thereby improving data transmission efficiency and saving data transmission time.

[0063] To better understand the process of querying the routing table described above, the implementation flow of querying the routing table will be further explained below with reference to optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.

[0064] This embodiment provides a method for querying a routing table. Figure 4 This is a flowchart of a routing table lookup method according to an optional embodiment of this application, such as... Figure 4 As shown, the specific steps are as follows:

[0065] Step 302: Initiate a route query;

[0066] It should be noted that when a wireless ad hoc network device needs to send data to a destination device but does not know the next-hop address of the destination device, it needs to initiate a routing query to obtain the next-hop address.

[0067] Optionally, routing lookup is divided into two types: unicast routing lookup and broadcast routing lookup. Devices should prioritize unicast routing lookup to avoid wasting bandwidth. Considering that wireless ad hoc network devices are mostly stationary, based on this mechanism, even if the routing information expires, the routing information can be refreshed through a series of unicast acknowledgments to avoid the generation of broadcast messages.

[0068] Step 304: Determine if the destination address exists in the local routing table;

[0069] Step 306: If the device does not have the destination address in its local routing table before sending data, it initiates a broadcast route lookup; this broadcast route lookup is a network-wide broadcast; the specific process is as follows:

[0070] Step 306-1. The device initiates a network-wide broadcast routing query request. The TTL (Time to Live) in the corresponding message of the routing query request should be set carefully (theoretically, this message should be equal to the maximum number of hops in the wireless ad hoc network). Here, the default value is recommended to be 5.

[0071] Step 306-2. After receiving a broadcast routing query, all devices need to respond to the request if it is their own address. If it is not their own address, they first determine whether they have received and forwarded the message before. If so, they silently discard the message. If not, the message TTL is decremented by 1. If the TTL is not zero, they continue to broadcast the request.

[0072] Step 306-3. The requesting party waits for a period of time. If a response is received, the routing query ends. Otherwise, the routing query fails. Whether to extend the TTL (Time to Live) of the request message for the next query depends on the implementation.

[0073] Step 308: If the device routing table contains routing information for the destination address, determine whether the information in the routing table has expired.

[0074] Optionally, if the device's routing table contains routing information for the destination address, but it has expired, a unicast route lookup (i.e., a fixed-point route lookup) is initiated: Details are as follows:

[0075] Step 1. The device should first send a unicast route query request for the destination address to the next-hop device in the expired information in the routing table. After receiving the request, if the next-hop device has the routing information in its own routing table, it will forward the query request; otherwise, it will discard the request.

[0076] Step 2. After the device sends a unicast route query request, it waits for a period of time. If a response is received, the local routing information is refreshed (the timeout of expired entries should be restored directly here) to complete the unicast route query.

[0077] Step 3. After the device sends a unicast route query request, it waits for a period of time. If no response is received, the unicast route query fails and is switched to a broadcast route query.

[0078] Step 4. If the device that initiated the unicast route query receives a query message it sent itself, it means that a routing loop has occurred. It needs to delete the expired routing table entry, silently discard the query message, and not continue to forward it.

[0079] Step 5. Forwarding unicast route queries must be limited by TTL (Time to Live) and cannot be forwarded indefinitely to avoid potential routing loop problems.

[0080] Step 400: If the query is successful or the information in the routing table has not expired, confirm the next-hop address;

[0081] As an optional implementation method, Figure 5 This is a flowchart illustrating the processing of a received routing query request by all devices according to optional embodiments of this application; including:

[0082] Step 402: The device itself receives a routing query request;

[0083] Step 404 is a routing query for this device; simply reply with confirmation.

[0084] Step 406: If the route query is not for this device and it is determined that there is destination address information in the routing table and the destination address information has not expired, then reply directly; if the route query is not for the device itself and it is determined that there is destination address information in the routing table but the destination address information has expired, then send a unicast route query request to the next hop of the entry.

[0085] Step 408: If it is a broadcast routing query request, forward the broadcast routing query request;

[0086] Additionally, it's important to note that responses to routing query requests should be sent directly to the device that initiated the request; broadcast responses are not allowed. Upon receiving a routing query response, each device should record the relevant information in its routing table, increment the hop count of the response message, and reply to the requester, repeating this process until the response returns to the original requesting device. The routing query response message should carry the hop count of the route. The device initiating the routing query may receive multiple responses; the initiator should select the appropriate next-hop address and record it in its local routing table (hop count, next-hop signal strength, etc.). In fact, the route that receives the response first should have high priority, at least indicating the shortest data travel time. Considering the unreliability of routing query messages, if a request fails, a timeout retry should be performed. The timeout duration depends on the implementation, but three retries are recommended.

[0087] Optionally, to avoid the misuse of routing information due to network changes before the cache expires, the cached routing table also provides an immediate invalidation mechanism. This allows other parts of the protocol to directly invalidate problematic routing entries once they detect errors in the routing information (e.g., a reliable transport layer detects that the destination address is unreachable), further improving the response speed to network changes in this technology.

[0088] In summary, the routing function of the wireless ad hoc network protocol stack is implemented based on a local routing table with high-speed caching capabilities and a series of transmission control messages. By employing caching technology, the routing information of a node is stored locally and expires after a predetermined period. Once expired, any subsequent data request to that node requires a new route check and updating of the routing information. This avoids the overhead of frequent network-wide routing information maintenance involving almost all devices, and also prevents the problem of local routing information failing to detect route changes and continuously using incorrect routing information. Furthermore, even after local routing information expires, it is not deleted but marked as invalid. When data needs to be sent to a destination marked as invalid, the routing refresh does not perform a normal network-wide broadcast route lookup; instead, it first performs a unicast route lookup based on the previously expired routing information. Generally, in most cases, previously invalid routing information should still be usable. A single unicast routing query can refresh the local routing information. Only when a genuine error occurs (e.g., an intermediate or destination node leaves, moves, or shuts down), will a network-wide broadcast routing query be performed. This further reduces the overhead of routing updates caused by cached routing invalidation. In other words, the mechanism for immediate invalidation of the cached routing table can further accelerate network change detection and response. By using the lower-overhead unicast routing query technique when refreshing the routing information in the cache, the overhead of network routing change detection is further reduced while maximizing the responsiveness to network changes. The immediate invalidation mechanism of the cached routing table further accelerates the response to network changes.

[0089] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0090] Figure 6 This is a structural block diagram of a routing table lookup device according to an embodiment of this application; as shown... Figure 6 As shown, it includes:

[0091] The determining module 52 is used to determine the first routing table corresponding to the first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for the first device to perform data transmission, and the effective field includes: effective result and effective time;

[0092] The identification module 54 is used to identify the target status of the effective field corresponding to the address combination when the first device is about to transmit data to the second device and the target next-hop address corresponding to the second device has a matching address combination in the first routing table.

[0093] The update module 56 is used to send a first route query request when the effective field is in an invalid state, and update the first route table according to the first response information corresponding to the first route query request.

[0094] Using the aforementioned apparatus, a first routing table corresponding to the first device is determined. The first routing table includes routing entries, each indicating the address combination and effective field for data transmission by the first device. The effective field includes the effective result and effective time. When the first device is about to transmit data to the second device, and a matching address combination exists in the first routing table for the target next-hop address of the second device, the target status of the effective field corresponding to the address combination is identified. If the effective field is in an invalid state, a first routing query request is sent, and the first routing table is updated based on the first response information corresponding to the first routing query request. This solves the problem of complex processes that hinder effective maintenance of routing tables in wireless ad hoc networks. The aforementioned routing table query method improves the efficiency of effective maintenance of routing tables in wireless ad hoc networks, avoids starting routing queries only during data transmission, reduces data transmission latency, and improves data transmission stability.

[0095] In an exemplary embodiment, the above apparatus further includes: a transmission module, configured to establish a data transmission relationship between the first device and the second device based on the address combination when the effective field is in a valid state, and adjust the effective time corresponding to the effective field in the valid state to the maximum timing duration.

[0096] In an exemplary embodiment, the update module is further configured to send a first routing query request to the next-hop address corresponding to the address combination; adjust the effective result corresponding to the effective field of the failure state from invalid characters to valid characters according to the first response information corresponding to the first routing query request; and adjust the effective time corresponding to the effective field of the failure state to the maximum timing duration.

[0097] In an exemplary embodiment, the update module further includes: a first addition module, configured to determine, when it is determined that the first device broadcasts a second route query request in the network where it is located, if the first route query request does not obtain corresponding first response information; determine a first addition route table entry based on the second response information corresponding to the second route query request; add the first addition route table entry to the first route table; set the effective result included in the effective field of the first addition route table entry to a valid character; and adjust the effective time included in the effective field of the first addition route table entry to the maximum timing duration.

[0098] In an exemplary embodiment, the apparatus further includes: a second adding module, configured to, when the first device is about to transmit data to the second device and the target next-hop address corresponding to the second device does not have a matching address combination in the first routing table, send a third routing query request to obtain the target next-hop address; determine the target next-hop address based on the third response information corresponding to the third routing query request, and determine a second adding routing table entry corresponding to the target next-hop address; add the second adding routing table entry to the first routing table, set the effective result included in the effective field of the second adding routing table entry to a valid character, and adjust the effective time included in the effective field of the second adding routing table entry to the maximum timing duration.

[0099] In one exemplary embodiment, the apparatus further includes: a survival module, configured to obtain a preset time-to-live (TTL) value, wherein the preset TTL value is used to indicate the number of times a routing query request is allowed to be forwarded by other devices, the number being less than or equal to the maximum hop count corresponding to the network currently occupied by the first device; and to add the preset TTL value to a routing query request, wherein the routing query request includes at least one of the following: a first routing query request; a second routing query request; and a third routing query request.

[0100] In one exemplary embodiment, the apparatus further includes a deletion module, configured to delete a routing table entry carrying the address combination from the first routing table when it is determined that the first device has received the second routing query request sent by itself.

[0101] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.

[0102] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0103] S1, determine the first routing table corresponding to the first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for the first device to perform data transmission, and the effective field includes: effective result and effective time;

[0104] S2, when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device does not have a matching address combination in the first routing table, a first routing query request for obtaining the target next-hop address is sent;

[0105] S3, when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, a second routing query request is sent to update the corresponding active field in the routing table entry including the address combination.

[0106] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0107] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0108] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0109] S1, determine the first routing table corresponding to the first device, wherein the first routing table includes: routing table entries, and the routing table entries are used to indicate the address combination and effective field for the first device to perform data transmission, and the effective field includes: effective result and effective time;

[0110] S2, when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device does not have a matching address combination in the first routing table, a first routing query request for obtaining the target next-hop address is sent;

[0111] S3, when the first device is about to transmit data to the second device, and the target next-hop address corresponding to the second device has a matching address combination in the first routing table, a second routing query request is sent to update the corresponding active field in the routing table entry including the address combination.

[0112] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0113] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0114] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0115] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of querying a routing table, characterized by, Applied to a first device side, comprising: determining a first routing table corresponding to the first device, wherein the first routing table comprises: a routing table item, and the routing table item is used to indicate an address combination and an effective field of the first device for data transmission, and the effective field comprises: an effective result and an effective time; in the case that the first device is to be transmitted to the second device, and the target next hop address corresponding to the second device exists in the first routing table, the target state of the address combination corresponding to the effective field is identified; in the case that the effective field is in the invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request; wherein, after sending the first routing query request, the method further comprises: in the case that the first routing query request corresponding to the first response information is not obtained, it is determined that the first device broadcasts and sends a second routing query request in the network; determining a first new routing table item according to the second response information corresponding to the second routing query request, wherein the first routing query request is a unicast query request, and the second routing query request is a broadcast query request; wherein, the first new routing table item is determined according to the second response information corresponding to the second routing query request, comprising: determining the hop count and the next hop signal strength corresponding to each of the plurality of other destination devices corresponding to the second response information to obtain a plurality of reference routing table items; determining the table item with the smallest hop count and / or the highest next hop signal strength in the plurality of reference routing table items as the first new routing table item.

2. The method of claim 1, wherein, after identifying the target state of the effective field corresponding to the address combination, the method further comprises: in the case that the effective field is in the valid state, the data transmission relationship between the first device and the second device is established based on the address combination, and the effective time corresponding to the effective field in the valid state is adjusted to the maximum timing length.

3. The method of claim 1, wherein, in the case that the effective field is in the invalid state, a first routing query request is sent, and the first routing table is updated according to the first response information corresponding to the first routing query request, comprising: sending a first routing query request to the next hop address corresponding to the address combination; adjusting the effective result corresponding to the invalid state of the effective field from invalid character to valid character according to the first response information corresponding to the first routing query request, and adjusting the effective time corresponding to the invalid state of the effective field to the maximum timing length.

4. The method of claim 1, wherein, after determining the table item with the smallest hop count and / or the highest next hop signal strength in the plurality of reference routing table items as the first new routing table item, the method further comprises: adding the first new routing table item to the first routing table, setting the effective result included in the effective field of the first new routing table item to valid character, and adjusting the effective time included in the effective field of the first new routing table item to the maximum timing length.

5. The method of claim 1, wherein, the method further comprises: In a case that the first device is to perform data transmission to a second device, and a target next-hop address corresponding to the second device does not exist in the first routing table, a third routing query request for obtaining the target next-hop address is sent; The target next-hop address is determined according to third response information corresponding to the third routing query request, and a second newly-added routing table item corresponding to the target next-hop address is determined; The second newly-added routing table item is added to the first routing table, an effective result included in an effective field of the second newly-added routing table item is set as an effective character, and an effective time included in the effective field of the second newly-added routing table item is adjusted to a maximum time length.

6. The method of claim 1 to 5, wherein, The method further includes: A preset time-to-live value is obtained, wherein the preset time-to-live value is used to indicate a number of times that a routing query request is allowed to be forwarded by other devices, and the number of times is less than or equal to a maximum hop count corresponding to a network in which the first device is currently located; The preset time-to-live value is added to a routing query request, wherein the routing query request includes at least one of the following: the first routing query request, a second routing query request, and the third routing query request.

7. The method of claim 1, wherein, In a case that the effective field is in an invalid state, after the first routing query request is sent, the method further includes: In a case that it is determined that the first device receives the first routing query request sent by itself, a routing table item carrying the address combination is deleted from the first routing table.

8. An apparatus for searching a routing table, characterized by The method includes: A determining module is configured to determine a first routing table corresponding to a first device, wherein the first routing table includes a routing table item, and the routing table item is used to indicate an address combination and an effective field for data transmission of the first device, the effective field includes an effective result and an effective time; An identifying module is configured to, in a case that the first device is to perform data transmission to a second device, and a target next-hop address corresponding to the second device exists in the first routing table, identify a target state of the effective field corresponding to the address combination; An updating module is configured to, in a case that the effective field is in an invalid state, send a first routing query request, and update the first routing table according to first response information corresponding to the first routing query request. The updating module is further configured to, after sending the first route query request, determine that the first device broadcasts a second route query request in the network if the first response information corresponding to the first route query request is not obtained; and determine a first new route table item according to second response information corresponding to the second route query request, wherein the first route query request is a unicast query request, and the second route query request is a broadcast query request; and wherein the determining the first new route table item according to the second response information corresponding to the second route query request comprises: determining a hop count and a next hop signal strength corresponding to each of a plurality of other destination devices corresponding to the second response information to obtain a plurality of reference route table items; and determining a table item with the smallest hop count and / or the highest next hop signal strength in the plurality of reference route table items as the first new route table item.

9. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7. 10.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 by using the computer program.

Citation Information

Patent Citations

  • Improved wireless ad hoc network multi-link routing method

    CN113347088A