CN115865800A - IPv6 address obtaining method and device and storage medium - Google Patents

IPv6 address obtaining method and device and storage medium Download PDF

Info

Publication number
CN115865800A
CN115865800A CN202211486151.3A CN202211486151A CN115865800A CN 115865800 A CN115865800 A CN 115865800A CN 202211486151 A CN202211486151 A CN 202211486151A CN 115865800 A CN115865800 A CN 115865800A
Authority
CN
China
Prior art keywords
address
type
message data
correct
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211486151.3A
Other languages
Chinese (zh)
Inventor
胡阳
王元
李飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Skyworth Digital Technology Co Ltd
Original Assignee
Shenzhen Skyworth Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Skyworth Digital Technology Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN202211486151.3A priority Critical patent/CN115865800A/en
Publication of CN115865800A publication Critical patent/CN115865800A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method, a device and a storage medium for acquiring an IPv6 address, wherein the method for acquiring the IPv6 address comprises the following steps: acquiring message data, and determining whether the type of the message data is a duplicate address detection message; if the type of the message data is determined to be a duplicate address detection message, detecting whether a target address of the message data carries a polymerizable global unicast address; and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the sixth version Internet protocol address. Therefore, the invention can acquire the unicast IPv6 address at any time no matter in any state such as a state, a non-state or manual configuration, and the like, thereby improving the convenience of acquiring the IPv6 address.

Description

