Network access method, and computing device and computing device cluster

By modifying the type parameters and IP addresses of socket creation requests and connection requests in the computing device, and converting them according to the preset address mapping relationship, the problem of high difficulty in dual stack support for IPv4 and IPv6 in the prior art is solved, and the problem of high support for dual stacks of IPv4 and IPv6 is realized The network access between IPv4 and IPv6 simplifies code logic and promotes the promotion of IPv6.

WO2024230431A1PCT designated stage expired Publication Date: 2024-11-14HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Application Number
PCT/CN2024/088116
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-31
Filing Date
2024-04-16
Publication Date
2024-11-14

AI Technical Summary

Technical Problem

When the existing network access method supports IPv4 and IPv6 dual stacks, it requires the code logic to judge and modify it according to the address scenario, which increases the code complexity, resulting in difficulty in promoting IPv6 and difficulty in achieving mutual access between IPv4 and IPv6. Affects the normal operation of the business.

Method used

By receiving socket creation requests and connection requests in the computing device, modify the type parameters and IP addresses, and convert them according to the preset address mapping relationship to ensure the protocol stack matches and realize network access between IPv4 and IPv6.

Benefits of technology

It simplifies the code logic, reduces complexity, realizes mutual access between IPv4 and IPv6, supports network access between devices of different protocol stacks, and promotes the promotion and application of IPv6.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024088116_14112024_PF_FP_ABST
    Figure CN2024088116_14112024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a network access method, and a computing device and a computing device cluster. The method comprises: receiving a first socket creation request initiated by a target application; modifying a type parameter of the first socket creation request, and creating a socket on the basis of the modified type parameter, wherein the protocol stack corresponding to the modified type parameter is the same as a protocol stack supported by a second computing device; a first computing device receiving a connection request initiated by the target application; and modifying a first IP address in the connection request into a second IP address according to a preset address mapping relationship, wherein the second IP address is an IP address of the second computing device under a second protocol stack supported by the second computing device; and the first computing device establishing a connection with the second computing device on the basis of the socket and the connection request. By means of the solution, a first computing device can establish a connection with a second computing device on the basis of an accurate IP address, such that network access between computing devices under different protocol stacks is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Network access method, computing device and computing device cluster

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on May 5, 2023, with application number 202310497837.0 and invention name "A network access method"; this application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on July 31, 2023, with application number 202310954685.2 and invention name "A network access method, computing device and computing device cluster", all of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of computer technology, and in particular to a network access method, a computing device, and a computing device cluster. Background Art

[0004] With the development of Internet Protocol (IP), Internet Protocol version 4 (IPv4) addresses have been exhausted, and Internet Protocol version 6 (IPv6) has become the mainstream network protocol.

[0005] However, due to the decades of IPv4 network development, the vast majority of services only support IPv4, with no consideration given to IPv6 support. Enabling existing IPv4 services to support IPv6 requires modifying the vast majority of existing services, a significant challenge. Furthermore, with the expansion of cloud services, the number of containers far exceeds the number of virtual machines. To meet these address requirements, containers must be assigned IPv6 addresses. However, the majority of existing services use IPv4 addresses, necessitating a technology that supports interoperability between IPv4 and IPv6 without disrupting the normal operation of existing services.

[0006] In the current network access method, if you want to support IPv4 and IPv6 dual stacks, you need to make judgments based on the address scenario in the code logic and modify the existing code according to different protocol stack scenarios. This will increase the complexity of the code and make the promotion of IPv6 difficult.

[0007] Summary of the Invention

[0008] The present application provides a network access method, a computing device, and a computing device cluster for implementing network mutual access between devices supporting different protocol stacks.

[0009] In the first aspect, the present application provides a network access method, which can be executed by a first computing device or a kernel state in the first computing device. In this method, the first computing device receives a first socket creation request initiated by a target application, the first socket creation request is used to request the creation of a socket for accessing a target application in a second computing device; the first computing device modifies the type parameter of the first socket creation request and creates a socket based on the modified type parameter; the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the second computing device; the first computing device receives a connection request initiated by the target application, the connection request is used to request to establish a connection with the second computing device, and the connection request includes a first Internet Protocol IP address; the first IP address in the connection request is modified to a second IP address according to a preset address mapping relationship; the first IP address belongs to the first protocol stack, and the second IP address is the IP address of the second computing device under the second protocol stack supported by the second computing device; the first computing device establishes a connection with the second computing device based on the socket and the connection request.

[0010] In the above method, the first computing device can modify the type parameters of the socket when receiving the socket creation request of the target application, thereby generating a socket that matches the protocol stack supported by the second computing device, and the first computing device modifies the peer IP address in the connection request initiated by the target application to the IP address under the actual protocol stack of the second computing device, ensuring that the first computing device can establish a connection with the second computing device based on the accurate IP address, thereby realizing network access of the first computing device to the second computing device.

[0011] In one possible design, after creating the socket based on the modified type parameter and before receiving the connection request initiated by the target application, the method further includes: receiving an address binding request initiated by the target application, the address binding request including a third IP address; modifying the third IP address in the address binding request to a fourth IP address based on a preset address mapping relationship; and binding the fourth IP address to the socket based on the address binding request; wherein the third IP address belongs to the first protocol stack, and the fourth IP address is the IP address of the first computing device under the second protocol stack;

[0012] The establishing a connection with the second computing device based on the socket and the connection request includes: establishing a connection with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

[0013] Through this design, after receiving the address binding request, the first computing device can modify the local IP address in the address binding request to a local IP address belonging to the protocol stack supported by the second computing device, so that the first computing device can establish a connection with the second computing device based on the modified local IP address, and then successfully access the second computing device.

[0014] In one possible design, after receiving the address binding request initiated by the target application, before modifying the third IP address in the address binding request to the fourth IP address according to the preset address mapping relationship, the method also includes: determining that the preset address mapping relationship includes a mapping relationship between the third IP address and the fourth IP address.

[0015] Through this design, when the first computing device determines that the preset address mapping relationship includes the mapping relationship between the third IP address and the fourth IP address, it can modify the third IP address in the address binding request according to the mapping relationship between the third IP address and the fourth IP address, thereby ensuring the accuracy of the network address conversion.

[0016] In one possible design, establishing a connection with the second computing device based on the socket and the connection request includes: selecting a fourth IP address from multiple IP addresses of the first computing device, the fourth IP address and the second IP address belonging to the same protocol stack; and establishing a connection with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

[0017] Through this design, if the first computing device does not receive the address binding request sent by the target application, the first computing device can select the fourth IP address when establishing a connection with the second computing device, and establish a connection with the second computing device based on the fourth IP address. The fourth IP address and the second IP address belong to the same protocol stack, so that the network connection can be correctly established to ensure the accuracy of network access.

[0018] In one possible design, after receiving the first socket creation request initiated by the target application and before modifying the type parameter of the first socket creation request, the method also includes: determining that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0019] With this design, a list of applications requiring network address translation can be pre-stored in the first computing device, so that the first computing device can monitor the applications in the application list and perform socket type translation and network address translation in a timely manner.

[0020] In one possible design, the preset application list is system preconfigured or user-defined; the preset address mapping relationship is system preconfigured or user-defined.

[0021] This design allows the system to pre-configure applications that require NAT, or for users to select applications that require NAT. Pre-set address mappings can also be pre-configured by the system or customized by the user, increasing the flexibility of network access methods.

[0022] In one possible design, after receiving the connection request initiated by the target application, before modifying the first IP address in the connection request to the second IP address according to a preset address mapping relationship, the method also includes: determining that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0023] Through this design, when the first computing device determines that the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address, it can modify the first IP address in the connection request according to the mapping relationship between the first IP address and the second IP address, thereby ensuring the accuracy of the network address conversion.

[0024] In one possible design, after establishing a connection with the second computing device based on the socket and the connection request, the method further includes: performing system call processing according to the second IP address; the system call processing includes reading messages from the second computing device, and / or sending messages to the second computing device.

[0025] Through this design, the network access method provided in this application can correctly establish a network connection between the first computing device and the second computing device, and realize message transmission between the first computing device and the second computing device.

[0026] In one possible design, the first protocol stack is an IPv4 protocol stack and the second protocol stack is an IPv6 protocol stack; or the first protocol stack is an IPv6 protocol stack and the second protocol stack is an IPv4 protocol stack.

[0027] Through this design, network mutual access between the first computing device and the second computing device under different protocol stacks can be achieved, which is beneficial to the promotion and application of the IPv4 protocol.

[0028] In a second aspect, the present application provides a network access method, which can be executed by a second computing device or a kernel state in the second computing device. In this method, the second computing device receives a second socket creation request initiated by a target application, the second socket creation request is used to request the creation of a socket for monitoring messages sent by a target application in another device; the type parameter of the second socket creation request is modified, and a socket is created based on the modified type parameter; the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the first computing device corresponding to the target application; the second computing device receives an address binding request initiated by the target application in the second computing device, the address binding request includes a first server Internet Protocol IP address; the second computing device modifies the first IP address in the address binding request to a second IP address according to a preset address mapping relationship; the first IP address belongs to the first protocol stack, and the second IP address is the IP address of the second computing device under the second protocol stack; the second protocol stack is the protocol stack supported by the first computing device corresponding to the target application; the second computing device binds the socket and the second IP address according to the address binding request.

[0029] In the above method, the second computing device can modify the type parameters of the socket when receiving the socket creation request of the target application, thereby generating a socket that matches the protocol stack of the first computing device, and the second computing device modifies the local IP address in the address binding request initiated by the target application to the IP address under the protocol stack supported by the first computing device, ensuring that the second computing device can accept network access from the first computing device based on the accurate IP address.

[0030] In one possible design, after receiving a second socket creation request initiated by a target application and before modifying the type parameter of the second socket creation request, the method further includes: determining that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0031] In a possible design, the preset application list is pre-configured by the system or customized by the user; the preset address mapping relationship is pre-configured by the system or customized by the user.

[0032] In one possible design, after receiving the address binding request initiated by the target application in the second computing device, and before modifying the first IP address in the address binding request to the second IP address according to a preset address mapping relationship, the method also includes: determining that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0033] In one possible design, after binding the socket and the second IP address according to the address binding request, the method further includes: performing system call processing according to the second IP address; the system call processing includes reading a message from the first computing device of the target application, and / or sending a message to the first computing device of the target application.

[0034] In one possible design, the first protocol stack is an IPv4 protocol stack and the second protocol stack is an IPv6 protocol stack; or the first protocol stack is an IPv6 protocol stack and the second protocol stack is an IPv4 protocol stack.

[0035] In a third aspect, the present application provides a network access method, which can be executed by a first computing device or in kernel mode of the first computing device, such as the method can be executed by the first computing device. In this method, the first computing device receives a first socket creation request initiated by a target application, and the first socket creation request is used to request the creation of a socket for accessing a target application in a second computing device; the first computing device creates a first socket according to the first socket creation request; the first computing device receives a connection request initiated by a target application in the first computing device, and the connection request is used to request to establish a connection with the second computing device, and the connection request includes a first server Internet Protocol IP address; the first IP address belongs to a first protocol stack; the first computing device determines that a preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address; the second IP address is the IP address of the second computing device under the second protocol stack supported by the second computing device; the first computing device The computing device closes the first socket and generates a third socket creation request, where the index of the third socket creation request is the same as the index of the first socket creation request, and the type parameter of the third socket creation request is different from the type parameter of the first socket creation request, and the protocol stack corresponding to the type parameter of the third socket creation request is the same as the protocol stack supported by the second computing device; the first computing device creates a second socket according to the third socket creation request; the first computing device modifies the first IP address in the connection request to a second IP address according to the preset address mapping relationship; the protocol stack to which the second IP address belongs is the same as the protocol stack supported by the second computing device; the first computing device establishes a connection with the second computing device based on the second socket and the connection request.

[0036] In the above method, when the first computing device supports dual stack, when the first computing device determines that the preset address mapping relationship includes the target IP address requested by the connection request, it generates a new socket creation request and converts the IP address of the second computing device, ensuring that the first computing device can accurately identify the business that requires network address translation and establish a connection with the second computing device based on the accurate IP address.

[0037] In a possible design, before generating the third socket creation request, the method further includes: determining that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0038] In a possible design, the preset application list is pre-configured by the system or customized by the user; the preset address mapping relationship is pre-configured by the system or customized by the user.

[0039] In one possible design, after establishing a connection with the second computing device based on the second socket and the connection request, the method further includes: performing system call processing based on the second IP address; the system call processing includes reading messages from the second computing device, and / or sending messages to the second computing device.

[0040] In one possible design, generating the third socket creation request includes: generating socket creation requests in sequence according to index arrangement order until the third socket creation request is generated.

[0041] Through this design, since the kernel always assigns the process with the smallest index among the current processes, the first computing device can generate a socket creation request once until a third socket creation request with the same index as the first socket creation request is generated, thereby not affecting the normal business of the target application and ensuring the normal operation of the network access business.

[0042] In a fourth aspect, the present application provides a computing device, which includes a kernel network module for receiving a first socket creation request initiated by a target application, the first socket creation request being used to request the creation of a socket for accessing a target application in a second computing device; a conversion module for modifying a type parameter of the first socket creation request, the protocol stack corresponding to the modified type parameter being the same as the protocol stack supported by the second computing device; the kernel network module is also used to create a socket based on the modified type parameter; receive a connection request initiated by the target application, the connection request being used to request establishment of a connection with the second computing device, the connection request including a first Internet Protocol IP address, the first IP address belonging to a first protocol stack; the conversion module is also used to modify the first Internet Protocol IP address in the connection request to a second IP address according to a preset address mapping relationship; the second IP address is the IP address of the second computing device under a second protocol stack supported by the second computing device; the kernel network module is also used to establish a connection with the second computing device based on the socket and the connection request.

[0043] In one possible design, the kernel network module is also used to: after creating a socket based on the modified type parameters, before receiving a connection request initiated by the target application, receive an address binding request initiated by the target application, the address binding request including a third IP address, and the third IP address belongs to the first protocol stack; the conversion module is also used to: modify the third IP address in the address binding request to a fourth IP address according to a preset address mapping relationship; the fourth IP address is the IP address of the first computing device under the second protocol stack; the kernel network module is also used to: bind the fourth IP address and the socket according to the address binding request; when the kernel network module establishes a connection with the second computing device based on the socket and the connection request, it is specifically used to: establish a connection with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

[0044] In one possible design, the conversion module is also used to: after receiving the address binding request initiated by the target application, before modifying the third IP address in the address binding request to the fourth IP address according to the preset address mapping relationship, determine that the preset address mapping relationship includes a mapping relationship between the third IP address and the fourth IP address.

[0045] In one possible design, the kernel network module is specifically used to: select a fourth IP address from multiple IP addresses of the first computing device, and the fourth IP address and the second IP address belong to the same protocol stack; establish a connection with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

[0046] In one possible design, the conversion module is also used to: after receiving a first socket creation request initiated by a target application, before modifying the type parameter of the first socket creation request, determine that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0047] In one possible design, the conversion module is also used to: before modifying the first server Internet Protocol IP address in the connection request to the second IP address according to the preset address mapping relationship, determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0048] In one possible design, the kernel network module is also used to: after establishing a connection with the second computing device based on the socket and the connection request, perform system call processing according to the second IP address; the system call processing includes reading messages from the second computing device, and / or sending messages to the second computing device.

[0049] In one possible design, the first IP address and the third IP address belong to the IPv4 protocol stack, and the second IP address and the fourth IP address belong to the IPv6 protocol stack; or the first IP address and the third IP address belong to the IPv6 protocol stack, and the second IP address and the fourth IP address belong to the IPv4 protocol stack.

[0050] In a fifth aspect, the present application provides a computing device, comprising: a kernel network module for receiving a second socket creation request initiated by a target application, the second socket creation request being used to request the creation of a socket for monitoring messages sent by a target application in other devices; a conversion module for modifying the type parameter of the second socket creation request, the protocol stack corresponding to the modified type parameter being the same as the protocol stack supported by the first computing device corresponding to the target application; the kernel network module is also used to create a socket based on the modified type parameter; receive an address binding request initiated by the target application, the address binding request including a first server Internet Protocol IP address; the conversion module is also used to modify the first IP address in the address binding request to a second IP address according to a preset address mapping relationship; the first IP address belongs to the first protocol stack, and the second IP address is the IP address of the second computing device under the second protocol stack; the second protocol stack is the protocol stack supported by the first computing device corresponding to the target application; the kernel network module is also used to bind the socket and the second IP address according to the address binding request.

[0051] In one possible design, the conversion module is also used to: after receiving a second socket creation request initiated by the target application, before modifying the type parameter of the second socket creation request, determine that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0052] In one possible design, the conversion module is also used to: after receiving the address binding request initiated by the target application, before modifying the first IP address in the address binding request to the second IP address according to the preset address mapping relationship, determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0053] In one possible design, the kernel network module is also used to: after binding the socket and the second IP address according to the address binding request, perform system call processing according to the second IP address; the system call processing includes reading a message from the first computing device of the target application, and / or sending a message to the first computing device of the target application.

[0054] In one possible design, the first IP address belongs to the IPv4 protocol stack and the second IP address belongs to the IPv6 protocol stack; or the first IP address belongs to the IPv6 protocol stack and the second IP address belongs to the IPv4 protocol stack.

[0055] In a sixth aspect, the present application provides a computing device, the computing device comprising: a kernel network module, for receiving a first socket creation request initiated by a target application, the first socket creation request being used to request creation of a socket for accessing a target application in a second computing device; creating a first socket according to the first socket creation request; receiving a connection request initiated by the target application, the connection request being used to request establishment of a connection with the second computing device, the connection request comprising a first server-side Internet Protocol IP address, the first IP address belonging to a first protocol stack; determining a preset address mapping relationship including a mapping relationship between the first IP address and a second IP address, the second IP address being the IP address of the second computing device under a second protocol stack supported by the second computing device; closing the The first socket is used to generate a third socket creation request, the index of the third socket creation request is the same as the index of the first socket creation request, and the type parameter of the third socket creation request is different from the type parameter of the first socket creation request, and the protocol stack corresponding to the type parameter of the third socket creation request is the same as the protocol stack supported by the second computing device; a second socket is created according to the third socket creation request; a conversion module is used to modify the first IP address in the connection request to a second IP address according to the preset address mapping relationship; the protocol stack to which the second IP address belongs is the same as the protocol stack supported by the second computing device; the kernel network module is also used to: establish a connection with the second computing device based on the second socket and the connection request.

[0056] In a possible design, the conversion module is further used to: before generating the third socket creation request, determine that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

[0057] In one possible design, the kernel network module is also used to: after establishing a connection with the second computing device based on the second socket and the connection request, perform system call processing based on the second IP address; the system call processing includes reading messages from the second computing device, and / or sending messages to the second computing device.

[0058] In one possible design, the kernel network module is specifically used to generate socket creation requests in sequence according to the index arrangement order until the third socket creation request is generated.

[0059] In the seventh aspect, the present application provides a computing device, comprising a processor and a memory; the processor is used to execute instructions stored in the memory, so that the computing device executes the method described in the above-mentioned first aspect and any possible design of the first aspect, or executes the method described in the above-mentioned second aspect and any possible design of the second aspect, or executes the method described in the above-mentioned third aspect and any possible design of the third aspect.

[0060] In an eighth aspect, the present application provides a computing device cluster, wherein the computing device cluster includes at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method described in the above-mentioned first aspect and any possible design of the first aspect, or executes the method described in the above-mentioned second aspect and any possible design of the second aspect, or executes the method described in the above-mentioned third aspect and any possible design of the third aspect.

[0061] In a ninth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device, enables the computing device to execute the method described in the first aspect and any possible design of the first aspect, or execute the method described in the second aspect and any possible design of the second aspect, or execute the method described in the third aspect and any possible design of the third aspect.

[0062] In the tenth aspect, the present application provides a computer-readable storage medium comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method described in the first aspect and any possible design of the first aspect, or executes the method described in the second aspect and any possible design of the second aspect, or executes the method described in the third aspect and any possible design of the third aspect.

[0063] The embodiments of the present application can be further combined to provide more implementations based on the implementations provided in the above aspects. For the beneficial effects of the fourth to tenth aspects, please refer to the description of the beneficial effects of the first to third aspects, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] FIG1 is a schematic diagram of the architecture of a NAT64 technology;

[0065] FIG2 is a schematic diagram of the architecture of a communication system that can implement network address translation;

[0066] FIG3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0067] FIG4 is a flow chart of a network access method provided in an embodiment of the present application;

[0068] FIG5 is a flow chart of a network access method provided in an embodiment of the present application;

[0069] FIG6 is a flow chart of a network access method provided in an embodiment of the present application;

[0070] FIG7 is a flow chart of a network access method provided in an embodiment of the present application;

[0071] FIG8 is a flow chart of a network access method provided in an embodiment of the present application;

[0072] FIG9 is a flow chart of a network access method provided in an embodiment of the present application;

[0073] FIG10 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0074] FIG11 is a schematic diagram of a computing device cluster provided in an embodiment of the present application;

[0075] FIG12 is a schematic diagram of a computing device cluster connection method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings. In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0077] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.

[0078] The Transmission Control Protocol / Internet Protocol (TCP / IP) is the most basic communication protocol used in the Internet. The TCP / IP transmission protocol specifies the standards and methods for communication between different parts of the Internet.

[0079] The Internet Protocol Address (IP) is a unified address format provided by the IP protocol. Based on the IP protocol, an IP address can be assigned to each network and each host on the Internet, so that all hosts connected to the network can communicate with each other based on their own IP addresses and the IP address of the receiving host.

[0080] Internet Protocol version 4 (IPv4) uses a 32-bit address length, providing approximately 4.3 billion addresses. However, with the development of the Internet Protocol (IP), IPv4 addresses have become depleted, and Internet Protocol version 6 (IPv6) has become the mainstream network protocol. IPv6 uses a 128-bit address length, providing almost unlimited addresses.

[0081] However, due to the decades of IPv4 network development, the vast majority of services only support IPv4, with no consideration given to IPv6 support. Enabling existing IPv4 services to support IPv6 requires modifying the vast majority of existing services, a significant challenge. Furthermore, with the expansion of cloud services, the number of containers far exceeds the number of virtual machines. To meet these address requirements, containers must be assigned IPv6 addresses. However, the majority of existing services use IPv4 addresses, necessitating a technology that supports interoperability between IPv4 and IPv6 without disrupting the normal operation of existing services.

[0082] In the current network access method, if you want to support IPv4 and IPv6 dual stacks, you need to make judgments based on the address scenario in the code logic and modify the existing code according to different protocol stack scenarios. This will increase the complexity of the code and make the promotion of IPv6 difficult.

[0083] Figure 1 is a schematic diagram of a communication system. Referring to Figure 1 , the communication system may include multiple computing devices and gateways. The present application does not limit the number of computing devices in the communication system. The first computing device, gateway, and second computing device in Figure 1 are provided for illustrative purposes only and are not intended to be limiting.

[0084] In the embodiments of the present application, computing devices refer to various electronic devices that need to access the Internet (referring to being connected to the IPv4 public network or the IPv6 public network), such as computers, laptops, smart phones, tablet computers, smart wearable devices and other devices, or servers, or other household devices, or computing instances such as virtual machines and containers. In Figure 1, the first computing device is used as a terminal and the second computing device is used as a server as an example. The embodiments of the present application do not limit the types of computing devices. In the embodiments of the present application, computing devices can install applications, and the applications in the computing devices can be clients or servers. Clients can request access to the server, and clients can also request access to other clients, and the server can monitor access requests initiated by clients. In the following introduction, the application in the first computing device accesses the application in the second computing device as an example for explanation.

[0085] An application can be installed on a first computing device. When a user uses the network services provided by the application, the first computing device can exchange data with the second computing device based on the IP address of the first computing device and the IP address of the second computing device, thereby completing the service. For example, taking IPv4 as an example, an IP address based on IPv4 consists of 32 bits. IPv4 divides this 32-bit address into two parts: the first part represents the network address, and the second part represents the host's address in the local area network. If two IP addresses are in the same subnet, the network addresses must be the same. To determine the network address in an IP address, the IP protocol also introduces a subnet mask. The network address can be obtained by performing a bitwise AND operation on the IP address and subnet mask. When the first computing device sends a data packet to the second computing device, it can first use the IPv4 protocol to determine whether the first computing device and the second computing device are in the same subnet. If they are in the same subnet, the first computing device can query the media access control (MAC) address using the Address Resolution Protocol (ARP). This allows the first computing device to broadcast the data packet to the second computing device in the same subnet. If the first computing device and the second computing device are not on the same subnet, the Ethernet network forwards the packet to the gateway of the same subnet for routing. The gateway may forward the packet multiple times until it reaches the subnet where the second computing device resides. The gateway then retrieves the MAC address of the second computing device through ARP and finally sends the packet to the second computing device via broadcast.

[0086] Under the IPv4 protocol, when a first computing device needs to send a data packet to a second computing device, the first computing device performs the following steps:

[0087] Step a: Create a socket with type parameter set to IPv4;

[0088] Step b: Bind the local IPv4 address;

[0089] Step c: Connect to the IPv4 address of the second computing device.

[0090] Similarly, under the IPv6 protocol, when a first computing device needs to send a data packet to a second computing device, the first computing device performs the following steps:

[0091] Step a: Create a socket with type parameter set to IPv6;

[0092] Step b: Bind the local IPv6 address;

[0093] Step c: Connect to the IPv6 address of the second computing device.

[0094] The socket in the above process can be thought of as an endpoint in a communication connection between two applications on different hosts. This is a logical concept. A socket is equivalent to the application programming interface (API) for inter-process communication in a network environment; it is a named and addressable communication endpoint. Each socket has a type and a process connected to it. A socket is a mechanism for transmitting data packets to application layer processes based on IP addresses and ports.

[0095] Under different versions of the IP protocol, the data packets transmitted between the first computing device and the second computing device need to be routed by different gateways. For example, under IPv4, an IPv4 gateway is required to route the data packets, and under IPv6, an IPv6 gateway is required to route the data packets. How to achieve network mutual access between devices under different protocol stacks has become an extremely important topic at present.

[0096] In an optional implementation, a network address translation (NAT) device may be deployed at an intermediate node between the IPv6 network and the IPv4 network, such as a NAT64 device (also known as a NAT46 device) that supports network address translation between IPv6 and IPv4.

[0097] For example, Figure 2 is a schematic diagram of the architecture of a communication system that can implement network address translation. Figure 2 takes the interaction between a first computing device that supports IPv6 and a second electronic device that supports IPv4 as an example. Referring to Figure 2, the communication system includes an IPv6 device, an IPv6 gateway, a NAT64 device, an IPv4 gateway, and an IPv4 device. Assume that the IP address of the IPv6 device is: fe80::fbaf:32c5:ac97:0102, and the IP address of the IPv4 device is 192.168.1.1. The NAT64 device has dual-stack capabilities supporting IPv6 and IPv4, and the NAT64 device has addresses for two networks. To translate IPv6 and IPv4 addresses, configure the following mapping on the NAT64 device: the IPv6 address fe80::fbaf:32c5:ac97:0102 on the IPv6 device corresponds to the IPv4 address 192.168.2.2; the IPv4 address 192.168.1.1 on the IPv4 device corresponds to the IPv6 address fe80::fbaf:32c5:ac98:0304.

[0098] When an IPv6 device needs to send a data packet to the server, the source and destination addresses of the packet are both IPv6 IP addresses. The source address of the packet is fe80::fbaf:32c5:ac97:0102, and the destination address is fe80::fbaf:32c5:ac98:0304. After being forwarded by the IPv6 gateway, the NAT64 device receives the packet. The NAT64 device queries the preconfigured network address mapping and determines that the source and destination addresses of the packet both have corresponding IPv4 addresses. NAT64 then modifies the source address of the packet to 192.168.2.2 and the destination address to 192.168.1.1. After the modified network addresses, the packet can be forwarded by the IPv4 gateway to the IPv4 device.

[0099] Similarly, when an IPv4 device sends a data packet to an IPv6 device, the NAT64 device can modify the source address and destination address of the data packet to the IPv6 address corresponding to the IPv4 address, thereby achieving the transmission of the data packet from the IPv4 device to the IPv6 device.

[0100] However, while the above solution enables intercommunication between IPv4 and IPv6 networks, it requires the introduction of new equipment in the communication system, increasing the complexity of service deployment. Furthermore, packet forwarding through the NAT64 device increases latency, and the performance of the NAT64 device can also affect service performance.

[0101] Based on the above problems, the present application provides a network access method, which can be executed by a first computing device and a second computing device. In the network access method provided in an embodiment of the present application, the first computing device receives a first socket creation request initiated by a target application, and the first socket creation request is used to request the creation of a socket for accessing the target application in the second computing device. The first computing device can modify the type parameter of the first socket creation request and create a socket based on the modified type parameter. The protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the second computing device. The first computing device receives a connection request initiated by the target application, and the connection request is used to request to establish a connection with the second computing device. The connection request includes a first IP address, and the first IP address belongs to the first protocol stack. The first computing device can modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship. The second IP address is the IP address of the second computing device under the second protocol stack supported by the second computing device. The first computing device can establish a connection with the second computing device based on the created socket and the connection request. Through this solution, the first computing device can modify the type parameters of the socket when receiving the socket creation request from the target application, thereby generating a socket that matches the protocol stack of the second computing device, and the first computing device can modify the peer IP address in the connection request initiated by the target application to the IP address under the actual protocol stack of the second computing device, ensuring that the first computing device can establish a connection with the second computing device based on the accurate IP address.

[0102] In another network access method provided in an embodiment of the present application, a first computing device can support both IPv4 and IPv6 protocols. In this method, the first computing device receives a first socket creation request initiated by a target application in the first computing device and creates a first socket based on the first socket creation request. The first computing device receives a connection request sent by the target application, and the first computing device determines that a preset address mapping relationship includes a mapping relationship between a first IP address in the connection request and a second IP address, the first IP address belongs to a first protocol stack, and the second IP address is the IP address of the second computing device under a second protocol stack supported by the second computing device. The first computing device can then determine that network address translation is required for the connection request. The first computing device can close the first socket and generate a third socket creation request, the third socket creation request having the same index as the first socket creation request, and the type parameter of the third socket matching the protocol stack of the second computing device. The first computing device creates a second socket based on the third socket creation request and modifies the first IP address in the connection request to the second IP address based on the preset mapping relationship, the protocol stack to which the second IP address belongs being the same as the protocol stack supported by the second computing device. The first computing device can establish a connection with the second computing device based on the second socket and the connection request. With this solution, when the first computing device supports dual stack, upon determining that the preset address mapping relationship includes the target IP address requested by the connection request, the first computing device generates a new socket creation request and translates the IP address of the second computing device. This ensures that the first computing device can accurately identify services requiring network address translation and establish a connection with the second computing device based on the accurate IP address.

[0103] The structure of a computing device provided in an embodiment of the present application is introduced below. The computing device can be a first computing device or a second computing device. Figure 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. Referring to Figure 3, the computing device can be installed with at least one application, as shown in Figure 3, in which the user state includes three applications (APP1, APP2, APP3). The kernel network module in the kernel state is used to execute system calls and the actual execution function of the system calls, so that it can be used to respond to the system call request initiated by the application, establish a connection with the second computing device, and send data packets to the second computing device or receive data packets sent by the second computing device.

[0104] The network access method provided in the embodiment of the present application can be executed by a conversion module in a computing device. As shown in Figure 3, the conversion management module can be used to send a list of applications and conversion types that need to be monitored, as well as an address mapping relationship, to the conversion module. Optionally, the user can set a list of applications that need to be monitored, and the user can configure the address conversion relationship; or the list of applications that need to be monitored and the address conversion relationship can be pre-configured by the system. The conversion module can store the list of applications and conversion types that need to be monitored, as well as store preset address mapping relationships.

[0105] Assuming that the list of applications to be monitored includes APP1, upon receiving a system call request initiated by APP1, the kernel network module of the computing device can send the context related to the system call request to the conversion module. The conversion module can modify the type parameter of the socket creation request and the target address in the connection request. The conversion module can return the processed socket creation request and connection request to the kernel network module. The kernel network module then creates a socket based on the processed socket creation request and establishes a connection with the remote end based on the modified connection request, thereby enabling network interoperability between devices under different protocol stacks without affecting the original data processing process and data transmission and reception process.

[0106] In some embodiments, the network access method provided by the embodiment of the present application can also be used to enable the computing device to support other IP protocols. For example, assuming that the first computing device supports IPv4, the user can turn on the "Support IPv6" function in the control interface of the first computing device, and the first computing device loads the conversion module and the conversion management module as shown in Figure 3. When loading the conversion module, the first computing device can register the detection information of the socket interface with the kernel. The IPv6 address is allocated to the first computing device through the conversion management module, and the preset application list, conversion type and preset address mapping relationship are sent to the conversion module, so that the first computing device can access the IPv6 second computing device based on the network access method provided by the embodiment of the present application, thereby realizing the function of the first computing device supporting different protocol stacks.

[0107] The network mutual access method provided in the embodiment of the present application can be applied to a first computing device or a second computing device supporting a single stack, and can also be applied to a first computing device supporting a dual stack. The network mutual access method in different protocol stack scenarios is further introduced below.

[0108] 1. Single-stack scenario

[0109] The single-stack scenario in the embodiments of the present application means that in the initial state, the first computing device supports the IPv4 protocol and the second computing device supports the IPv6 protocol, or in the initial state, the first computing device supports the IPv6 protocol and the second computing device supports the IPv4 protocol.

[0110] Figure 4 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by a first computing device or a kernel state in the first computing device. In this embodiment, the first computing device receives a request initiated by a target application and accesses the target application in a second computing device. Referring to Figure 4, the method includes the following steps:

[0111] S401: Receive a first socket creation request initiated by a target application.

[0112] The first socket creation request is used to request the creation of a client socket for network communication.

[0113] The target application is an application in a preconfigured application list stored in the first computing device. The application in the preconfigured application list and the second computing device to which the application requests to connect are in different protocol stacks. The first computing device needs to monitor the system call request initiated by the target application to perform socket type conversion processing and network address conversion processing.

[0114] S402: Modify the type parameter of the first socket creation request, and create a socket based on the modified type parameter.

[0115] In one optional embodiment, after receiving the first socket creation request, the first computing device may query a preset application list to determine whether the target application is included. The applications in the preset application list are applications that require network address translation. After determining that the target application is included in the preset application list, the first computing device may modify the type parameter of the first socket creation request and create the socket based on the modified type parameter.

[0116] The first socket creation request initiated by the target application includes a type parameter of the first socket creation request. The first computing device can modify the type parameter of the first socket creation request, and the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the second computing device. For example, assuming that the target application is an IPv4 application, the type parameter of the first socket creation request is AF_INET, and the second computing device supports IPv6, the first computing device can modify the type parameter of the first socket creation request to AF_INET6. For another example, assuming that the target application is an IPv6 application, the type parameter of the first socket creation request is AF_INET6, and the second computing device supports IPv4, the first computing device can modify the type parameter of the first socket creation request to AF_INET.

[0117] The first computing device can create a socket based on the modified type parameter. For example, when the modified type parameter is AF_INET6, the first computing device can create a socket under IPv6; when the modified type parameter is AF_INET, the first computing device can create a socket under IPv4. Through this design, the first computing device can generate a socket that matches the protocol stack supported by the second computing device, ensuring that the first computing device can subsequently correctly access the second computing device based on this socket.

[0118] S403: Receive an address binding request sent by the target application.

[0119] Optionally, the address binding request sent by the target application is used to request binding the local IP address of the first computing device. In an embodiment of the present application, the address binding request sent by the target application includes a third IP address, and the third IP address belongs to the first protocol stack. The target application can obtain the third IP address from the configuration file and generate an address binding request based on the obtained third IP address. Optionally, the third IP address can be the address of the first computing device under the first protocol stack; or the third IP address can be any IP address under the first protocol stack, that is, the third IP address in the address binding request may not be the real address of the first computing device.

[0120] In an optional implementation, after receiving the address binding request from the target application, the first computing device can determine whether the preset address mapping relationship includes the mapping relationship between the third IP address and the fourth IP address, and then execute S404 after determining that the preset address mapping relationship includes the mapping relationship between the third IP address and the fourth IP address.

[0121] S404: Modify the third IP address in the address binding request to a fourth IP address according to a preset address mapping relationship, and bind the fourth IP address and the socket according to the address binding request.

[0122] In an optional embodiment, the first computing device may store a preset address mapping relationship. Taking the first protocol stack and the second protocol stack as IPv4 and IPv6 as an example, the address mapping relationship may include the IPv4 address and IPv6 address corresponding to the first computing device, and may also include the IPv4 address and IPv6 address corresponding to the second computing device. In an embodiment of the present application, an IP address under another protocol stack may be assigned to the first computing device. For example, assuming that the first computing device initially supports IPv4, an IP address under IPv6 may be assigned to the first computing device, and the mapping relationship between the IPv4 address and the IPv6 address of the first computing device may be stored.

[0123] In some embodiments, when initiating an address binding request, the target application in the first computing device may obtain the third IP address of the first computing device from the configuration file. If the third IP address in the configuration file is a preconfigured false address under the first protocol stack, the address mapping relationship may store a mapping relationship between the false address and the real address of the first computing device under the second protocol stack. If the third IP address in the configuration file is the real address of the first computing device under the first protocol stack, the address mapping relationship may store a mapping relationship between the real address of the first computing device under the first protocol stack and the real address of the first computing device under the second protocol stack.

[0124] The first computing device can modify the third IP address in the address binding request to a fourth IP address based on a preset address mapping relationship, where the fourth IP address is the IP address of the first computing device under the second protocol stack, and the protocol stack to which the fourth IP address belongs is the same as the protocol stack supported by the second computing device. For example, assuming that the target application is an IPv4 application, the third IP address is an IPv4 address, and the second computing device supports IPv6, then the fourth IP address modified by the first computing device is the IPv6 address of the first computing device. For another example, assuming that the target application is an IPv6 application, the third IP address is an IPv6 address, and the second computing device supports IPv4, then the fourth IP address modified by the first computing device is the IPv4 address of the first computing device.

[0125] The first computing device may bind the fourth IP address and the socket according to the address binding request after the address is modified.

[0126] Through this design, after receiving the address binding request, the first computing device can modify the local IP address in the address binding request to the local IP address under the protocol stack supported by the second computing device, so that the first computing device can bind the modified local IP address to the socket, and then successfully access the second computing device based on the socket.

[0127] It should be noted that, in a specific implementation, S403-S404 are optional steps, and the target application may not initiate an address binding request. Then, when the first computing device establishes a connection with the second computing device, it may select a fourth IP address from the multiple IP addresses of the first computing device, and the protocol to which the fourth IP address belongs is the same as the protocol supported by the second computing device.

[0128] S405: Receive a connection request initiated by the target application.

[0129] The connection request initiated by the target application is used to request that the first computing device establish a connection with the second computing device. The connection request includes a first IP address, which belongs to the first protocol stack. The target application can obtain the first IP address from a configuration file and generate a connection request based on the obtained first IP address. Optionally, the first IP address can be any IP address within the first protocol stack, meaning that the first IP address in the connection request does not need to be the actual address of the second computing device.

[0130] In an optional embodiment, after receiving the connection request from the target application, the first computing device may determine whether a preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address, where the second IP address is the IP address of the second computing device under the second protocol stack supported by the second computing device. After determining that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address, S406 is executed.

[0131] S406: Modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship.

[0132] Based on the above description, it can be seen that when the protocol stack supported by the first computing device is different from the protocol stack supported by the second computing device, the IP address of the second computing device in the connection request is not the actual IP address of the second computing device, and the first computing device needs to modify the IP address of the second computing device in the connection request. In an embodiment of the present application, the first computing device can modify the first IP address in the connection request to the second IP address according to a preset address mapping relationship. Among them, the protocol to which the first IP address belongs is the same as the protocol supported by the first computing device, and the protocol stack to which the first IP address belongs is the first protocol stack; the protocol to which the second IP address belongs is the same as the protocol supported by the second computing device, and the second IP address is the IP address of the second computing device under the second protocol stack.

[0133] For example, assuming the target application is an IPv4 application, the first IP address in the connection request is an IPv4 address, and the second computing device supports IPv6, the second IP address modified by the first computing device is an IPv6 address. For another example, assuming the target application is an IPv6 application, the first IP address in the connection request is an IPv6 address, and the second computing device supports IPv4, the second IP address modified by the first computing device is an IPv4 address.

[0134] Through this design, the first computing device can modify the peer IP address in the connection request initiated by the target application to the IP address under the actual protocol stack of the second computing device, ensuring that the first computing device can establish a connection with the second computing device based on the accurate IP address, thereby realizing the network access of the first computing device to the second computing device.

[0135] S407: Establish a connection with the second computing device based on the socket and the connection request.

[0136] In an optional implementation, the first computing device may establish a connection with the second computing device based on the socket created with the modified type parameter and according to the fourth IP address and the second IP address in the connection request.

[0137] S408: Perform system call processing according to the second IP address.

[0138] Optionally, the system call processing includes reading a message from the second computing device, and / or sending a message to the second computing device.

[0139] Through the network access method provided in the embodiment of the present application, the first computing device can modify the type parameters of the socket when receiving the socket creation request from the target application, thereby generating a socket that matches the protocol stack of the second computing device, and the first computing device modifies the target IP address in the connection request initiated by the target application to the IP address under the actual protocol stack of the second computing device, ensuring that the first computing device can establish a connection with the second computing device based on the accurate IP address.

[0140] Based on the structure of the computing device shown in Figure 3, the network access method provided by the embodiment of the present application is further described below from the interaction of various modules in the first computing device. Figure 5 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by the target application, kernel network module, and conversion module in the first computing device. Referring to Figure 5, the method includes the following steps:

[0141] S501: The target application sends a first socket creation request to the kernel network module.

[0142] The first socket creation request is used to request the creation of a socket for accessing a target application in the second computing device. For example, if the target application is an IPv6 application, the type parameter of the first socket creation request is AF_INET6.

[0143] S502: The kernel network module sends a first socket creation request to the conversion module.

[0144] Optionally, after receiving the first socket creation request, the conversion module may determine whether the target application belongs to a preset application list before modifying the type parameter of the first socket creation request. After determining that the preset application list includes the target application, S503 is executed.

[0145] S503: The conversion module modifies the type parameter of the first socket creation request.

[0146] For example, if the target application is an IPv6 application and the second computing device supports IPv4, the conversion module may modify the type parameter of the first socket creation request from AF_INET6 to AF_INET.

[0147] S504: The conversion module sends the modified first socket creation request to the kernel network module.

[0148] S505: The kernel network module creates a socket according to the modified type parameter.

[0149] S506: The kernel network module returns the execution result to the target application.

[0150] S507: The target application sends an address binding request to the kernel network module.

[0151] Optionally, the address binding request sent by the target application is used to request binding the IP address of the first computing device. For example, the third IP address included in the address binding request is FE80::1234::2.

[0152] S508: The kernel network module sends the address binding request to the conversion module.

[0153] Optionally, after receiving the address binding request, the conversion module may determine whether the preset address mapping relationship includes the mapping relationship between the third IP address and the fourth IP address. After determining that the preset address mapping relationship includes the mapping relationship between the third IP address and the fourth IP address, S509 is executed.

[0154] S509: The conversion module modifies the third IP address in the address binding request into a fourth IP address according to a preset address mapping relationship.

[0155] For example, the conversion module modifies the third IP address FE80::1234::2 in the binding request to the fourth IP address 192.168.1.2.

[0156] S510: The conversion module sends the address binding request after the address is modified to the kernel network module.

[0157] S511: The kernel network module binds the fourth IP address and the socket according to the address binding request.

[0158] S512: The kernel network module returns the execution result to the target application.

[0159] S513: The target application sends a connection request to the kernel network module.

[0160] Optionally, the connection request sent by the target application is used to request the first computing device to establish a connection with the second computing device. For example, the first IP address included in the connection request is FE80::1234::1:80.

[0161] S514: The kernel network module sends the connection request to the conversion module.

[0162] Optionally, after receiving the connection request, the conversion module may determine whether the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address. After determining that the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address, S515 is executed.

[0163] S515: The conversion module modifies the first IP address in the connection request into a second IP address according to a preset address mapping relationship.

[0164] For example, the conversion module modifies the first IP address FE80::1234::1:80 in the binding request to the second IP address 192.168.1.1.

[0165] S516: The conversion module sends the connection request with the modified address to the kernel network module.

[0166] S517: The kernel network module establishes a connection with the second computing device based on the socket and the connection request.

[0167] S518: The kernel network module returns the execution result to the target application.

[0168] S519: The target application sends a write request to the kernel network module.

[0169] S520: The kernel network module sends a data packet to the second computing device according to the received write request.

[0170] S521: The target application sends a read request to the kernel network module.

[0171] S522: The kernel network module receives the data packet sent by the second computing device according to the received read request.

[0172] FIG6 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by a second computing device or a kernel state in the second computing device. In this embodiment, the second computing device can monitor messages sent by a target application in another device. Referring to FIG6, the method includes the following steps:

[0173] S601: Receive a second socket creation request initiated by a target application.

[0174] Optionally, the second socket creation request is used to request creation of a socket for monitoring messages sent by a target application in another device.

[0175] S602: Modify the type parameter of the second socket creation request, and create a socket based on the modified type parameter.

[0176] The second socket creation request includes a type parameter of the second socket creation request. The second computing device may modify the type parameter of the second socket creation request. For example, if the type parameter of the second socket creation request is AF_INET and the target application is an IPv6 application, the second computing device may modify the type parameter of the second socket creation request to AF_INET6. For another example, if the type parameter of the second socket creation request is AF_INET6 and the target application is an IPv4 application, the second computing device may modify the type parameter of the second socket creation request to AF_INET.

[0177] The second computing device can create a socket based on the modified type parameter. For example, when the modified type parameter is AF_INET6, the second computing device can create a socket under IPv6; when the modified type parameter is AF_INET, the second computing device can create a socket under IPv4.

[0178] S603: Receive an address binding request initiated by the target application.

[0179] The address binding request is used to request binding the IP address of the second computing device. In an embodiment of the present application, the address binding request includes a first IP address, and the first IP address belongs to the first protocol stack. The target application can obtain the first IP address from the configuration file and generate an address binding request based on the obtained first IP address. Optionally, the first IP address can be the address of the second computing device under the first protocol stack; or the first IP address can be any IP address under the first protocol stack, that is, the first IP address in the address binding request may not be the real address of the second computing device.

[0180] In an optional implementation, after receiving the address binding request of the target application, the second computing device can determine whether the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address, and then execute S604 after determining that the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address.

[0181] S604: Modify the first IP address in the address binding request to the second IP address according to the preset address mapping relationship, and bind the socket and the second IP address based on the address binding request.

[0182] In an optional embodiment, the second computing device may store a preset address mapping relationship. For example, if the first protocol stack and the second protocol stack are IPv4 and IPv6, the address mapping relationship may include the IPv4 address and IPv6 address of the second computing device. In an embodiment of the present application, an IP address under another protocol stack may be assigned to the second computing device. For example, if the second computing device initially supports IPv4, an IP address under IPv6 may be assigned to the second computing device, and the mapping relationship between the IPv4 address and the IPv6 address of the second computing device may be stored.

[0183] In some embodiments, when initiating an address binding request, the target application in the second computing device may obtain the first IP address of the second computing device from a configuration file. If the first IP address in the configuration file is a preconfigured false address under the first protocol stack, the address mapping relationship may store a mapping relationship between the false address and the real address of the second computing device under the second protocol stack. If the first IP address in the configuration file is the real address of the second computing device under the first protocol stack, the address mapping relationship may store a mapping relationship between the real address of the second computing device under the first protocol stack and the real address of the second computing device under the second protocol stack.

[0184] The second computing device may modify the first IP address in the address binding request to a second IP address based on a preset address mapping relationship, where the second IP address is the IP address of the second computing device under the second protocol stack. For example, assuming that the first IP address in the address binding request is an IPv4 address and the target application is an IPv6 application, the second IP address modified by the second computing device is the IPv6 address of the second computing device. For another example, assuming that the first IP address in the address binding request is an IPv6 address and the target application is an IPv4 application, the second IP address modified by the second computing device is the IPv4 address of the second computing device.

[0185] The second computing device can bind the socket to the second IP address according to the modified address binding request, so that the second computing device can monitor messages whose target address is the second IP address, ensuring that the second computing device can successfully accept network access initiated by the first computing device.

[0186] S605: Perform system call processing according to the second IP address.

[0187] Optionally, the system call processing includes reading a message from the first computing device of the target application, and / or sending a message to the first computing device of the target application.

[0188] Through the network access method provided in the embodiment of the present application, the second computing device can modify the type parameters of the socket when receiving the socket creation request of the target application, thereby generating a socket that matches the protocol stack of the first computing device, and the second computing device modifies the server IP address in the binding request initiated by the target application to an IP address under the protocol stack of the first computing device, ensuring that the second computing device can interact with the first computing device of the target application.

[0189] Based on the structure of the computing device shown in Figure 3, the network access method provided by the embodiment of the present application is further described below from the interaction of various modules in the second computing device. Figure 7 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by the target application, kernel network module, and conversion module in the second computing device. Referring to Figure 7, the method includes the following steps:

[0190] S701: The target application sends a second socket creation request to the kernel network module.

[0191] The second socket creation request is used to request the creation of a socket for monitoring messages sent by a target application in another device. For example, if the second computing device supports IPv4, the type parameter of the second socket creation request is AF_INET.

[0192] S702: The kernel network module sends a second socket creation request to the conversion module.

[0193] Optionally, after receiving the second socket creation request, the conversion module may determine whether the target application belongs to a preset application list before modifying the type parameter of the second socket creation request. After determining that the preset application list includes the target application, S703 is executed.

[0194] S703: The conversion module modifies the type parameter of the second socket creation request.

[0195] For example, the second computing device supports IPv4, and the target application is an IPv6 application. The conversion module may modify the type parameter of the second socket creation request from AF_INET to AF_INET6.

[0196] S704: The conversion module sends the modified second socket creation request to the kernel network module.

[0197] S705: The kernel network module creates a socket according to the modified type parameter.

[0198] S706: The kernel network module returns the execution result to the target application.

[0199] S707: The target application sends an address binding request to the kernel network module.

[0200] Optionally, the address binding request sent by the target application is used to request binding of the IP address of the second computing device. For example, the first IP address included in the address binding request is 192.168.1.1.

[0201] S708: The kernel network module sends the address binding request to the conversion module.

[0202] Optionally, after receiving the address binding request, the conversion module may determine whether the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address. After determining that the preset address mapping relationship includes the mapping relationship between the first IP address and the second IP address, S709 is executed.

[0203] S709: The conversion module modifies the first IP address in the address binding request into a second IP address according to a preset address mapping relationship.

[0204] For example, the conversion module modifies the first IP address 192.168.1.1 in the binding request into the fourth IP address FE80::1234::1.

[0205] S710: The conversion module sends the address binding request after the address is modified to the kernel network module.

[0206] S711: The kernel network module binds the socket and the second IP address based on the address binding request.

[0207] S712: The kernel network module returns the execution result to the target application.

[0208] S713: The target application sends a read request to the kernel network module.

[0209] S714: The kernel network module receives the data packet sent by the first computing device according to the received read request.

[0210] S715: The target application sends a write request to the kernel network module.

[0211] S716: The kernel network module sends a data packet to the first computing device according to the received write request.

[0212] 2. Dual-stack Scenario

[0213] The dual-stack scenario in the embodiment of the present application means that the first computing device supports both the IPv4 protocol and the IPv6 protocol in the initial state.

[0214] Figure 8 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by a first computing device or a kernel state in the first computing device. In this embodiment, the first computing device receives a request initiated by a target application and accesses the target application in the second computing device. Referring to Figure 8, the method includes the following steps:

[0215] S801: Receive a first socket creation request initiated by a target application, and create a first socket according to the first socket creation request.

[0216] The first socket creation request is used to request creation of a socket for accessing a target application in the second computing device.

[0217] The target application is an application in a preconfigured application list stored by the first computing device. The application in the preconfigured application list may be in a different protocol stack from the second computing device to which the application requests to connect. The first computing device needs to monitor the system call request initiated by the target application. Since the first computing device in this embodiment supports both IPv4 and IPv6 dual stacks, when the first computing device receives the first socket creation request initiated by the target application, it cannot determine the IP address of the second computing device to which the target application requests to connect, and therefore cannot determine whether socket type conversion processing and network address conversion processing are required. The first computing device needs to wait until it receives the connection request initiated by the target application, and then determine whether socket type conversion processing and network address conversion processing are required based on the IP address of the second computing device in the connection request.

[0218] S802: Receive a connection request initiated by the target application.

[0219] The connection request is used to request a connection with the second computing device, and the connection request includes a first IP address. The first IP address belongs to the first protocol stack. The target application can obtain the first IP address from a configuration file and generate a connection request based on the obtained first IP address. Optionally, the first IP address can be any IP address in the first protocol stack, that is, the first IP address in the connection request may not be the actual address of the second computing device.

[0220] S803: Determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0221] In an optional embodiment, a preset address mapping relationship is stored in the first computing device. When the first computing device receives a connection request, it can obtain the first IP address in the connection request and search whether the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address, where the second IP address is the IP address of the second computing device under the second protocol stack supported by the second computing device. If the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address, it indicates that the first computing device needs to convert the address in the connection request.

[0222] S804: Close the first socket and generate a third socket creation request.

[0223] Optionally, the first computing device may close the first socket created in S801 and generate a third socket creation request, the index of the third socket creation request being the same as the index of the first socket creation request, and the type parameter of the third socket creation request being different from the type parameter of the first socket creation request.

[0224] In an optional embodiment, when a new socket creation request is created, since the kernel always assigns the process with the smallest index in the current process, the first computing device needs to generate socket creation requests in sequence according to the order of index arrangement until a third socket creation request with the same index as the first socket creation request is generated. After generating the third socket creation request, the first computing device can close other useless socket creation requests. In addition, the type parameter of the third socket creation request generated by the first computing device is different from the type parameter of the first socket creation request, and the protocol stack corresponding to the type parameter of the third socket creation request is the same as the protocol stack supported by the second computing device. For example, when the type parameter of the first socket creation request is AF_INET, the type parameter of the third socket creation request is AF_INET6; when the type parameter of the first socket creation request is AF_INET6, the type parameter of the third socket creation request is AF_INET.

[0225] Optionally, in the embodiment of the present application, the index of the socket creation request can be a file descriptor.

[0226] S805: Create a second socket according to the third socket creation request.

[0227] In an embodiment of the present application, the type parameter of the third socket creation request generated by the first computing device is different from the type parameter of the first socket creation request, and the protocol stack corresponding to the third socket creation request is the same as the protocol stack supported by the second computing device. The first computing device can create a second socket based on the third socket creation request, thereby ensuring that the protocol stack corresponding to the type parameter of the second socket is a protocol stack supported by the second computing device, so that the first computing device can access the second computing device through the network based on the second socket.

[0228] S806: Modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship.

[0229] In an embodiment of the present application, the first computing device may modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship, wherein the second IP address is the IP address of the second computing device under the second protocol stack.

[0230] For example, assuming the target application is an IPv4 application, the first IP address in the connection request is an IPv4 address, and the second computing device supports IPv6, the second IP address modified by the first computing device is an IPv6 address. For another example, assuming the target application is an IPv6 application, the first IP address in the connection request is an IPv6 address, and the second computing device supports IPv4, the second IP address modified by the first computing device is an IPv4 address.

[0231] Through the network access method provided in the embodiment of the present application, since the index of the third socket creation request is the same as the index of the first socket creation request, after the first computing device generates the second socket and modifies the address in the connection request, it can continue the original connection request process based on the second socket and the second IP address in the modified connection request, and then establish a connection with the second computing device to achieve network access to the second computing device.

[0232] S807: Establish a connection with the second computing device based on the second socket and the connection request.

[0233] In an optional embodiment, the first computing device may select a fourth IP address from the plurality of IP addresses of the first computing device, where the protocol associated with the fourth IP address is the same as the protocol supported by the second computing device of the target application. The first computing device may establish a connection with the second computing device based on the second socket according to the fourth IP address and the second IP address in the connection request.

[0234] S808: Perform system call processing according to the second IP address.

[0235] Optionally, the system call processing includes reading a message from the second computing device, and / or sending a message to the second computing device.

[0236] Through the network access method provided by the embodiment of the present application, when the first computing device supports dual stack, the first computing device generates a new socket creation request and converts the IP address of the second computing device when determining that the preset address mapping relationship includes the target IP address requested by the connection request, thereby ensuring that the first computing device can accurately identify the business that requires network address conversion and establish a connection with the second computing device based on the accurate IP address.

[0237] Based on the structure of the computing device shown in Figure 3, the network access method provided by the embodiment of the present application is further described below from the interaction of various modules in the first computing device. Figure 9 is a flowchart of a network access method provided by an embodiment of the present application. The method can be executed by the target application, kernel network module, and conversion module in the first computing device. Referring to Figure 9, the method includes the following steps:

[0238] S901: The target application sends a first socket creation request to the kernel network module.

[0239] The first socket creation request is used to request the creation of a socket for accessing a target application in the second computing device. For example, if the target application is an IPv6 application, the type parameter of the first socket creation request is AF_INET6.

[0240] S902: The kernel network module creates a first socket according to the first socket creation request.

[0241] S903: The target application sends a connection request to the kernel network module.

[0242] Optionally, the connection request sent by the target application is used to request the first computing device to establish a connection with the second computing device. For example, the first IP address included in the connection request is 192.168.1.1.

[0243] S904: The kernel network module sends the connection request to the conversion module.

[0244] S905: The conversion module determines that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

[0245] S906: The conversion module sends a confirmation message to the kernel network module.

[0246] S907: The kernel network module closes the first socket and generates a third socket creation request.

[0247] The index of the third socket creation request is the same as the index of the first socket creation request, and the type parameter of the third socket creation request is different from the type parameter of the first socket creation request.

[0248] S908: The kernel network module generates a second socket according to the third socket creation request.

[0249] S909: The conversion module modifies the first IP address in the connection request into a second IP address according to a preset address mapping relationship.

[0250] For example, the conversion module modifies the first IP address 192.168.1.1 in the binding request into the second IP address FE80::1234::1:80.

[0251] S910: The conversion module sends the connection request with the modified address to the kernel network module.

[0252] S911: The kernel network module establishes a connection with the second computing device based on the second socket and the connection request.

[0253] S912: The kernel network module returns the execution result to the target application.

[0254] S913: The target application sends a write request to the kernel network module.

[0255] S914: The kernel network module sends a data packet to the second computing device according to the received write request.

[0256] S915: The target application sends a read request to the kernel network module.

[0257] S916: The kernel network module receives the data packet sent by the second computing device according to the received read request.

[0258] In addition, in some embodiments, the network access method provided by the embodiments of the present application can also be applied to network access between devices with multiple IP addresses under the same IP protocol stack. For example, the embodiments of the present application can also be used to implement network address translation between IPv4 addresses and IPv4 addresses, or between IPv6 addresses and IPv6 addresses. In this implementation, the conversion module also needs to pre-store the address mapping relationship and perform network address translation based on the address mapping relationship. The specific implementation can refer to the above embodiments and will not be repeated here.

[0259] Based on the above embodiments, the present application also provides a computing device 1000. As shown in Figure 10, the computing device 1000 includes: a bus 1002, a processor 1004, a memory 1006, and a communication interface 1008. The processor 1004, the memory 1006, and the communication interface 1008 communicate with each other via the bus 1002. The computing device 1000 can be a second computing device or a first computing device, and can be used to execute the functions performed by the second computing device or the first computing device in the network access method provided in the embodiment of the present application. It should be understood that the present application does not limit the number of processors and memories in the computing device 1000.

[0260] Bus 1002 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG10 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 1002 may include a path for transmitting information between various components of computing device 1000 (e.g., memory 1006, processor 1004, and communication interface 1008).

[0261] The processor 1004 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0262] Memory 1006 may include volatile memory, such as random access memory (RAM). Processor 1004 may also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD). It should be noted that the memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0263] Memory 1006 stores executable program code, and processor 1004 executes the executable program code to implement the functions performed by the first computing device or the second computing device, respectively, thereby implementing the network access method provided in the embodiments of the present application. In other words, memory 1006 stores instructions for executing the network access method. For example, memory 1006 in computing device 1000 stores instructions for executing the functions of the kernel network module and the conversion module.

[0264] The communication interface 1008 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1000 and other devices or a communication network.

[0265] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0266] As shown in Figure 11, the computing device cluster includes at least one computing device 1000. The memory 1006 in one or more computing devices 1000 in the computing device cluster may store the same instructions for executing the method of the embodiment of the present application.

[0267] In some possible implementations, the memory 1006 of one or more computing devices 1000 in the computing device cluster may also store partial instructions for executing the method of the embodiment of the present application. In other words, the combination of one or more computing devices 1000 can jointly execute the instructions for executing the method of the embodiment of the present application.

[0268] It should be noted that the memory 1006 in different computing devices 1000 in the computing device cluster can store different instructions, each for executing a portion of the functions performed by the first computing device or the second computing device in the above method embodiment. In other words, the instructions stored in the memory 1006 in different computing devices 1000 can implement the functions of one or more modules in the above-mentioned first computing device, or implement the functions of one or more modules in the above-mentioned second computing device.

[0269] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network (WAN) or a local area network (LAN), etc. FIG12 illustrates a possible implementation. As shown in FIG12 , two computing devices 1000A and 1000B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 1006 in the computing device 1000A stores instructions for executing the functions of a kernel network module. Simultaneously, the memory 1006 in the computing device 1000B stores instructions for executing the functions of a conversion module.

[0270] The present application also provides another computing device cluster. The connection relationship between the computing devices in this computing device cluster can be similar to the connection method of the computing device cluster described in Figures 11 and 12. However, the memory 1006 in one or more computing devices 1000 in this computing device cluster can store the same instructions for executing the network access method.

[0271] In some possible implementations, the memory 1006 of one or more computing devices 1000 in the computing device cluster may also store some instructions for executing the network access method. In other words, the combination of one or more computing devices 1000 can jointly execute the instructions for executing the network access method.

[0272] Based on the above embodiments, the present application further provides a computer program, which, when executed on a computer, enables the computer to execute the methods described in the embodiments of the present application.

[0273] Based on the above embodiments, the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the methods described in the embodiments of the present application.

[0274] Based on the above embodiments, the present application further provides a chip, which is used to read a computer program stored in a memory to implement the methods described in the embodiments of the present application.

[0275] Based on the above embodiments, the present application provides a chip system, which includes a processor for supporting a computer device to implement the various methods described in the embodiments of the present application. In one possible design, the chip system also includes a memory for storing the necessary programs and data for the computer device. The chip system can be composed of a chip or can include a chip and other discrete devices.

[0276] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0277] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or box in the flow chart and / or block diagram, as well as the combination of the flow chart and / or box in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more flow charts and / or one or more boxes in the block diagram.

[0278] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0279] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0280] Obviously, those skilled in the art may make various modifications and variations to this application without departing from the scope of protection of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A network access method, characterized in that: The method comprises: Receiving a first socket creation request initiated by a target application in a first computing device, wherein the first socket creation request is used to request creation of a socket for accessing a target application in a second computing device; Modifying a type parameter of the first socket creation request, and creating a socket based on the modified type parameter; the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the second computing device; receiving a connection request initiated by a target application in the first computing device, the connection request being used to request to establish a connection with the second computing device, the connection request including a first Internet Protocol IP address; Modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship; the first IP address belongs to a first protocol stack, and the second IP address is an IP address of the second computing device under a second protocol stack supported by the second computing device; A connection is established with the second computing device based on the socket and the connection request.

2. The method according to claim 1, characterized in that After creating the socket based on the modified type parameter and before receiving a connection request initiated by the target application in the first computing device, the method further includes: Receiving an address binding request initiated by a target application in the first computing device, the address binding request including a third IP address; modifying the third IP address in the address binding request to a fourth IP address according to a preset address mapping relationship; binding the fourth IP address and the socket according to the address binding request; wherein the third IP address belongs to the first protocol stack, and the fourth IP address is the IP address of the first computing device under the second protocol stack; The establishing a connection with the second computing device based on the socket and the connection request comprises: A connection is established with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

3. The method according to claim 2, characterized in that After receiving the address binding request initiated by the target application, and before modifying the first IP address in the address binding request to the second IP address according to a preset address mapping relationship, the method further includes: Determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

4. The method according to claim 1, characterized in that The establishing a connection with the second computing device based on the socket and the connection request comprises: Selecting a fourth IP address from the plurality of IP addresses of the first computing device, the fourth IP address belonging to the same protocol stack as the second IP address; A connection is established with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

5. The method according to any one of claims 1 to 4, characterized in that: After receiving the first socket creation request initiated by the target application and before modifying the type parameter of the first socket creation request, the method further includes: It is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

6. The method according to claim 5, characterized in that The preset application list is system preconfigured or user-defined; The preset address mapping relationship is system preconfigured or user-defined.

7. The method according to any one of claims 1 to 6, characterized in that: After receiving a connection request initiated by a target application in the first computing device, and before modifying the first IP address in the connection request to a second IP address according to a preset address mapping relationship, the method further includes: Determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

8. The method according to any one of claims 1 to 7, characterized in that: After establishing a connection with the second computing device based on the socket and the connection request, the method further includes: Performing system call processing according to the second IP address; The system call processing includes reading a message from the second computing device and / or sending a message to the second computing device.

9. The method according to any one of claims 1 to 8, characterized in that The first protocol stack is an IPv4 protocol stack, and the second protocol stack is an IPv6 protocol stack; or The first protocol stack is an IPv6 protocol stack, and the second protocol stack is an IPv4 protocol stack.

10. A network access method, characterized in that: The method comprises: receiving a second socket creation request initiated by a target application in a second computing device, wherein the second socket creation request is used to request creation of a socket for monitoring messages sent by a target application in another device; Modifying a type parameter of the second socket creation request, and creating a socket based on the modified type parameter; the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the first computing device corresponding to the target application; receiving an address binding request initiated by a target application in the second computing device, wherein the address binding request includes a first Internet Protocol IP address; The first IP address in the address binding request is modified to a second IP address according to a preset address mapping relationship; the first IP address belongs to a first protocol stack, and the second IP address is an IP address of the second computing device under the second protocol stack; the second protocol stack is a protocol stack supported by the first computing device corresponding to the target application; The socket and the second IP address are bound according to the address binding request.

11. The method according to claim 10, characterized in that After receiving a second socket creation request initiated by a target application in a second computing device and before modifying a type parameter of the second socket creation request, the method further includes: It is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

12. The method according to claim 11, characterized in that The preset application list is system preconfigured or user-defined; The preset address mapping relationship is system preconfigured or user-defined.

13. The method according to any one of claims 10 to 12, characterized in that: After receiving the address binding request initiated by the target application in the second computing device, and before modifying the first IP address in the address binding request to the second IP address according to a preset address mapping relationship, the method further includes: Determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

14. The method according to any one of claims 10 to 13, characterized in that: After binding the socket and the second IP address according to the address binding request, the method further includes: Performing system call processing according to the second IP address; The system call processing includes reading a message from the first computing device and / or sending a message to the first computing device.

15. The method according to any one of claims 10 to 14, characterized in that: The first protocol stack is an IPv4 protocol stack, and the second protocol stack is an IPv6 protocol stack; or The first protocol stack is an IPv6 protocol stack, and the second protocol stack is an IPv4 protocol stack.

16. A network access method, characterized in that: The method comprises: Receiving a first socket creation request initiated by a target application in a first computing device, wherein the first socket creation request is used to request creation of a socket for accessing a target application in a second computing device; Creating a first socket according to the first socket creation request; Receive a connection request initiated by a target application in the first computing device, the connection request being used to request a connection with the second computing device Establishing a connection, the connection request comprising a first Internet Protocol IP address; the first IP address belongs to a first protocol stack; Determine that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address; the second IP address is an IP address of the second computing device under a second protocol stack supported by the second computing device; Closing the first socket, generating a third socket creation request, wherein the index of the third socket creation request is the same as the index of the first socket creation request, and the type parameter of the third socket creation request is different from the type parameter of the first socket creation request, and the protocol stack corresponding to the type parameter of the third socket creation request is the same as the protocol stack supported by the second computing device; Creating a second socket according to the third socket creation request; Modifying the first IP address in the connection request to a second IP address according to the preset address mapping relationship; the protocol stack to which the second IP address belongs is the same as the protocol stack supported by the second computing device; A connection is established with the second computing device based on the second socket and the connection request.

17. The method according to claim 16, characterized in that Before generating the third socket creation request, the method further includes: It is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

18. The method according to claim 17, characterized in that The preset application list is system preconfigured or user-defined; The preset address mapping relationship is system preconfigured or user-defined.

19. The method according to any one of claims 16 to 18, characterized in that: After establishing a connection with the second computing device based on the second socket and the connection request, the method further includes: Performing system call processing based on the second IP address; The system call processing includes reading a message from the second computing device and / or sending a message to the second computing device.

20. The method according to any one of claims 16 to 19, characterized in that: The generating of the third socket creation request comprises: The socket creation requests are generated in sequence according to the index arrangement order until the third socket creation request is generated.

21. A computing device, characterized in that The computing device comprises: A kernel network module, configured to receive a first socket creation request initiated by a target application, wherein the first socket creation request is used to request creation of a socket for accessing the target application in a second computing device; a conversion module, configured to modify a type parameter of the first socket creation request, wherein the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the second computing device; The kernel network module is further used to create a socket based on the modified type parameter; receive a connection request initiated by the target application, the connection request is used to request to establish a connection with the second computing device, the connection request includes a first Internet Protocol IP address, and the first IP address belongs to the first protocol stack; The conversion module is also used to modify the first IP address in the connection request to a second IP address according to a preset address mapping relationship; the second IP address is an IP address of the second computing device under a second protocol stack supported by the second computing device; The kernel network module is further configured to establish a connection with the second computing device based on the socket and the connection request.

22. The device according to claim 21, characterized in that The kernel network module is further used to: after creating a socket based on the modified type parameter and before receiving a connection request initiated by the target application, receive an address binding request initiated by the target application, the address binding request including a third IP address, and the third IP address belongs to the first protocol stack; The conversion module is further used to: modify the third IP address in the address binding request to a fourth IP address according to a preset address mapping relationship; the fourth IP address is the IP address of the first computing device under the second protocol stack; The kernel network module is further used for: binding the fourth IP address and the socket according to the address binding request; When the kernel network module establishes a connection with the second computing device based on the socket and the connection request, it is specifically used to: A connection is established with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

23. The device according to claim 22, characterized in that The conversion module is also used for: After receiving the address binding request initiated by the target application, before modifying the third IP address in the address binding request to a fourth IP address according to a preset address mapping relationship, determine that the preset address mapping relationship includes a mapping relationship between the third IP address and the fourth IP address.

24. The device according to claim 21, characterized in that The kernel network module is specifically used for: Selecting a fourth IP address from the plurality of IP addresses of the computing device, the fourth IP address belonging to the same protocol stack as the second IP address; A connection is established with the second computing device based on the socket according to the fourth IP address and the second IP address in the connection request.

25. The device according to any one of claims 22 to 24, characterized in that The conversion module is also used for: After receiving a first socket creation request initiated by a target application, before modifying a type parameter of the first socket creation request, it is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

26. The device according to any one of claims 21 to 25, characterized in that The conversion module is also used for: After receiving the connection request initiated by the target application, before modifying the first IP address in the connection request to the second IP address according to the preset address mapping relationship, it is determined that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

27. The device according to any one of claims 21 to 26, characterized in that The kernel network module is also used to: After establishing a connection with the second computing device based on the socket and the connection request, performing system call processing according to the second IP address; The system call processing includes reading a message from the second computing device and / or sending a message to the second computing device.

28. A computing device, characterized in that The computing device comprises: A kernel network module, configured to receive a second socket creation request initiated by a target application, wherein the second socket creation request is used to request the creation of a socket for monitoring messages sent by the target application in other devices; a conversion module, configured to modify a type parameter of the second socket creation request, wherein the protocol stack corresponding to the modified type parameter is the same as the protocol stack supported by the first computing device; The kernel network module is also used to create a socket based on the modified type parameter; receive an address binding request initiated by the target application, the address binding request including a first server Internet Protocol IP address; The conversion module is further used to modify the first IP address in the address binding request to a second IP address according to a preset address mapping relationship; the first IP address belongs to a first protocol stack, and the second IP address is an IP address of the second computing device under the second protocol stack; the second protocol stack is a protocol stack supported by the first computing device corresponding to the target application; The kernel network module is also used to bind the socket and the second IP address according to the address binding request.

29. The device according to claim 28, characterized in that The kernel network module is also used to: After receiving a second socket creation request initiated by a target application and before modifying a type parameter of the second socket creation request, it is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

30. The device according to claim 28 or 29, characterized in that The conversion module is also used for: After receiving the address binding request initiated by the target application, before modifying the first IP address in the address binding request to the second IP address according to the preset address mapping relationship, it is determined that the preset address mapping relationship includes a mapping relationship between the first IP address and the second IP address.

31. The device according to any one of claims 28 to 30, characterized in that The kernel network module is also used to: After binding the socket and the second IP address according to the address binding request, performing system call processing according to the second IP address; The system call processing includes reading a message from the first computing device and / or sending a message to the first computing device.

32. A computing device, characterized in that The computing device comprises: A kernel network module, for receiving a first socket creation request initiated by a target application, the first socket creation request being used to request the creation of a socket for accessing a target application in a second computing device; creating a first socket according to the first socket creation request; receiving a connection request initiated by the target application, the connection request being used to request the establishment of a connection with the second computing device, the connection request comprising a first server Internet Protocol IP address, the first IP address belonging to a first protocol stack; determining that a preset address mapping relationship includes a mapping relationship between the first IP address and a second IP address, the second IP address being the IP address of the second computing device under a second protocol stack supported by the second computing device; closing the first socket, generating a third socket creation request, the index of the third socket creation request being the same as the index of the first socket creation request, and the type parameter of the third socket creation request being different from the type parameter of the first socket creation request, the protocol stack corresponding to the type parameter of the third socket creation request being the same as the protocol stack supported by the second computing device; creating a second socket according to the third socket creation request; A conversion module, configured to modify the first IP address in the connection request to a second IP address according to the preset address mapping relationship; the protocol stack to which the second IP address belongs is the same as the protocol stack supported by the second computing device; The kernel network module is further configured to establish a connection with the second computing device based on the second socket and the connection request.

33. The device according to claim 32, characterized in that The conversion module is also used for: Before generating the third socket creation request, it is determined that the target application belongs to a preset application list, and the applications in the preset application list are applications that require network address translation.

34. The device according to claim 32 or 33, characterized in that The kernel network module is also used to: After establishing a connection with the second computing device based on the second socket and the connection request, performing system call processing based on the second IP address; The system call processing includes reading a message from the second computing device and / or sending a message to the second computing device.

35. The device according to any one of claims 32 to 34, characterized in that The kernel network module is specifically used for: The socket creation requests are generated in sequence according to the index arrangement order until the third socket creation request is generated.

36. A computing device, characterized in that The computing device includes a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the computing device executes the method according to any one of claims 1 to 9, or executes the method according to any one of claims 10 to 15, or executes the method according to any one of claims 16 to 20.

37. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1-9, or executes the method according to any one of claims 10-15, or executes the method according to any one of claims 16-20.

38. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device, the computing device executes the method according to any one of claims 1 to 9, or executes the method according to any one of claims 10 to 15, or executes the method according to any one of claims 16 to 20.

39. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method according to any one of claims 1 to 9, or executes the method according to any one of claims 10 to 15, or executes the method according to any one of claims 16 to 20.

Citation Information

Patent Citations

  • Multi-protocol-stack load balancing method and multi-protocol-stack load balancing device

    CN104639578A

  • IP address modification method and device, electronic equipment and computer readable medium

    CN112187964A

  • Customer premise equipment and network address translation method using same

    US20140079066A1

  • Binding multiple addresses to a socket in a network system

    US20140156857A1

  • Networking-related system call interception and modification

    US20220012110A1

Cited By

  • Protocol stack attribute modification method and device

    CN119676326A

  • Communication method and device of power protocol, storage medium and electronic equipment

    CN119766903A

  • Communication method, device, storage medium and electronic equipment of power protocol

    CN119766903B

  • Vehicle sensor control method and device, medium, product and vehicle

    CN119922213A

  • Network communication method

    TWI944489B