A method for identifying the IP address of a P2P device and related equipment

By obtaining the similarity score between the MAC address and the virtual address of the P2P device, the problem that GO could not identify the IP address of other devices under the group was solved, and IP address identification was realized.

CN115801726BActive Publication Date: 2025-10-31SHENZHEN KONKA ELECTRONIC TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211438947.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2025-10-31
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

In P2P mode, when a device acts as the Group Owner (GO), it cannot directly identify the IP addresses of other devices in the group.

Method used

By obtaining the similarity score between the MAC address and the P2P virtual address of the P2P device, the IP address corresponding to the P2P virtual address is determined using the similarity between the MAC address and the P2P virtual address.

Benefits of technology

This enables the device, when acting as the P2P Group Owner, to identify the IP addresses of other devices within the group.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115801726B_ABST
    Figure CN115801726B_ABST
Patent Text Reader

Abstract

This invention discloses a method and related equipment for identifying IP addresses of P2P devices. The method includes: obtaining the MAC address, P2P virtual address, and IP address corresponding to each reachable P2P device; obtaining the similarity score between each MAC address and each P2P virtual address; and determining the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address. This invention enables a device acting as a P2P GO to identify the IP addresses of other devices within a group.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer network technology, and in particular to a method for identifying the IP address of a P2P device and related equipment. Background Technology

[0002] In existing technologies, under P2P mode, if the device itself is a GC (Groupclient), then the P2P gateway address is the IP address of the peer P2P device. However, when the device itself is a GO (Group Owner), it cannot directly identify the IP addresses of other devices under the P2P Group.

[0003] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention

[0004] This invention provides a method and related equipment for identifying the IP address of a P2P device, aiming to solve the problem that GO cannot identify the IP address of other devices in the prior art.

[0005] A first aspect of the present invention provides a method for identifying the IP address of a P2P device, comprising:

[0006] Obtain the MAC address, P2P virtual address, and IP address corresponding to each reachable P2P device;

[0007] Obtain the similarity score between each MAC address and each P2P virtual address;

[0008] The IP address corresponding to each P2P virtual address is determined based on the similarity score corresponding to each MAC address.

[0009] The aforementioned P2P device IP address identification method includes obtaining the MAC address and corresponding IP address of each reachable P2P device, comprising:

[0010] Use the arp command to obtain the MAC address of each reachable P2P device on the P2P network interface and the corresponding IP address of each MAC address.

[0011] The P2P device IP address identification method, wherein obtaining the similarity score between each MAC address and each P2P virtual address includes:

[0012] The following steps are used to determine the similarity score between the target MAC address and the target P2P virtual address:

[0013] Obtain the target MAC address and the target P2P virtual address in various base bit groups, each base bit group including at least two consecutive base bits;

[0014] The nth base digit of the target MAC address is matched with the nth base digit of the target P2P virtual address, and the similarity score between the target MAC address and the target P2P virtual address is obtained based on the matching result, where n is a positive integer.

[0015] The P2P device IP address identification method, wherein the step of matching the nth base digit of the target MAC address with the nth base digit of the target P2P virtual address, and obtaining the similarity score between the target MAC address and the target P2P virtual address based on the matching result, includes:

[0016] When the nth base digit of the target MAC address is the same as the nth base digit of the target P2P virtual address, the similarity score between the target MAC address and the target P2P virtual address is increased by a first preset step value.

[0017] The P2P device IP address identification method, wherein determining the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address includes:

[0018] Obtain the similarity scores between the target P2P virtual address and each MAC address;

[0019] When the maximum value of the similarity score between the target P2P virtual address and the MAC address is greater than a preset threshold, the MAC address corresponding to the maximum value is selected as the selected MAC address, and the IP address corresponding to the target P2P virtual address is determined based on the IP address corresponding to the selected MAC address.

[0020] The P2P device IP address identification method, wherein determining the IP address corresponding to the target P2P virtual address based on the IP address corresponding to the selected MAC address includes:

[0021] When only one of the selected MAC addresses exists, the IP address corresponding to the selected MAC address is used as the IP address corresponding to the target P2P virtual address;

[0022] When there are multiple selected MAC addresses, obtain the consecutive matching bit length between each selected MAC address and the target P2P virtual address;