IPv6 address obtaining method and device and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for acquiring an IPv6 address, a higher level device, and a computer storage medium.
Background
With the development of science and technology, an IP Address (Internet Protocol Address) refers to an Internet Protocol Address, the IP Address is a uniform Address format provided by an IP Protocol, and allocates a logical Address to each network and each host on the Internet to shield the difference of physical addresses, IPv6 is a next-generation IP Protocol designed by the Internet Engineering Task Force (IETF) to replace IPv4, and the number of the addresses can be called to code an Address for each sand all over the world.
At present, there are two ways for a terminal device (such as a mobile phone and a computer) to dynamically acquire a unicast IPv6 address, which are stateful management configuration and stateless automatic configuration respectively, and when the stateful management configuration is performed, the terminal device receives an IPv6 address carried in a DHCPv6 message of a Router and configures the received IPv6 address to an internet access card, and when the stateless automatic configuration is performed, the terminal device automatically generates the IPv6 address according to prefix information included in a Router Advertisement RA (Router Advertisement) message of a gateway (i.e., the Router) and a suffix information (EUI 64 or random generation) and configures the IPv6 address to the internet access card.
However, if the gateway wants to acquire the IPv6 address of the terminal device connected below the gateway, if the stateless IPv6 address automatic configuration method is used, the IPv6 address of the terminal device cannot be directly counted, because the terminal device is the IPv6 address formed by autonomously combining a prefix and a suffix of a certain rule, and in conclusion, the method for acquiring the IPv6 address in the prior art is very inconvenient.
Disclosure of Invention
The invention mainly aims to provide an IPv6 address acquisition method, a superior device and a computer storage medium, aiming at realizing that a unicast IPv6 address can be acquired at any time no matter in any state such as a state, a non-state or manual configuration, and the like, thereby improving the convenience of acquiring the IPv6 address.
In order to achieve the above object, the present invention provides a method for acquiring an IPv6 address, where the method for acquiring an IPv6 address includes the following steps:
acquiring message data, and determining whether the type of the message data is a duplicate address detection message;
if the message data is confirmed to be a duplicate address detection message, detecting whether a target address carries a polymerizable global unicast address;
and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the sixth version Internet protocol address.
Optionally, the step of determining whether the type of the packet data is a duplicate address detection packet includes;
detecting whether the version type of the message data is correct or not;
if the version type is detected to be correct, detecting whether the next header protocol type of the message data is correct;
if the next header protocol type is detected to be correct, detecting whether the source address of the message data is correct or not;
if the source address is detected to be correct, detecting whether the use type of the message data is correct or not;
and if the use type is detected to be correct, determining that the type of the message data is a repeated address detection message.
Optionally, the step of detecting whether the version type of the packet data is correct includes:
acquiring the version type of the message data, and detecting whether the version type is a sixth version of internet protocol;
and if the version type is detected to be the sixth version of Internet protocol, confirming that the version type is correct.
Optionally, the step of detecting whether the next header protocol type of the packet data is correct includes:
acquiring a next header protocol type of the message data, and detecting whether the next header protocol type is a target basic protocol;
and if the next header protocol type is detected to be the target basic protocol, confirming that the next header protocol type is correct.
Optionally, the step of detecting whether the source address of the packet data is correct includes:
acquiring a source address of the message data, and detecting whether the source address is a loopback address;
and if the source address is detected to be the loopback address, confirming that the source address is correct.
Optionally, the step of detecting whether the usage type of the packet data is correct includes:
acquiring the use type of the message data, and detecting whether the use type is a neighbor solicitation protocol or not;
and if the usage type is detected to be the neighbor solicitation protocol, confirming that the usage type is correct.
Optionally, the step of detecting whether the destination address of the packet data carries a polymerizable global unicast address includes:
detecting whether the target address of the message data is in a preset polymerizable global unicast address range or not;
and if the target address is detected to be in the range of the polymerizable global unicast address, confirming that the target address carries the polymerizable global unicast address.
Optionally, the step of obtaining the message data includes:
confirming whether a message signal exists or not through a socket;
and if the message signal is confirmed, reading the message signal to acquire message data.
In addition, to achieve the above object, the present invention further provides an IPv6 address obtaining apparatus, where the IPv6 address obtaining apparatus includes:
the acquisition module is used for acquiring message data and determining whether the type of the message data is a duplicate address detection message;
the detection module is used for detecting whether a target address of the message data carries a polymerizable global unicast address or not if the message data is confirmed to be a duplicate address detection message;
and the confirming module is used for confirming that the target address is the sixth version internet protocol address when the target address is detected to carry the polymerizable global unicast address.
In addition, to achieve the above object, the present invention further provides a computer storage medium having stored thereon an acquisition program of an IPv6 address, the acquisition program of the IPv6 address implementing the steps of the acquisition method of an IPv6 address as described above when executed by a processor.
The invention provides an IPv6 address acquisition method, a device, terminal equipment and a computer readable storage medium, wherein the IPv6 address acquisition method comprises the following steps: acquiring message data, and determining whether the type of the message data is a duplicate address detection message; if the type of the message data is determined to be a duplicate address detection message, detecting whether a target address of the message data carries a polymerizable global unicast address; and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the IPv6 address.
The technical scheme of the invention is applied to a gateway, and the method comprises the steps of determining whether the type of the message data is a duplicate address detection message or not by acquiring the message data, further determining whether a target address of the message data carries a polymerizable global unicast address or not if the type of the message data is the duplicate address detection message, and determining that the target address is a sixth version Internet protocol address if the target address carries the polymerizable global unicast address.
Compared with the traditional IPv6 address acquisition method, the method provided by the invention can confirm whether the type of the message data is a duplicate address detection message or not by acquiring the message data, and detect whether the target address of the message data carries a polymerizable global unicast address or not, and confirm that the target address is a sixth version Internet protocol address when the message data is confirmed to be a duplicate address detection message and the target address of the message data carries the polymerizable global unicast address.
Drawings
Fig. 1 is a schematic structural diagram of the hardware operation of a terminal device according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating an embodiment of an IPv6 address obtaining method according to the present invention;
fig. 3 is a flowchart illustrating an IPv6 address obtaining method according to another embodiment of the present invention;
FIG. 4 is a schematic structural relationship diagram of an IPv6 address acquisition system of the present invention;
the objects, features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a hardware operating environment related to a terminal device according to an embodiment of the present invention.
It should be noted that, the terminal device in the embodiment of the present invention may be a device for acquiring an IPv6 address, and the terminal device may specifically be a mobile terminal, a data storage control terminal, a PC, a portable computer, or a like.
As shown in fig. 1, the terminal device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a non-volatile memory (e.g., flash memory), a high-speed RAM memory, or a non-volatile memory (e.g., a disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal device configuration shown in fig. 1 is not intended to be limiting of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an acquisition program of an IPv6 address. The operating system is a program for managing and controlling hardware and software resources of the sample terminal equipment, and supports an acquisition program of an IPv6 address and the running of other software or programs.
In the terminal apparatus shown in fig. 1, the user interface 1003 is mainly used for data communication with each terminal; the network interface 1004 is mainly used for connecting a background server and performing data communication with the background server; and the processor 1001 may be configured to call the acquisition procedure of the IPv6 address stored in the memory 1005, and perform the following operations:
acquiring message data, and determining whether the type of the message data is a duplicate address detection message;
if the type of the message data is determined to be a duplicate address detection message, detecting whether a target address of the message data carries a polymerizable global unicast address;
and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the sixth edition Internet address.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
detecting whether the version type of the message data is correct or not;
if the version type is detected to be correct, detecting whether the next header protocol type of the message data is correct;
if the next header protocol type is detected to be correct, detecting whether the source address of the message data is correct;
if the source address is detected to be correct, whether the use type of the message data is correct is detected;
and if the use type is detected to be correct, determining that the type of the message data is a repeated address detection message.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
acquiring the version type of the message data, and detecting whether the version type is IPv6 or not;
and if the version type is detected to be the sixth version of Internet protocol, confirming that the version type is correct.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
acquiring a next header protocol type of the message data, and detecting whether the next header protocol type is a target basic protocol;
and if the next header protocol type is detected to be the target basic protocol, confirming that the next header protocol type is correct.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
acquiring a source address of the message data, and detecting whether the source address is a loopback address;
and if the source address is detected to be the loopback address, confirming that the source address is correct.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
acquiring the use type of the message data, and detecting whether the use type is a neighbor solicitation protocol or not;
and if the usage type is detected to be the neighbor solicitation protocol, confirming that the usage type is correct.
Alternatively, the processor 1001 may be configured to invoke an acquiring program of the IPv6 address stored in the memory 1005, and further perform the following operations:
detecting whether the target address of the message data is in a preset polymerizable global unicast address range or not;
and if the target address is detected to be in the range of the polymerizable global unicast address, confirming that the target address carries the polymerizable global unicast address.
Alternatively, the processor 1001 may be configured to call the acquisition program of the IPv6 address stored in the memory 1005, and further perform the following operations:
confirming whether a message signal exists or not through a socket;
and if the message signal is confirmed, reading the message signal to acquire message data.
Based on the above-mentioned superior device, embodiments of the IPv6 address acquisition method of the present invention are presented.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for acquiring an IPv6 address according to a first embodiment of the present invention. In a first embodiment of the method for acquiring an IPv6 address of the present invention, the method for acquiring an IPv6 address of the present invention includes:
step S10: acquiring message data, and determining whether the type of the message data is a duplicate address detection message;
in this embodiment, when the higher-level device acquires the IPv6 address of the terminal device, the message data is acquired, and then it is determined whether the type of the message data is a duplicate address detection message.
It should be noted that the upper-level device is a gateway (router), the terminal device is a device such as a mobile phone or a computer that can access the internet, the Duplicate Address Detection (DAD) message is a special NS (neighbor solicitation protocol) message, the sixth version of internet protocol is IPv6, and the sixth version of internet protocol Address is an IPv6 Address.
The duplicate address detection mechanism is performed before an interface uses a certain IPv6 unicast address, and mainly aims to detect whether other nodes use the address or not, after a terminal network card obtains the unicast IPv6 address, the terminal network card is marked as a test address, then an NS (neighbor solicitation protocol) message is sent, an option field of the NS carries the unicast address, a destination address is a multicast address of a requested node corresponding to the address, if no NA (neighbor advertisement protocol) message for replying the NS message exists in a link within a period of time or no NS message with the same structure is received, the test address to be used is considered to be not occupied by other host nodes in a local link range, the invalid address is converted into an effective address, the address configuration is effective, if the NA message for replying the NS message or the NS message with the same structure is received, the duplicate address detection fails, the test address is converted into an illegal address and cannot be used by the node, namely, the IPv6 address to be configured and used is carried when the NS is sent, therefore, after the message data in the link is obtained, whether the type of the message data of the duplicate address detection message is determined, and whether the IPv6 message is carried, thereby detecting whether the IPv6 address or not.
Optionally, in some possible embodiments, the step of "acquiring message data" in step S10 may include the following steps:
step S101: confirming whether a message signal exists or not through a socket;
illustratively, as shown in the flow of fig. 3, in this embodiment, the upper level device establishes an original socket, where the socket is a socket (PF _ PACKET, socket _ RAW, htons (ETH _ P _ ALL)), and is configured to receive ALL data PACKETs on the network card, and after using the socket, a text descriptor may be obtained, and then it is monitored whether data arrives in the file descriptor, where the process is select, and finally, message data sent from the file descriptor is received, and the process is recvfrom.
Step S102: and if the message signal is confirmed, reading the message signal to acquire message data.
In this embodiment, after the gateway determines whether there is a message signal through the socket, if it is determined that there is the message signal, the gateway reads the message signal to obtain the message data.
It should be noted that, as shown in the flowchart of fig. 3, while represents a loop, after the gateway acquires the IPv6 address, or after the gateway fails to acquire the IPv6 address, the IPv6 address of the next message information is acquired in a loop, and if a message signal is confirmed, the message signal is read to acquire message data, where the process is process data.
Step S20: if the message data is confirmed to be a duplicate address detection message, detecting whether a target address of the message data carries a polymerizable global unicast address;
in this embodiment, the gateway obtains the message data, determines whether the type of the message data is a duplicate address detection message, and further detects whether the destination address of the message data carries a polymerizable global unicast address if it is determined that the type of the message data is a duplicate address detection message.
It should be noted that the aggregatable global unicast address is a common IPV6 address that can be used on the public network, and the message data may be addresses of other types, so that the gateway acquires the message data, determines that the message data carries the IPV6 address by determining that the type of the message data is a duplicate address detection message, and then further determines that the destination address of the message data carries a aggregatable global unicast address, thereby determining that the destination address is an IPV6 address.
It should be noted that, as shown in the flowchart of another embodiment shown in fig. 3, the target address is a target address, the polymerizable global unicast address is a GUA, and whether the target address of the message data carries the GUA is detected.
Step S30: and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the IPv6 address.
In this embodiment, if the gateway determines that the packet data is a duplicate address detection packet, it further determines whether the destination address of the packet data carries a polymerizable global unicast address, and when it is detected that the destination address carries the polymerizable global unicast address, it determines that the destination address is an IPv6 address.
Exemplarily, if the confirmation target address 3333 00000000.
It should be noted that, after the gateway determines that the destination address is an IPv6 address, the gateway stores a source MAC (media access control) and the destination address in the DAD message data together, so that the user can query the GUA address of the device through the MAC when querying the IPv6 address later.
Thus, in this embodiment, when the IPv6 address of the terminal device is obtained by the upper device, the message data is obtained, and then it is determined whether the type of the message data is a duplicate address detection message; then, the gateway acquires the message data, confirms whether the type of the message data is a duplicate address detection message, and further detects whether the target address of the message data carries a polymerizable global unicast address if the type of the message data is the duplicate address detection message; and finally, if the gateway confirms that the message data is a duplicate address detection message, further confirming whether a target address of the message data carries a polymerizable global unicast address, and when detecting that the target address carries the polymerizable global unicast address, confirming that the target address is an IPv6 address.
The method and the device can confirm whether the type of the message data is the repeated address detection message or not by acquiring the message data, and detect whether the target address of the message data carries the polymerizable global unicast address or not, and confirm that the target address is the IPv6 address when the type of the message data is the repeated address detection message and the target address of the message data carries the polymerizable global unicast address, namely, the unicast IPv6 address can be acquired at any time no matter in any state, such as a state, a non-state or manual configuration, and the like, thereby improving the convenience for acquiring the IPv6 address to a great extent.
Optionally, based on the above first embodiment of the method for acquiring an IPv6 address of the present invention, a second embodiment of the method for acquiring an IPv6 address of the present invention is provided.
In this embodiment, the step of determining whether the type of the packet data is the duplicate address detection packet in step S10 may further include the following steps:
step S101: detecting whether the version type of the message data is correct or not;
in this embodiment, when acquiring the IPv6 address of the terminal device, the gateway acquires the message data, and detects whether the version type of the message data is correct.
It should be noted that, in this embodiment, as shown in the flowchart in fig. 3, the version type is ether _ type, it should be understood that the message data may be IPv4 (fourth version internet protocol address), and therefore, whether the version of the message data is IPv6 is determined by whether ether _ type is correct or not,
optionally, in some possible embodiments, the step S101 includes the following steps:
step S1011: acquiring the version type of the message data, and detecting whether the version type is a sixth version of internet protocol;
in this embodiment, when acquiring the IPv6 address of the terminal device, the gateway acquires the message data, further acquires the version type of the message data, and detects whether the version type of the message data is the sixth version of internet protocol.
It should be noted that, in this embodiment, the gateway performs feature extraction on the message data, and determines whether the version type of the message data is the sixth version internet protocol.
Step S1012: and if the version type is detected to be IPv6, confirming that the version type is correct.
In this embodiment, after the gateway obtains the version type of the message data and detects whether the version type of the message data is the sixth internet protocol, if it is detected that the version type is the sixth internet protocol, it is determined that the version type of the message data is correct.
It should be noted that, if the gateway determines that the protocol version type of the message data is incorrect, that is, if the gateway determines that the version type of the protocol message data is not IPv6, the gateway acquires the IPv6 address of the next message data.
Step S102: if the version type is detected to be correct, detecting whether the next header protocol type of the message data is correct;
in this embodiment, after detecting whether the version type of the message data is correct, if the version type of the message data is correct, the gateway detects whether the next header protocol type of the message data is correct.
It should be noted that, in this embodiment, as shown in the flowchart of another embodiment shown in fig. 3, the next header Protocol type is a next header, it should be understood that whether the type of the Message data is ipcmv6 is determined by whether the next header is correct, icmpv6 (Internet Control Message Protocol Version 6, next header Protocol type in sixth edition) is one of the basic protocols of IPv6, icmpv6 is placed behind IPv6, the target basic Protocol is ICPMv6, whether the next header is ICPMv6 is determined, whether the Message data is likely to be an NS Message is determined, and if the next header is ICPMv6, the Message data is likely to be an NS Message, specifically, the Protocol number of ICPMv6 in IPv6 is 58, and whether the type of the next header is correct is also determined by determining whether the Protocol number of IPv6 is 58.
Optionally, in some possible embodiments, the step of detecting whether the next header protocol type of the message data is correct in step S102 includes the following steps:
step S1021: acquiring a next header protocol type of the message data, and detecting whether the next header protocol type is a target basic protocol;
in this embodiment, after detecting whether the version type of the message data is correct, if the version type of the message data is correct, the gateway acquires a next header protocol type of the message data, and detects whether the next header protocol type is a target base protocol;
step S1022: and if the next header protocol type is detected to be the target basic protocol, confirming that the next header protocol type is correct.
In this embodiment, the gateway obtains the next header protocol type of the message data, and detects whether the next header protocol type is the target base protocol, and if it is detected that the next header protocol type is the target base protocol, it detects that the next header protocol type of the message data is correct.
It should be noted that, if the gateway determines that the next header protocol type of the message data is incorrect, that is, if the gateway determines that the next header protocol type of the message data is not ICMPv6, the gateway acquires the IPv6 address of the next message data.
Step S103: if the next header protocol type is detected to be correct, detecting whether the source address of the message data is correct;
in this embodiment, after detecting whether the next header protocol type of the message data is correct, the gateway detects whether the source address of the message data is correct if the next header protocol type is correct.
It should be noted that, in this embodiment, as shown in the flowchart of another embodiment shown in fig. 3, a Source Address is Source Address (saddr), and it is determined that the message data may be an NS message by determining that saddr is correct.
Optionally, in some possible embodiments, the step of "detecting whether the source address of the message data is correct" in step S103 includes the following steps:
step S1031: acquiring a source address of the message data, and detecting whether the source address is a loopback address;
in this embodiment, after detecting whether the next header protocol type of the message data is correct, the gateway acquires the source address of the message data, and checks whether the source address is a loopback address.
It should be noted that, in this embodiment, the loopback address is (: 1), and after the gateway determines whether the next header protocol type of the message data is correct, the gateway extracts the source address of the message data and determines whether the source address is the loopback address (: 1).
Step S1032: and if the source address is detected to be the loopback address, confirming that the source address is correct.
In this embodiment, after extracting the source address of the message data and detecting whether the source address is a loopback address, if it is detected that the source address is a loopback address, the source address of the message data is determined to be correct.
Step S104: if the source address is detected to be correct, whether the use type of the message data is correct is detected;
in this embodiment, after detecting whether the source address of the message data is correct, the gateway detects whether the usage type of the message data is correct if the source address is correct.
It should be noted that the type used is icmp _ type, and the message data is confirmed to be NS message by confirming that icmp _ type is correct.
Optionally, in some possible embodiments, the step of detecting whether the usage type of the message data is correct in step S104 includes the following steps:
step S1041: acquiring the use type of the message data, and detecting whether the use type is a neighbor solicitation protocol or not;
in this embodiment, after detecting whether the source address of the message data is correct, the gateway acquires the usage type of the message data if it is detected that the source address is correct, and detects whether the usage type is a neighbor solicitation protocol.
It should be noted that, as shown in the flowchart of another embodiment shown in fig. 3, the neighbor solicitation protocol is NS, and after detecting whether the source address of the message data is correct, if it is detected that the source address is correct, it obtains whether the usage type of the message data is NS, where it is to be noted that, the ICMPv6 message (that is, NS message) whose usage type of the duplicate address detection message is 135 is detected, and by detecting whether the usage type of the message data is 135, it is determined whether the usage type of the message data is NS.
Step S1042: and if the usage type is detected to be the neighbor solicitation protocol, confirming that the usage type is correct.
In this embodiment, after the gateway obtains the usage type of the packet data and detects whether the usage type is the neighbor solicitation protocol, if it is detected that the usage type is the neighbor solicitation protocol, it is determined that the usage type is correct.
For example, in this embodiment, after the gateway extracts whether the usage type of the message data is NS, if it is determined that the usage type is 135, it is determined that the usage type of the message data is correct.
Step S105: and if the use type is detected to be correct, determining that the type of the message data is a repeated address detection message.
In this embodiment, after detecting whether the usage type of the message data is correct, the gateway determines that the type of the message data is a duplicate address detection message if it is detected that the usage type is correct.
Optionally, in some possible embodiments, the step of "confirming whether the destination address carries a polymerizable global unicast address" in step S20 includes the following steps:
step S201: confirming whether the target address is in a preset polymerizable global unicast address range or not;
in this embodiment, the gateway obtains the packet data, determines whether the type of the packet data is a duplicate address detection packet, and determines whether the destination address is within a preset polymerizable global unicast address range if the type of the packet data is the duplicate address detection packet.
Exemplarily, in this embodiment, the preset polymerizable global unicast address range is 2000 0000.
Step S202: and if the target address is confirmed to be in the range of the polymerizable global unicast address, confirming that the target address carries the polymerizable global unicast address.
In this embodiment, after the gateway determines whether the destination address is within the preset global unicast address aggregation range, if the destination address is within the global unicast address aggregation range, the destination address is determined to carry the global unicast address aggregation.
Exemplarily, in the present embodiment, if the confirmation target address 3333.
In this embodiment, after obtaining the version type, the next header protocol type, the source address and the use type of the message data, it is further determined whether the version type, the next header protocol type, the source address and the use type of the message data are correct, if it is determined that the version type, the next header protocol type, the source address and the use type are correct, it is determined that the type of the message data is a duplicate address detection message, then it is determined whether a target address of the message data is within a preset polymerizable global unicast address range, and if so, it is determined that the target address carries a polymerizable global unicast address, and it is determined that the target address is IPv6, so that the unicast IPv6 address can be obtained at any time no matter in any state, no state, manual configuration, or other states, thereby greatly improving convenience in obtaining the IPv6 address.
In addition, referring to fig. 4, an embodiment of the present invention further provides an apparatus for acquiring an IPv6 address, where the apparatus for acquiring an IPv6 address includes:
an obtaining module 10, configured to obtain message data, and determine whether a type of the message data is a duplicate address detection message;
a detecting module 20, configured to detect whether a destination address of the packet data carries a polymerizable global unicast address if it is determined that the packet data is a duplicate address detection packet;
a confirming module 30, configured to, when it is detected that the target address carries a polymerizable global unicast address, confirm that the target address is a sixth version internet protocol address.
Optionally, the obtaining module 10 includes:
a version type detection unit, configured to detect whether a version type of the packet data is correct;
a next header protocol type detecting unit, configured to detect whether a next header protocol type of the packet data is correct if the version type is detected to be correct;
a source address detection unit, configured to detect whether a source address of the packet data is correct if the next header protocol type is correct;
a usage type detection unit, configured to detect whether the usage type of the packet data is correct if the source address is detected to be correct;
and the duplicate address detection message detection unit is used for confirming that the type of the message data is the duplicate address detection message if the use type is detected to be correct.
Optionally, the version type detecting unit includes:
the first confirming subunit is used for acquiring the version type of the message data and detecting whether the version type is a sixth version of internet protocol;
and the second confirming subunit is used for confirming that the version type is correct if the version type is detected to be the sixth version of internet protocol.
Optionally, the next header protocol type detecting unit includes:
a third determining subunit, configured to obtain a next header protocol type of the packet data, and detect whether the next header protocol type is a target base protocol;
a fourth confirming subunit, configured to detect that the next header protocol type is correct if it is detected that the next header protocol type is the target base protocol.
Optionally, the source address detection unit includes:
a fifth confirming subunit, configured to obtain a source address of the packet data, and detect whether the source address is a loopback address;
a sixth confirming subunit, configured to confirm that the source address is correct if it is detected that the source address is the loopback address.
Optionally, a type detection unit is used, comprising:
a seventh determining subunit, configured to obtain a usage type of the packet data, and detect whether the usage type is a neighbor solicitation protocol packet;
and an eighth determining subunit, configured to determine that the usage type is correct if it is detected that the usage type is the neighbor solicitation protocol packet.
Optionally, the detection module 20 includes:
a destination address detection unit, configured to detect whether a destination address of the packet data is within a preset polymerizable global unicast address range;
a first confirming unit, configured to confirm that the destination address carries the global unicast address aggregation if it is detected that the destination address is within the global unicast address aggregation range.
Optionally, the obtaining module 10 includes:
a second confirmation unit, configured to confirm whether there is a message signal through the socket;
and the reading unit is used for reading the message signal to acquire message data if the message signal is confirmed.
In addition, an embodiment of the present invention further provides a computer storage medium applied to a computer, where the computer storage medium may be a non-volatile computer-readable computer storage medium, the computer storage medium stores an IPv6 address acquisition program, and the IPv6 address acquisition program, when executed by a processor, implements the steps of the IPv6 address acquisition method described above.
The steps implemented when the program for acquiring an IPv6 address running on the processor is executed may refer to each embodiment of the method for acquiring an IPv6 address of the present invention, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, where the computer software product is stored in a computer storage medium (such as a Flash memory, a ROM/RAM, a magnetic disk, an optical disk), and includes several instructions for enabling a controller, which is used for controlling the storage medium to perform data reading and writing operations, in a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.), to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An IPv6 address obtaining method is characterized by comprising the following steps:
acquiring message data, and determining whether the type of the message data is a duplicate address detection message;
if the type of the message data is determined to be a duplicate address detection message, detecting whether a target address of the message data carries a polymerizable global unicast address;
and when the target address is detected to carry the polymerizable global unicast address, confirming that the target address is the sixth version Internet protocol address.
2. The IPv6 address obtaining method according to claim 1, wherein the step of determining whether the type of the packet data is a duplicate address detection packet includes;
detecting whether the version type of the message data is correct or not;
if the version type is detected to be correct, detecting whether the next header protocol type of the message data is correct;
if the next header protocol type is detected to be correct, detecting whether the source address of the message data is correct;
if the source address is detected to be correct, whether the use type of the message data is correct is detected;
and if the use type is detected to be correct, determining that the type of the message data is a repeated address detection message.
3. The IPv6 address obtaining method according to claim 2, wherein the step of detecting whether the version type of the packet data is correct includes:
acquiring the version type of the message data, and detecting whether the version type is a sixth version of internet protocol;
and if the version type is detected to be the sixth version of Internet protocol, confirming that the version type is correct.
4. The IPv6 address obtaining method according to claim 3, wherein the step of detecting whether the next header protocol type of the packet data is correct includes:
acquiring a next header protocol type of the message data, and detecting whether the next header protocol type is a target basic protocol;
and if the next header protocol type is detected to be the target basic protocol, confirming that the next header protocol type is correct.
5. The IPv6 address obtaining method according to claim 4, wherein the step of detecting whether the source address of the packet data is correct includes:
acquiring a source address of the message data, and detecting whether the source address is a loopback address;
and if the source address is detected to be the loopback address, confirming that the source address is correct.
6. The IPv6 address obtaining method according to claim 5, wherein the step of detecting whether the usage type of the packet data is correct includes:
acquiring the use type of the message data, and detecting whether the use type is a neighbor solicitation protocol or not;
and if the usage type is detected to be the neighbor solicitation protocol, confirming that the usage type is correct.
7. The IPv6 address obtaining method according to claim 1, wherein the step of detecting whether the destination address of the packet data carries a polymerizable global unicast address includes:
detecting whether the target address of the message data is in a preset polymerizable global unicast address range or not;
and if the target address is detected to be in the polymerizable global unicast address range, confirming that the target address carries the polymerizable global unicast address.
8. The IPv6 address obtaining method according to claim 1, wherein the step of obtaining packet data includes:
confirming whether a message signal exists or not through a socket;
and if the message signal is confirmed, reading the message signal to acquire message data.
9. An IPv6 address acquisition apparatus, characterized in that the IPv6 address acquisition apparatus includes:
the acquisition module is used for acquiring message data and determining whether the type of the message data is a duplicate address detection message;
the detection module is used for detecting whether a target address of the message data carries a polymerizable global unicast address or not if the message data is confirmed to be a duplicate address detection message;
and the confirming module is used for confirming that the target address is the sixth version internet protocol address when the target address is detected to carry the polymerizable global unicast address.
10. A computer storage medium, characterized in that the computer storage medium has stored thereon an acquisition program of an IPv6 address, the acquisition program of the IPv6 address realizing the steps of the acquisition method of an IPv6 address recited in any one of claims 1 to 8 when executed by a processor.
CN202211486151.3A 2022-11-24 2022-11-24 IPv6 address obtaining method and device and storage medium Pending CN115865800A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211486151.3A CN115865800A (en) 2022-11-24 2022-11-24 IPv6 address obtaining method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211486151.3A CN115865800A (en) 2022-11-24 2022-11-24 IPv6 address obtaining method and device and storage medium

