Neighbor discovery method, apparatus, device and readable storage medium

CN119729442BActive Publication Date: 2026-10-23BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311285431.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-10-23
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

然而上述这种跨子网的邻居发现处理的特定IP地址由人为配置,地址配置方式不灵活且操作繁琐,管理成本较高,处理效率低下

Benefits of technology

[0046]本公开的实施例根据协议栈的邻居表在网络中的设备中自动配置和维持被代理设备表,并在协议栈收到邻居发现请求时,基于该被代理设备表实现不同网络侧或不同子网间的邻居发现代理应答,从而实现了网络中设备自动配置和处理邻居发现代理,减少了人为干预,满足了各种场景下邻居发现的实现需求,降低了维护成本,减少了邻居发现的延迟和资源消耗。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119729442B_ABST
    Figure CN119729442B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a neighbor discovery method, device, equipment and readable storage medium, a protocol stack-based neighbor table is used to automatically configure and maintain a proxy device table in a network device, and when the protocol stack receives a neighbor discovery request for a target device, a neighbor discovery proxy response is constructed based on the fact that the target device is in a communicable state if it is determined according to the proxy device table that the target device is proxied by the network device to respond to the neighbor discovery request, thereby realizing automatic proxy neighbor discovery in the network device, meeting the implementation requirements of neighbor discovery in various scenarios, reducing maintenance costs, and reducing the delay and resource consumption of neighbor discovery.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a neighbor discovery method, apparatus, device, and readable storage medium. Background Technology

[0002] Neighbor discovery is a network technology used to find and identify nearby devices or hosts in a wireless network. When a source node needs to communicate with a target node, it can send a neighbor discovery request to neighboring nodes or the default gateway on its local network segment to obtain the target node's MAC address. Typically, upon receiving a neighbor request message, a neighboring node or the default gateway determines whether its own IP address matches the requested target node's IP address. If they match, it sends a neighbor discovery response; otherwise, it ignores the neighbor discovery request.

[0003] When the source and target nodes are in different subnets or on different network sides, neighbor agent entries need to be manually configured on specific nodes in the network to allow neighbor discovery requests for specific IP addresses to be forwarded to a designated interface, so that the target node can receive the neighbor discovery request and respond. However, the specific IP address for this cross-subnet neighbor discovery processing is manually configured, which is inflexible, cumbersome, costly to manage, and inefficient. Summary of the Invention

[0004] In view of this, in order to solve the above-mentioned technical problems, this disclosure provides a neighbor discovery method, apparatus, device and storage medium.

[0005] According to a first aspect of the present disclosure, a neighbor discovery method is provided, applied to a network device deployed with an Internet Protocol stack, the method comprising:

[0006] In response to detecting a neighbor discovery request sent to the protocol stack by the source device, the system determines whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the target device; the proxied device table is determined based on the neighbor table of the protocol stack.

[0007] If the target device is included in the proxied device table, a neighbor query request is generated based on the information of the target device in the proxied device table and sent to the target device.

[0008] Upon receiving a neighbor query response from the target device, a neighbor discovery agent response is generated and sent to the source device.

[0009] In some embodiments, the method further includes:

[0010] In response to a neighbor table update event detected by the protocol stack, the proxied device table is updated based on the updated device information in the neighbor table; and / or,

[0011] The device information in the neighbor table of the protocol stack is periodically retrieved, and the proxied device table is updated based on the device information.

[0012] In some embodiments, updating the proxied device table includes:

[0013] The second network prefix of each neighboring device is determined based on the neighbor device address information recorded in the neighbor table;

[0014] The neighboring device whose second network prefix is ​​the same as the first network prefix of the network device is identified as the proxied device;

[0015] Update the proxied device table based on the information of the proxied device in the neighbor table.

[0016] In some embodiments, the method further includes:

[0017] In response to receiving a status notification message from a network-side device, a corresponding neighbor entry is established based on the device network information carried in the status notification message;

[0018] Update the neighbor table of the protocol stack based on the neighbor table entries.

[0019] In some embodiments, in response to obtaining a neighbor query response from the target device, the method further includes:

[0020] Detect whether the target device information carried in the neighbor query response matches the target device information in the neighbor table of the protocol stack;

[0021] If there is no match, the information of the target device in the neighbor table is updated according to the target device information carried in the neighbor query response.

[0022] In some embodiments, the method further includes:

[0023] If the target device is not included in the proxied device table, or if no response is received to the neighbor query, the neighbor discovery request will not be responded to.

[0024] In some embodiments, the Internet protocol stack includes the IPv6 protocol stack.

[0025] According to a second aspect of the present disclosure, a neighbor discovery device is provided, applied to a network device deployed with an Internet Protocol stack, the device comprising:

[0026] The target device determination module is used to respond to the detection of a neighbor discovery request sent by the source device to the protocol stack, and determine whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the network device; the proxied device table is determined based on the neighbor table of the protocol stack;

[0027] The neighbor query module, when the target device is included in the proxied device table, generates a neighbor query request based on the information of the target device in the proxied device table and sends it to the target device;

[0028] The neighbor discovery proxy response module is used to generate a neighbor discovery proxy response and send it to the source device when a neighbor query response is received from the target device.

[0029] In some embodiments, the apparatus may further include:

[0030] The first update module is used to respond to the neighbor table update event of the protocol stack and update the proxied device table according to the device information in the updated neighbor table.

[0031] In some embodiments, the apparatus may further include:

[0032] The second update module is used to periodically obtain device information from the neighbor table of the protocol stack and update the proxied device table based on the device information.

[0033] In some embodiments, when the first update module or the second update module is used to update the proxied device table, it includes:

[0034] Based on the neighbor device address information recorded in the neighbor table, determine the second network prefix of each neighbor device; identify the neighbor device whose second network prefix is ​​the same as the first network prefix of the network device as the proxied device; update the proxied device table based on the information of the proxied device in the neighbor table.

[0035] In some embodiments, the apparatus further includes:

[0036] In response to receiving a status notification message from a network-side device, a corresponding neighbor entry is established based on the device network information carried in the status notification message;

[0037] Update the neighbor table of the protocol stack based on the neighbor table entries.

[0038] In some embodiments, in response to receiving a neighbor query response from the target device, the apparatus further includes:

[0039] Detect whether the target device information carried in the neighbor query response matches the target device information in the neighbor table of the protocol stack;

[0040] If there is no match, the information of the target device in the neighbor table is updated according to the target device information carried in the neighbor query response.

[0041] In some embodiments, the apparatus further includes: not responding to the neighbor discovery request if the target device is not included in the proxied device table or if no response to the neighbor query is received.

[0042] In some embodiments, the Internet protocol stack described in any of the above device embodiments includes the IPv6 protocol stack.

[0043] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor and a memory; the memory being used to store a computer program; and the processor being used to invoke the computer program to implement the aforementioned neighbor discovery method.

[0044] According to a fourth aspect of the present disclosure, a readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the aforementioned neighbor discovery method.

[0045] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0046] The embodiments of this disclosure automatically configure and maintain the proxied device table in the devices in the network based on the neighbor table of the protocol stack, and when the protocol stack receives a neighbor discovery request, it implements neighbor discovery proxy responses between different network sides or different subnets based on the proxied device table. This realizes automatic configuration and processing of neighbor discovery proxy in the network, reduces human intervention, meets the implementation requirements of neighbor discovery in various scenarios, reduces maintenance costs, and reduces the latency and resource consumption of neighbor discovery.

[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Furthermore, no embodiment in this disclosure is required to achieve all the effects described above. Attached Figure Description

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

[0049] Figure 1This is a flowchart illustrating a neighbor discovery method according to an exemplary embodiment;

[0050] Figure 2 This is a flowchart illustrating a method for updating a proxied device table based on a neighbor table, according to an exemplary embodiment.

[0051] Figure 3 This is a flowchart illustrating a method for updating the neighbor table of a protocol stack according to an exemplary embodiment;

[0052] Figure 4 This is a flowchart illustrating another method for updating the neighbor table of a protocol stack, according to an exemplary embodiment.

[0053] Figure 5 This is an exemplary embodiment illustrating an interaction diagram of a neighbor discovery scenario between a WAN-side device and a LAN-side device under the Internet IPv6 protocol.

[0054] Figure 6 This is a schematic diagram illustrating the structure of a neighbor discovery device according to an exemplary embodiment;

[0055] Figure 7 This is a block diagram illustrating a terminal device according to an exemplary embodiment. Detailed Implementation

[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0057] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0058] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, a first classification threshold may also be referred to as a second classification threshold, and similarly, a second classification threshold may also be referred to as a first classification threshold. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."

[0059] like Figure 1 As shown, this disclosure provides a neighbor discovery method. This method can be applied to network devices in a network that need to handle neighbor agent information, including but not limited to routers, firewalls, wireless access points, and gateways, which have a protocol stack deployed in them for handling communication requests; it can also be applied to real-time operating systems (RTOS) and operating systems such as Linux and Windows that have a protocol stack installed. This protocol stack can be the Internet Protocol version 6 (IPv6) protocol stack.

[0060] Taking a router in a network as an example, this method can be applied to routers connecting clients and network servers, or to routers connecting two different subnets, to handle neighbor discovery requests and responses from different subnets. It can also be applied to neighbor discovery processing between routers, configuring a specific router to perform neighbor discovery responses on behalf of other routers on the link using the method disclosed herein. When it receives a neighbor discovery request from another router, this specific router is responsible for responding to that request. This neighbor discovery method can also be applied to other scenarios requiring neighbor discovery proxy functionality, and this disclosure does not limit its application to these scenarios.

[0061] Figure 1 This is a flowchart illustrating a neighbor discovery method according to an exemplary embodiment, such as... Figure 1 As shown, the method provided in this disclosure can be applied to network devices with an Internet Protocol stack deployed, and the method may include the following steps:

[0062] S101, in response to detecting a neighbor discovery request sent from the source device to the protocol stack, determine whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the target device; the proxied device table is determined based on the neighbor table of the protocol stack;

[0063] A protocol stack is a set of protocol layers required to implement network communication. The protocol stack deployed on the network device is responsible for receiving, parsing, and processing communication messages from other devices in the network. A neighbor discovery request is used to obtain network information about a target device, such as its MAC address and reachability. This neighbor discovery request carries information used to uniquely identify the target device, such as its IP address.

[0064] When a source device needs to communicate with another device in the network (which can be called a target device), it must first determine the target device's IP address, MAC address, and interface identifier. If the target device's information cannot be found in the source device's local cache, it can send a neighbor discovery request to other devices in the network, such as routers, to obtain the target device's information. In this embodiment, the neighbor discovery request sent by the source device cannot be directly responded to by the target device. For example, the target device may be in an unreachable state and unable to respond to the neighbor discovery request, or the target device and the source device may be located in different subnets, making direct cross-subnet neighbor discovery impossible.

[0065] The neighbor table in the protocol stack deployed on the network device is a data structure maintained and updated by the protocol stack. It is used to store information about neighboring devices that are directly connected to the network device, such as the IP address and physical address of the neighboring devices, to support communication and network operations between devices.

[0066] For example, the neighbor table in the router's protocol stack is used to record device information for each interface connected to the router. This device information may include IP address, MAC address, reachability status, and other information.

[0067] The proxied device table refers to a table or data structure used to record network information of various devices that can be responded to by the network device on behalf of the neighbor discovery request. It is automatically configured and maintained by the network device based on the neighbor table information in the protocol stack. Based on this proxied device table, the network device can determine the information of each device that needs to be responded to by the network device on behalf of the neighbor discovery request. The proxied device table may include at least the IP address of the proxied device, and may also include at least one of the following: the physical address of the proxied device, interface name, and lifespan. The interface refers to the exit point from which the network device sends communication messages to the proxied device, indicating the path through which the network device sends data packets from itself to the proxied device. The lifespan refers to the lifespan or expiration time of the entry corresponding to the proxied device, indicating the validity period of the entry corresponding to the proxied device in the proxied device table.

[0068] When the protocol stack of a network device receives a communication message and identifies it as a neighbor discovery request, it can match the target device information carried in the neighbor discovery request with the device information stored in the proxied device table in the network device to determine whether the target device is one of the proxied devices recorded in the proxied device table, thereby determining whether the network device should send a response message for the neighbor discovery request on behalf of the target device.

[0069] The source device and the target device can be two devices located on different network sides, such as a WAN-side device and a LAN-side device. Communication between the devices needs to be forwarded by a network device such as a router, in which case the network device can respond to neighbor discovery requests on behalf of the target device. Alternatively, the source device and the target device can be two devices located on different subnets, and the network device connecting the two devices can proxy the target device's response to neighbor discovery requests from the source device. It is understood that the method provided in this disclosure is not limited to the above-mentioned source device and target device scenario, but is also applicable to other scenarios where neighbor discovery requests cannot be directly implemented between the source device and the target device. It does not limit the direction of neighbor discovery proxies by the network device and supports bidirectional proxying between two devices; this disclosure does not impose any limitations on this.

[0070] S102, if the target device is included in the proxied device table, a neighbor query request is generated based on the information of the target device in the proxied device table and sent to the target device;

[0071] The neighbor discovery request carries at least identification information to uniquely identify the target device. When the identification information matches the same type of identification information of any device in the proxied device table, it is determined that the target device is included in the proxied devices.

[0072] For example, if the neighbor discovery request includes the IP address information of the target device, after the protocol stack receives the neighbor discovery request, it parses the IP address information carried in the request, matches the IP address information with the IP address information of each device recorded in the proxied device table, and determines the matched device as the target device when the match is successful.

[0073] The neighbor query request is sent by the network device to the target device to detect the status and reachability of the target device. The source IP address and source MAC address of the neighbor query request correspond to the network device, and the destination IP address and destination MAC address correspond to the target device. The neighbor query request can be constructed based on the information of the target device stored in the proxy device table.

[0074] If the target device is found in the network device's proxied device table, it means that the neighbor discovery request for querying the target device's information will be proxied by the network device. After receiving the neighbor discovery request, the network device will send a neighbor query request to the target device to determine whether the target device is in a reachable state and whether the network information has changed. Based on the target device's response, the network device will determine whether to proximate the response to the neighbor discovery request.

[0075] If the target device is not included in the proxy device table stored locally by the network device, it means that the target device is currently offline or the target device is not proxied by the network device to respond to neighbor discovery. In this case, the network device may not proximate the neighbor discovery request, that is, it may not send a response message about the neighbor discovery request.

[0076] S103, if a neighbor query response is received from the target device, a neighbor discovery agent response is generated and sent to the source device.

[0077] The neighbor query response is used to respond to a neighbor query request received by the target device and may include the target device's network information. When a network device receives this neighbor query response, it indicates that the target device is currently online and communicable. The network device can then construct a neighbor discovery agent response based on the information carried in the neighbor query response.

[0078] The Neighbor Discovery Proxy Response (NDPR) is used by a network device to respond to a neighbor discovery request received by the protocol stack on behalf of the target device. The source IP address of this NDPR is the target device's IP address, and the source MAC address is the MAC address of the interface on which the network device sent the NDPR to the source device. The destination IP address and destination MAC address correspond to the source device. Throughout the process of proxying the target device's response to the neighbor discovery request, the source IP address of the NDPR sent by the network device is always the IP address of the target device indicated in the neighbor discovery request.

[0079] If a network device does not receive a neighbor discovery request response from a target device, it indicates that the target device is currently unreachable, offline, or in another uncommunicable state and cannot communicate with the source device. The network device may choose not to provide a proxy response to the received neighbor discovery request, or it may send a proxy response indicating that the target device is in an uncommunicable state.

[0080] In this embodiment of the disclosure, the proxy device table is configured and maintained according to the neighbor table of the protocol stack, realizing the automatic and flexible configuration of the proxy device. When the protocol stack receives a neighbor discovery request for the target device, if it is determined from the proxy device table that the target device is responded to by the network device, a neighbor discovery proxy response is constructed based on the neighbor query response of the target device. This realizes the addition of a neighbor discovery proxy service in the network device, and the network device completes the neighbor discovery response process on behalf of the target device. This meets the implementation requirements of neighbor discovery in various scenarios, reduces maintenance costs, and reduces the latency and resource consumption of neighbor discovery.

[0081] In some embodiments, the neighbor discovery method described above may further include the step of updating the proxied device table, which can be implemented in the following manner:

[0082] In response to a neighbor table update event detected by the protocol stack, the proxied device table is updated based on the updated device information in the neighbor table; and / or,

[0083] The device information in the neighbor table of the protocol stack is periodically retrieved, and the proxied device table is updated based on the device information.

[0084] In other words, by registering a neighbor table update event, the protocol stack can be monitored for neighbor table updates. This event is triggered when the neighbor table changes, automatically updating the proxied device table when the neighbor table changes, thus improving processing efficiency and reducing power consumption. Neighbor table update events can include: adding a neighbor device, deleting a neighbor device, and changes in the status of a neighbor device.

[0085] Alternatively, device information in the neighbor table of the protocol stack can be periodically probed. For example, the neighbor table can be retrieved every 5 seconds. New proxied devices can be identified based on the neighbor table retrieved within the period, and the new proxied devices can be compared with the currently stored proxied device table to update the proxied device table, thus simplifying configuration and management.

[0086] In this embodiment of the disclosure, by listening to neighbor table update events in the protocol stack or periodically probing neighbor table information, the proxied device table can be updated in a timely manner, keeping the connection status synchronized with neighboring devices, reducing the need for human intervention, realizing automatic updating and maintenance of the proxied device table, keeping the proxied device table up-to-date, and responding promptly to changes in network topology.

[0087] In some embodiments, such as Figure 2 As shown, for the aforementioned method of monitoring neighbor table update events in the protocol stack or periodically probing neighbor table information, the proxied device table can be updated through the following steps:

[0088] S201, determine the second network prefix of each neighboring device based on the neighbor device address information recorded in the neighbor table;

[0089] A device's network prefix refers to the prefix portion of its IP address used within a network. It identifies the network segment the device belongs to and is typically composed of an IP address and a subnet mask. Currently, an IP address is a 32-bit or 128-bit number used to uniquely identify a device on a network. The subnet mask separates the IP address from the network prefix. A series of consecutive 1s at the beginning of the subnet mask represents the network prefix, and a series of consecutive 0s at the end represents the host identifier. Performing a bitwise AND operation between the device's subnet mask and its IP address yields the device's network prefix.

[0090] For example, given the IP address 192.168.0.1 and the subnet mask 255.255.255.0, a bitwise AND operation will result in the network prefix 192.168.0.0.

[0091] S202, determine the neighboring device whose second network prefix is ​​the same as the first network prefix of the network device as the proxied device;

[0092] The neighbor table of the network device's protocol stack records the neighbor devices that are directly connected to the network device. Among them, there are neighbor devices whose network prefix is ​​different from the first network prefix of the network device. These neighbor devices are not responded to by the network device for neighbor discovery.

[0093] A bitwise AND operation is performed on the IP address and subnet mask of the network device to obtain the first network prefix of the network device. The second network prefixes of each neighbor device recorded in the neighbor table are matched with the first network prefix. When the second network prefix of a neighbor device is the same as the first network prefix, it can be considered that the neighbor device is in the same network segment as the network device, and the neighbor device is identified as the proxied device.

[0094] S203, Update the proxied device table according to the information of the proxied device in the neighbor table.

[0095] When at least one proxied device is determined according to step S102, if the information of the proxied device is not stored in the proxied device table, a new table entry for the proxied device can be constructed according to the format requirements of the proxied device table based on the information of the proxied device recorded in the neighbor table, and the new table entry can be added to the proxied device table.

[0096] If the information of the proxied device is already stored in the proxied device table, the information of the proxied device recorded in the neighbor table can be matched with the information recorded in the proxied device table, and any inconsistencies in the proxied device table can be updated according to the neighbor table.

[0097] In this embodiment, based on the network prefixes of neighboring devices recorded in the neighbor table of the protocol stack, neighboring devices with the same network prefix as the network device are identified as proxied devices for which the network device responds to neighbor discovery requests. This allows the network device to maintain a table of proxied devices with the same network prefix as itself and to proximate neighbor discovery requests, reducing configuration items and management complexity, simplifying the configuration and management process of the neighbor discovery proxy, improving network response speed, and enabling automatic maintenance and updating of the proxied device table. This provides a more localized, high-performance, and security-enhanced automatic proxy service.

[0098] In some embodiments, the neighbor table of the protocol stack described in step S101 can be updated according to the neighbor discovery mechanism and communication messages, wherein the communication messages may include status announcement messages, such as... Figure 3 As shown, the neighbor discovery method may also include the following steps for determining the neighbor table:

[0099] S301, in response to receiving a status announcement message from a network-side device, establish a corresponding neighbor entry based on the device network information carried in the status announcement message;

[0100] This status notification message is used to report the network information of the network-side device to other devices in the network link, including but not limited to device identifier, reachability status, network topology information, IP address, interface identifier and link layer address. The network-side device can send this status notification message when it joins the network or when the network status of the device changes, such as address change or link status change.

[0101] When a network device's protocol stack receives a communication message and identifies it as a status announcement message, it can construct the neighbor table entry corresponding to the network-side device according to the neighbor table format, based on the source IP address and MAC address of the announcement message, as well as other device information carried in the announcement message.

[0102] S302, Update the neighbor table of the protocol stack according to the neighbor table entries.

[0103] The IP address in the neighbor table can be matched with the device IP address recorded in the neighbor table of the protocol stack. If the match fails, the neighbor table entry is added to the neighbor table. If the match is successful, the neighbor table entry can be used to replace the neighbor table entry corresponding to the matched IP address, or the information of the neighbor table entry can be compared with the information of the matched neighbor table entry to update the matched neighbor table entry.

[0104] In this embodiment of the disclosure, the neighbor table of the protocol stack is updated according to the received status announcement message to maintain the real-time nature of the neighbor information, so as to adjust its own network configuration and routing strategy and improve the reliability of the network.

[0105] In some embodiments, when a neighbor query response from the target device is obtained in step S103, the neighbor discovery method may further include updating the neighbor table information based on the content carried by the neighbor query response, such as... Figure 4 As shown, the following implementation methods can be included:

[0106] S401, Detect whether the target device information carried in the neighbor query response matches the target device information in the neighbor table of the protocol stack;

[0107] S402, if there is no match, then update the target device information in the neighbor table according to the target device information carried in the neighbor query response.

[0108] The device information carried in the neighbor query response from the target device indicates the latest network status of the target device. Updating the neighbor table based on the received neighbor query response can keep the neighbor table up-to-date.

[0109] When the target device is not included in the neighbor table of the protocol stack, a neighbor table entry can be created based on the target device information carried in the neighbor query response, and the neighbor table entry can be added to the neighbor table. If the target device information carried in the neighbor query response is inconsistent with the target device information recorded in the neighbor table, the information recorded in the neighbor table can be updated based on the information carried in the neighbor query response.

[0110] In this embodiment of the disclosure, the neighbor table information of the protocol stack is updated according to the received neighbor query response, which ensures the accuracy of the target device information recorded in the neighbor table in the protocol stack, helps to maintain the stability of the network topology, and improves the reliability and efficiency of data transmission.

[0111] To enable those skilled in the art to more clearly understand the neighbor discovery method provided in this disclosure, the following example illustrates the solution of this disclosure using a neighbor discovery scenario between a WAN-side device and a LAN-side device under the IPv6 protocol.

[0112] In this embodiment, the network device can be a router or wireless access point (AP) that connects the WAN-side device and the LAN-side device, and the network device deploys an IPv6 protocol stack.

[0113] This embodiment involves the interaction between WAN-side devices, LAN-side devices, and network devices, taking the WAN-side device as the source device and the target LAN-side device as the target device as an example. Figure 5 The interaction flow between WAN-side devices, LAN-side devices, and network devices is shown. This neighbor discovery method may include the following steps:

[0114] S501, the WAN-side device sends a neighbor request message to the protocol stack of the network device. The neighbor request message is used to obtain the device information of the target LAN-side device. The destination IP address encapsulated in the neighbor request message is the IPv6 address of the target LAN-side device, and the destination MAC address is the MAC address of the network device.

[0115] The neighbor discovery request on the WAN side generally refers to the Neighbor Solicitation (NS) message in the Neighbor Discovery Protocol (NDP) in IPv6 networks. This neighbor request message is used to query and obtain information such as the MAC address of the target LAN device.

[0116] It is important to note that when sending a neighbor request message, you must specify the correct target IPv6 address. Otherwise, the neighbor request message will not be processed correctly, which may lead to communication interruption or other communication failures.

[0117] S502, after the network device detects that the protocol stack has received a neighbor request message, it matches the destination IP address of the neighbor request message with the IPv6 addresses of each device in the locally stored proxied device table to determine whether the target LAN-side device exists in the proxied device table; the proxied device table is used to record LAN device information that the network device responds to the neighbor discovery request on behalf of the LAN-side device.

[0118] In other words, after receiving a neighbor request message, the network device's protocol stack does not use the standard IPv6 protocol stack to configure the neighbor request message processing method. Instead, the protocol stack determines whether the destination IP address of the neighbor request message matches the network device's IP address. If they match, the device requested by the neighbor request message is the network device, and the network device sends a response message based on its own device information. The source IP address and source MAC address of the response message correspond to the network device. If they do not match, the response is ignored. Instead, the method provided in this disclosure determines whether the target device requested by the neighbor request message is a device that is proxied by the network device for neighbor discovery, thereby realizing neighbor discovery proxy response.

[0119] S503, in response to the neighbor request message, if the destination IP address matches a device in the proxied device table, then based on the information of the successfully matched proxied device, construct a query request to be sent to the target LAN device, and send the query request to the target LAN device.

[0120] S504, when the target LAN device is online, after receiving the query request, the target LAN device generates a query response to the query request and sends it to the network device;

[0121] The query response is sent to the network device, therefore the destination IP address and destination MAC address of the query response correspond to the network device.

[0122] S505 After receiving the query response, the network device constructs a proxy response message based on the information of the target LAN device in the query response. The proxy response message is used by the network device to respond to the neighbor request message on behalf of the target LAN device.

[0123] The source IP address of the constructed proxy response message is the IPv6 address of the target LAN-side device, and the source MAC address is the WAN interface address on the network device that connects to the WAN-side device.

[0124] The proxy response message can be obtained by modifying and re-encapsulating the address of the received query response, or by reconstructing a new proxy response message based on the information carried in the query response.

[0125] If the target LAN device is offline or in a state of being unable to communicate, the network device will not receive a query response from the target LAN device, and the network device will not respond to the received neighbor request message.

[0126] In this embodiment, a neighbor proxy service function can be added to the network device. This neighbor proxy service function is used to interact with the protocol stack to implement the aforementioned neighbor discovery method. This allows the network device to handle the neighbor discovery request automatically according to the method specified by the standard IPv6 protocol stack after the protocol stack receives the request, instead of processing it according to the method specified by the standard IPv6 protocol stack. Alternatively, the aforementioned neighbor discovery method can be executed by the protocol stack of the network device. By improving the original standard IPv6 protocol stack deployed in the network device, the neighbor proxy service function can be integrated into the protocol stack, so that the protocol stack can automatically process the neighbor discovery request according to the method described in steps S502-S505 after receiving it.

[0127] The above embodiments describe a neighbor discovery proxy from a WAN-side device to a LAN-side device. Based on similar principles, a neighbor discovery proxy from a LAN-side device to a WAN-side device can also be implemented. This disclosure is not limited to the direction of the neighbor discovery proxy.

[0128] See Figure 5 As shown, the process of neighbor discovery through device interaction may also include steps such as updating the neighbor table and updating the proxied device table in the network device's protocol stack. These steps can be executed concurrently with the steps of the neighbor discovery method. The method may include:

[0129] S506: When the LAN-side device is a newly added device to the network or when the network information changes, the LAN-side device sends a status announcement message to the protocol stack of the network device.

[0130] S507: After receiving a status announcement message, the IPv6 protocol stack deployed on the network device updates the neighbor table maintained in the stack according to the status announcement message.

[0131] In S508, when a network device detects a neighbor table update event in the protocol stack, it determines the proxied device and updates the proxied device table based on the updated neighbor table and the principle of matching the network prefix of the device in the neighbor table with the network prefix of the network device.

[0132] In this embodiment, by binding the proxied device table to the neighbor table of the protocol stack, and relying on the update events of the neighbor table entries to trigger the automatic maintenance operation of the proxied device table, power consumption can be reduced and efficiency improved. Devices in the neighbor table with the same network prefix as the network device are used as devices for neighbor discovery by the network device, thereby realizing the automatic configuration and update of the proxied device table. Without adding additional neighbor discovery proxy devices, based on the proxied device table, neighbor discovery processing in different scenarios is realized by using intermediate devices connecting different network sides or different subnets. The automatic processing of the protocol stack through the intermediate device reduces human intervention, realizes automatic and flexible configuration and implementation of neighbor discovery, and reduces maintenance costs.

[0133] The steps described in the above embodiments are not necessarily in a specific order or at a specific time. In some embodiments, they can be executed in a different order or at a different time and still achieve the desired effect.

[0134] Corresponding to the aforementioned embodiments of the neighbor discovery method, Figure 6 This is a schematic diagram illustrating the structure of a neighbor discovery device according to an exemplary embodiment. This device is applied to network devices deployed with an Internet Protocol stack, such as... Figure 6 As shown, the device includes a target device determination module 601, a neighbor query module 602, and a neighbor discovery agent response module 603;

[0135] The target device determination module 601 is used to respond to the detection of a neighbor discovery request sent by the source device to the protocol stack, and determine whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the network device; the proxied device table is determined based on the neighbor table of the protocol stack;

[0136] The neighbor query module 602, when the target device is included in the proxied device table, generates a neighbor query request based on the information of the target device in the proxied device table and sends it to the target device;

[0137] The neighbor discovery proxy response module 603 is used to generate a neighbor discovery proxy response and send it to the source device when a neighbor query response is obtained from the target device.

[0138] In some embodiments, the apparatus may further include:

[0139] The first update module is used to respond to the neighbor table update event of the protocol stack and update the proxied device table according to the device information in the updated neighbor table.

[0140] In some embodiments, the apparatus may further include:

[0141] The second update module is used to periodically obtain device information from the neighbor table of the protocol stack and update the proxied device table based on the device information.

[0142] In some embodiments, when the first update module or the second update module is used to update the proxied device table, it includes:

[0143] Based on the neighbor device address information recorded in the neighbor table, determine the second network prefix of each neighbor device; identify the neighbor device whose second network prefix is ​​the same as the first network prefix of the network device as the proxied device; update the proxied device table based on the information of the proxied device in the neighbor table.

[0144] In some embodiments, the apparatus further includes:

[0145] In response to receiving a status notification message from a network-side device, a corresponding neighbor entry is established based on the device network information carried in the status notification message;

[0146] Update the neighbor table of the protocol stack based on the neighbor table entries.

[0147] In some embodiments, in response to receiving a neighbor query response from the target device, the apparatus further includes:

[0148] Detect whether the target device information carried in the neighbor query response matches the target device information in the neighbor table of the protocol stack;

[0149] If there is no match, the information of the target device in the neighbor table is updated according to the target device information carried in the neighbor query response.

[0150] In some embodiments, the apparatus further includes: not responding to the neighbor discovery request if the target device is not included in the proxied device table or if no response to the neighbor query is received.

[0151] In some embodiments, the Internet protocol stack described in any of the above device embodiments includes the IPv6 protocol stack.

[0152] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0153] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0154] This disclosure also provides a terminal device. The terminal device includes a memory and a processor. The memory stores processor-executable instructions, and the processor is configured to execute the executable instructions in the memory to implement the neighbor discovery steps provided above. In this disclosure, the terminal device can be a network device such as a router, firewall, or wireless access point that needs to handle neighbor discovery requests from different subnets or different network sides.

[0155] Figure 7 This is a block diagram of a terminal device provided according to an exemplary embodiment. For example... Figure 7 As shown, the terminal device 700 may include one or more of the following components: processing component 702, memory 704, power supply component 706, multimedia component 708, audio component 710, input / output (I / O) interface 712, sensor component 714, communication component 716, and image acquisition component.

[0156] Processing component 702 typically handles the overall operation of terminal device 700, including operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 702 may include one or more processors 720 to execute instructions. Furthermore, processing component 702 may include one or more units to facilitate interaction between processing component 702 and other components. For example, processing component 702 may include a multimedia unit to facilitate interaction between multimedia component 708 and processing component 702.

[0157] Memory 704 is configured to store various types of data to support operation on terminal device 700. Examples of this data include instructions for any application or method operating on terminal device 700, contact data, phonebook data, messages, pictures, videos, etc. Memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0158] Power supply component 706 provides power to various components of terminal device 700. Power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to terminal device 700.

[0159] Multimedia component 708 includes a screen that provides an output interface between terminal device 700 and target object. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the target object. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of a touch or swipe action but also the duration and pressure associated with the touch or swipe operation.

[0160] Audio component 710 is configured to output and / or input audio signals. For example, audio component 710 includes a microphone (MIC) configured to receive external audio signals when terminal device 700 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 704 or transmitted via communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.

[0161] I / O interface 712 provides an interface between processing component 702 and peripheral interface unit, which may be a keyboard, click wheel, button, etc.

[0162] Sensor assembly 714 includes one or more sensors for providing status assessments of various aspects of terminal device 700. For example, sensor assembly 714 can detect the on / off state of terminal device 700, the relative positioning of components such as the display screen and keypad of terminal device 700, changes in the position of terminal device 700 or a component, the presence or absence of contact between a target object and terminal device 700, the orientation or acceleration / deceleration of terminal device 700, and temperature changes of terminal device 700. Furthermore, sensor assembly 714 also includes a light sensor disposed below the OLED display screen.

[0163] Communication component 716 is configured to facilitate wired or wireless communication between terminal device 700 and other devices. Terminal device 700 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 716 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 716 also includes a near-field communication (NFC) unit to facilitate short-range communication. For example, the NFC unit may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0164] In an exemplary embodiment, the terminal device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0165] In one exemplary embodiment, this disclosure also provides a readable storage medium storing executable instructions. These executable instructions can be executed by a processor of a terminal device to implement the steps of the neighbor discovery method provided above. The readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.

[0166] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the foregoing claims.

[0167] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A neighbor discovery method, characterized in that, Applied to network devices deployed with an Internet Protocol stack, the method includes: In response to detecting a neighbor discovery request sent to the protocol stack by the source device, the system determines whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the target device; the proxied device table is determined based on the neighbor table of the protocol stack. If the target device is included in the proxied device table, a neighbor query request is generated based on the information of the target device in the proxied device table and sent to the target device. If a neighbor query response is received from the target device and the neighbor query response indicates that the target device is reachable, a neighbor discovery agent response is generated and sent to the source device. In response to a neighbor table update event detected by the protocol stack, the proxied device table is updated based on the updated device information in the neighbor table; and / or, The device information in the neighbor table of the protocol stack is periodically obtained, and the proxied device table is updated according to the device information. The updating of the proxied device table includes: Based on the neighbor device address information recorded in the neighbor table of the protocol stack, determine the second network prefix of each neighbor device; The neighboring device whose second network prefix is ​​the same as the first network prefix of the network device is identified as the proxied device; Update the proxied device table based on the information of the proxied device in the neighbor table.

2. The method according to claim 1, characterized in that, The method further includes: In response to receiving a status notification message from a network-side device, a corresponding neighbor entry is established based on the device network information carried in the status notification message; Update the neighbor table of the protocol stack based on the neighbor table entries.

3. The method according to claim 1, characterized in that, In response to receiving a neighbor query response from the target device, the method further includes: Detect whether the target device information carried in the neighbor query response matches the target device information in the neighbor table of the protocol stack; If there is no match, the information of the target device in the neighbor table is updated according to the target device information carried in the neighbor query response.

4. The method according to claim 1, characterized in that, The method further includes: If the target device is not included in the proxied device table, or if no response is received to the neighbor query, the neighbor discovery request will not be responded to.

5. The method according to any one of claims 1-4, characterized in that, The Internet protocol stack includes the IPv6 protocol stack.

6. A neighbor detection device, characterized in that, The apparatus, applicable to network devices deployed with an Internet Protocol stack, comprises: The target device determination module is used to respond to the detection of a neighbor discovery request sent by the source device to the protocol stack, and determine whether the target device is included in the proxied device table based on the target device information carried in the neighbor discovery request; wherein, the proxied device table is used to record device information for which the network device responds to the neighbor discovery request on behalf of the network device; the proxied device table is determined based on the neighbor table of the protocol stack; The neighbor query module, when the target device is included in the proxied device table, generates a neighbor query request based on the information of the target device in the proxied device table and sends it to the target device; The neighbor discovery proxy response module is used to generate a neighbor discovery proxy response and send it to the source device when a neighbor query response is obtained from the target device and the neighbor query response indicates that the target device is reachable. The first update module is configured to, in response to a neighbor table update event detected by the protocol stack, update the proxied device table according to the updated device information in the neighbor table; and / or, The second update module is used to periodically obtain device information from the neighbor table of the protocol stack and update the proxied device table according to the device information. When the first update module or the second update module is used to update the proxied device table, it includes: Based on the neighbor device address information recorded in the neighbor table, determine the second network prefix of each neighbor device; identify the neighbor device whose second network prefix is ​​the same as the first network prefix of the network device as the proxied device; update the proxied device table based on the information of the proxied device in the neighbor table.

7. An electronic device, characterized in that, include: Processor, memory; The memory is used to store computer programs; The processor is configured to invoke the computer program to implement the neighbor discovery method as described in any one of claims 1-5.

8. A readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the neighbor discovery method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • ND proxy configuration system, method and device, communication equipment and storage medium

    CN116634016A