[0023] The IP address corresponding to the selected MAC address with the largest consecutive matching bits is used as the IP address corresponding to the target P2P virtual address.

[0024] The P2P device IP address identification method, wherein obtaining the consecutive matching bits between each selected MAC address and the target P2P virtual address includes:

[0025] The consecutive matching bits between the target P2P virtual address and the selected MAC address are obtained in the following way:

[0026] When the nth base bit group of the selected MAC address is the same as the nth base bit group of the target P2P virtual address, and the (n+1)th base bit group of the selected MAC address is the same as the (n+1)th base bit group of the target P2P virtual address, the number of consecutive matching bits between the selected MAC address and the target P2P virtual address is increased by a second preset step value.

[0027] A second aspect of the present invention provides a P2P device IP address identification device, comprising:

[0028] The address acquisition module is used to acquire the MAC address, P2P virtual address and IP address corresponding to each reachable P2P device.

[0029] A similarity determination module is used to obtain the similarity score between each MAC address and each P2P virtual address;

[0030] The address mapping module is used to determine the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address.

[0031] A third aspect of the present invention provides a terminal, comprising: a processor, a storage medium communicatively connected to the processor, the storage medium being adapted to store multiple signals, and the processor being adapted to invoke the signals in the storage medium to perform the steps of implementing the P2P device IP address identification method described in any of the preceding claims.

[0032] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer storage medium stores one or more programs that can be executed by one or more processors to implement the steps of the P2P device IP address identification method described in any of the preceding claims.

[0033] Beneficial effects: Compared with the prior art, the present invention provides a method and related equipment for identifying IP addresses of P2P devices. In the method for identifying IP addresses of P2P devices provided by the present invention, the IP address corresponding to each P2P virtual address is determined according to the similarity score between the MAC address and the P2P virtual address. This can enable the device to identify the IP addresses of other devices in the group when it is acting as a P2PGO. Attached Figure Description

[0034] Figure 1 A flowchart illustrating an embodiment of the P2P device IP address identification method provided by the present invention;

[0035] Figure 2 A logic block diagram of an embodiment of the P2P device IP address identification method provided by the present invention;

[0036] Figure 3 This is a schematic diagram of the structure of an embodiment of the P2P device IP address identification device provided by the present invention;

[0037] Figure 4 A schematic diagram of the structure of an embodiment of the terminal provided by the present invention. Detailed Implementation

[0038] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0039] Example 1

[0040] The P2P device IP address identification method provided in this embodiment can be executed by a terminal, which can be, but is not limited to, a computer or mobile device. When the terminal acts as the GO (Group Owner) in the P2P, the method provided in this embodiment can obtain the IP addresses of other devices within the group, such as... Figure 1 As shown, the P2P device IP address identification method provided in this embodiment includes the following steps:

[0041] S100: Obtain the MAC address, P2P virtual address, and IP address corresponding to each reachable P2P device.

[0042] The Android system provides a method for a terminal acting as a GO (Go) within a P2P group to obtain the P2P virtual addresses of other devices within the group. During P2P protocol interaction, each P2P device needs to inform the peer of its own P2P virtual address, but it cannot use this address to look up the corresponding IP address. In other words, the GO cannot obtain the IP addresses corresponding to the P2P addresses of other devices within the group. Specifically, obtaining the MAC address, P2P virtual address, and corresponding IP address of each reachable P2P device includes:

[0043] Use the arp command to obtain the MAC address of each reachable P2P device on the P2P network interface and the corresponding IP address of each MAC address.

[0044] Since P2P virtual addresses and P2P device MAC addresses are not directly correlated, direct matching is not possible. However, the inventors discovered that P2P virtual addresses are generally generated from actual physical addresses (MAC addresses) and have a certain degree of similarity to the MAC addresses of P2P devices. Therefore, a method for reverse IP address lookup using the similarity between P2P virtual addresses and MAC addresses is proposed. Specifically, the method provided in this embodiment further includes the following steps:

[0045] S200: Obtain the similarity score between each MAC address and each P2P virtual address.

[0046] The process of obtaining the similarity score between each MAC address and each P2P virtual address includes:

[0047] The following steps are used to determine the similarity score between the target MAC address and the target P2P virtual address:

[0048] Obtain the target MAC address and the target P2P virtual address in various base bit groups, each base bit group including at least two consecutive base bits;

[0049] The nth base digit of the target MAC address is matched with the nth base digit of the target P2P virtual address, and the similarity score between the target MAC address and the target P2P virtual address is obtained based on the matching result, where n is a positive integer.

[0050] Matching the nth base digit of the target MAC address with the nth base digit of the target P2P virtual address, and obtaining the similarity score between the target MAC address and the target P2P virtual address based on the matching result, including:

[0051] When the nth base digit of the target MAC address is the same as the nth base digit of the target P2P virtual address, the similarity score between the target MAC address and the target P2P virtual address is increased by a first preset step value.

[0052] The first preset step value can be 1, such as Figure 2 As shown, a MAC address has 12 hexadecimal bits in the form of FF:FF:FF:FF:FF. If the target MAC address and the target P2P virtual address have two hexadecimal bits that match exactly, one point is added. The final score is the similarity score of the target MAC address.

[0053] S300. Determine the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address.

[0054] The step of determining the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address includes:

[0055] Obtain the similarity scores between the target P2P virtual address and each MAC address;

[0056] When the maximum value of the similarity score between the target P2P virtual address and the MAC address is greater than a preset threshold, the MAC address corresponding to the maximum value is selected as the selected MAC address, and the IP address corresponding to the target P2P virtual address is determined based on the IP address corresponding to the selected MAC address.

[0057] The step of determining the IP address corresponding to the target P2P virtual address based on the IP address corresponding to the selected MAC address includes:

[0058] When only one of the selected MAC addresses exists, the IP address corresponding to the selected MAC address is used as the IP address corresponding to the target P2P virtual address;

[0059] When there are multiple selected MAC addresses, obtain the consecutive matching bit length between each selected MAC address and the target P2P virtual address;

[0060] The IP address corresponding to the selected MAC address with the largest consecutive matching bits is used as the IP address corresponding to the target P2P virtual address.

[0061] like Figure 3 As shown, when the first step value is 1, the preset threshold can be set to 2. It is understood that these values ​​are merely examples and do not limit the specific protection scope; those skilled in the art can flexibly choose other values. After the terminal determines the similarity score between the target P2P virtual address and each MAC address, if the maximum value is greater than the preset threshold and there is only one maximum value, the MAC address corresponding to the maximum value is marked as the selected MAC address, and then the IP address corresponding to the target P2P virtual address is determined based on the selected MAC address. If the maximum value is greater than the preset threshold and there is more than one maximum value, the consecutive matching bits between each selected MAC address and the target P2P virtual address are obtained. Specifically, the consecutive matching bits between the target P2P virtual address and the selected MAC address are obtained in the following way:

[0062] When the nth base bit group of the selected MAC address is the same as the nth base bit group of the target P2P virtual address, and the (n+1)th base bit group of the selected MAC address is the same as the (n+1)th base bit group of the target P2P virtual address, the number of consecutive matching bits between the selected MAC address and the target P2P virtual address is increased by a second preset step value.

[0063] A consecutive matching bit is the number of times multiple consecutive 2x16 base bits are completely matched. Taking the second preset step value of 1 as an example, if the P2P address is 0A:BB:1C:AB:AC:1E and the target MAC is 0A:BB:2C:AB:BC:BE, then the three groups of 16 base bits 1 (0A), 2 (BB), and 4 (AB) are completely matched, and bits 1 and 2 are consecutive matches. Therefore, the consecutive matching bit is 2 bits, and the number of consecutive matching bits is 2.

[0064] If the maximum value is not greater than the preset threshold, the terminal determines that the match has failed and continues to match the IP addresses corresponding to other P2P virtual addresses. If all other P2P virtual addresses match their corresponding IP addresses, the remaining IP addresses are used as the IP addresses corresponding to the target P2P virtual address. If there are more than one P2P virtual address that does not match its corresponding IP address, the terminal discards the current data and re-acquires the MAC addresses, P2P virtual addresses, and IP addresses corresponding to each reachable P2P device.

[0065] In summary, this embodiment provides a method for identifying the IP address of a P2P device. It determines the IP address corresponding to each P2P virtual address based on the similarity score between the MAC address and the P2P virtual address, which can enable a device to identify the IP address of other devices in the group when it is acting as a P2PGO.

[0066] It should be understood that although the steps in the flowcharts shown in the accompanying drawings are displayed sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of the steps in this invention, and these steps can be executed in other orders. Moreover, at least a portion of the steps in this invention may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0067] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program in conjunction with related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0068] Example 2

[0069] Based on the above embodiments, the present invention also provides a P2P device IP address identification device, the functional module of which is shown in the figure below. Figure 3 As shown, the P2P device IP address identification device includes:

[0070] The address acquisition module is used to acquire the MAC address, P2P virtual address and IP address corresponding to each reachable P2P device, as described in Embodiment 1.

[0071] A similarity determination module is used to obtain the similarity score between each MAC address and each P2P virtual address, as specifically described in Embodiment 1;

[0072] The address mapping module is used to determine the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address, as described in Embodiment 1.

[0073] Example 3

[0074] Based on the above embodiments, the present invention also provides a terminal, the principle block diagram of which can be as follows: Figure 4As shown. The terminal includes a processor 10 and a memory 20, the memory 20 storing a computer program. When the processor 10 executes the computer program, it can perform at least the following steps:

[0075] Obtain the MAC address, P2P virtual address, and IP address corresponding to each reachable P2P device;

[0076] Obtain the similarity score between each MAC address and each P2P virtual address;

[0077] The IP address corresponding to each P2P virtual address is determined based on the similarity score corresponding to each MAC address.

[0078] The aforementioned P2P device IP address identification method includes obtaining the MAC address and corresponding IP address of each reachable P2P device, comprising:

[0079] Use the arp command to obtain the MAC address of each reachable P2P device on the P2P network interface and the corresponding IP address of each MAC address.

[0080] The step of obtaining the similarity score between each MAC address and each P2P virtual address includes:

[0081] The following steps are used to determine the similarity score between the target MAC address and the target P2P virtual address:

[0082] Obtain the target MAC address and the target P2P virtual address in various base bit groups, each base bit group including at least two consecutive base bits;

[0083] The nth base digit of the target MAC address is matched with the nth base digit of the target P2P virtual address, and the similarity score between the target MAC address and the target P2P virtual address is obtained based on the matching result, where n is a positive integer.

[0084] The step of matching the nth base digit of the target MAC address with the nth base digit of the target P2P virtual address, and obtaining the similarity score between the target MAC address and the target P2P virtual address based on the matching result, includes:

[0085] When the nth base digit of the target MAC address is the same as the nth base digit of the target P2P virtual address, the similarity score between the target MAC address and the target P2P virtual address is increased by a first preset step value.

[0086] The step of determining the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address includes:

[0087] Obtain the similarity scores between the target P2P virtual address and each MAC address;

[0088] When the maximum value of the similarity score between the target P2P virtual address and the MAC address is greater than a preset threshold, the MAC address corresponding to the maximum value is selected as the selected MAC address, and the IP address corresponding to the target P2P virtual address is determined based on the IP address corresponding to the selected MAC address.

[0089] The step of determining the IP address corresponding to the target P2P virtual address based on the IP address corresponding to the selected MAC address includes:

[0090] When only one of the selected MAC addresses exists, the IP address corresponding to the selected MAC address is used as the IP address corresponding to the target P2P virtual address;

[0091] When there are multiple selected MAC addresses, obtain the consecutive matching bit length between each selected MAC address and the target P2P virtual address;

[0092] The IP address corresponding to the selected MAC address with the largest consecutive matching bits is used as the IP address corresponding to the target P2P virtual address.

[0093] The step of obtaining the consecutive matching bits between each selected MAC address and the target P2P virtual address includes:

[0094] The consecutive matching bits between the target P2P virtual address and the selected MAC address are obtained in the following way:

[0095] When the nth base bit group of the selected MAC address is the same as the nth base bit group of the target P2P virtual address, and the (n+1)th base bit group of the selected MAC address is the same as the (n+1)th base bit group of the target P2P virtual address, the number of consecutive matching bits between the selected MAC address and the target P2P virtual address is increased by a second preset step value.

[0096] Example 4

[0097] The present invention also provides a computer-readable storage medium having stored thereon one or more programs that can be executed by one or more processors to implement the steps of the P2P device IP address identification method described in the above embodiments.

[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying the IP address of a P2P device, characterized in that, include: Obtain the MAC address, P2P virtual address, and IP address corresponding to each reachable P2P device; Obtain the similarity score between each MAC address and each P2P virtual address; The IP address corresponding to each P2P virtual address is determined based on the similarity score corresponding to each MAC address. The process of obtaining the similarity score between each MAC address and each P2P virtual address includes: The following steps are used to determine the similarity score between the target MAC address and the target P2P virtual address: Obtain the target MAC address and the target P2P virtual address in various base bit groups, each base bit group including at least two consecutive base bits; The nth base digit of the target MAC address is matched with the nth base digit of the target P2P virtual address, and the similarity score between the target MAC address and the target P2P virtual address is obtained based on the matching result, where n is a positive integer.

2. The P2P device IP address identification method according to claim 1, characterized in that, Obtain the MAC address and corresponding IP address of each reachable P2P device, including: Use the arp command to obtain the MAC address of each reachable P2P device on the P2P network interface and the corresponding IP address of each MAC address.

3. The P2P device IP address identification method according to claim 1, characterized in that, The step of matching the nth base digit of the target MAC address with the nth base digit of the target P2P virtual address, and obtaining the similarity score between the target MAC address and the target P2P virtual address based on the matching result, includes: When the nth base digit of the target MAC address is the same as the nth base digit of the target P2P virtual address, the similarity score between the target MAC address and the target P2P virtual address is increased by a first preset step value.

4. The P2P device IP address identification method according to claim 1, characterized in that, The step of determining the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address includes: Obtain the similarity scores between the target P2P virtual address and each MAC address; When the maximum value of the similarity scores between the target P2P virtual address and each MAC address is greater than a preset threshold, the MAC address corresponding to the maximum value is selected as the selected MAC address, and the IP address corresponding to the target P2P virtual address is determined based on the IP address corresponding to the selected MAC address.

5. The P2P device IP address identification method according to claim 4, characterized in that, The step of determining the IP address corresponding to the target P2P virtual address based on the IP address corresponding to the selected MAC address includes: When only one of the selected MAC addresses exists, the IP address corresponding to the selected MAC address is used as the IP address corresponding to the target P2P virtual address; When there are multiple selected MAC addresses, obtain the consecutive matching bit length between each selected MAC address and the target P2P virtual address; The IP address corresponding to the selected MAC address with the largest consecutive matching bits is used as the IP address corresponding to the target P2P virtual address.

6. The P2P device IP address identification method according to claim 5, characterized in that, The step of obtaining the consecutive matching bits between each of the selected MAC addresses and the target P2P virtual address includes: The consecutive matching bits between the target P2P virtual address and the selected MAC address are obtained in the following way: When the nth base bit group of the selected MAC address is the same as the nth base bit group of the target P2P virtual address, and the (n+1)th base bit group of the selected MAC address is the same as the (n+1)th base bit group of the target P2P virtual address, the number of consecutive matching bits between the selected MAC address and the target P2P virtual address is increased by a second preset step value.

7. A P2P device IP address identification device, characterized in that, The P2P device IP address identification device is applied to the P2P device IP address identification method according to any one of claims 1-6, and the device comprises: The address acquisition module is used to acquire the MAC address, P2P virtual address and IP address corresponding to each reachable P2P device. A similarity determination module is used to obtain the similarity score between each MAC address and each P2P virtual address; The address mapping module is used to determine the IP address corresponding to each P2P virtual address based on the similarity score corresponding to each MAC address.

8. A terminal, characterized in that, The terminal includes: a processor and a storage medium communicatively connected to the processor. The storage medium is adapted to store multiple signals, and the processor is adapted to call the signals in the storage medium to perform the steps of implementing the P2P device IP address identification method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the P2P device IP address identification method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method, device and equipment for acquiring IP addresses of group users

    CN112689029A

  • Extension of address resolution protocol (ARP) for internet protocol (IP) virtual networks

    US20020138628A1

  • Method for allocating address of network node

    WO2021049806A1