Publications (1)

Publication Number Publication Date
CN115865800A true CN115865800A (en) 2023-03-28

Family

ID=85666134

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211486151.3A Pending CN115865800A (en) 2022-11-24 2022-11-24 IPv6 address obtaining method and device and storage medium

Country Status (1)

Country Link
CN (1) CN115865800A (en)

Similar Documents

Publication Publication Date Title
JP5889445B2 (en) Method and apparatus for identifying an application associated with an IP flow using DNS data
CN108401037B (en) Binding method, device and system of user terminal and equipment
CN110677405A (en) Data processing method and device, electronic equipment and storage medium
WO2020206660A1 (en) Network resource request method and apparatus, electronic device and storage medium
US20130332586A1 (en) Providing ipv6 connectivity through shared external interfaces on electronic devices
US9615246B2 (en) Dynamic allocation of host IP addresses
US20070183367A1 (en) Method and apparatus of searching for and acquiring handover information using dynamic host configuration protocol
CN102547553A (en) Method, system and device for accessing service based on wireless application protocol (WAP)
CN104079682A (en) Address translation method and device based on domain name system (DNS)
US7889705B2 (en) Mobile terminal and method for notifying access router of IP address in wireless network
CN102025797A (en) Address prefix processing method, device, system and network equipment
CN103581353A (en) Method and system of automatic configuration of gateway device
CN110278558B (en) Message interaction method and WLAN system
CN111541797A (en) Eco-based IPV6 implementation method
WO2014079235A1 (en) Method, user node and remote access server for releasing address
CN108989173B (en) Message transmission method and device
CN103532852A (en) Routing scheduling method, routing scheduling device and network equipment
CN115865800A (en) IPv6 address obtaining method and device and storage medium
KR100849128B1 (en) Method and system for allocating address in wireless network
CN113285920B (en) Service access method, device, equipment and storage medium
CN108769293B (en) IP address resolution method and related device
CN110290230B (en) Method, device and storage medium for detecting dialing mode supported by network environment
TW201305931A (en) Methods for handling multiple device management (DM) server addresses in a DM account management object (MO), and apparatuses using the same
EP3200433A1 (en) Ipv6 address management method, device and terminal
CN107231341B (en) Message processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination