CN109922164B - Address translation method and device and computer storage medium - Google Patents
Address translation method and device and computer storage medium Download PDFInfo
- Publication number
- CN109922164B CN109922164B CN201910111568.3A CN201910111568A CN109922164B CN 109922164 B CN109922164 B CN 109922164B CN 201910111568 A CN201910111568 A CN 201910111568A CN 109922164 B CN109922164 B CN 109922164B
- Authority
- CN
- China
- Prior art keywords
- address
- data packet
- type
- mac
- data message
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本申请实施例公开了一种地址转换方法、装置以及计算机存储介质,该方法应用于终端设备,该方法包括:在开启终端设备的桥接模式之后,接收数据报文,所述桥接模式用于实现终端设备的无线局域网WLAN共享;根据接收到的数据报文,确定所述数据报文的类型,所述数据报文的类型包括通过终端设备的客户端client接口向网络侧转发数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的数据报文所对应的第二类型;当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;根据所述地址转换生成新的数据报文后,发送所述新的数据报文。
The embodiments of the present application disclose an address translation method, an apparatus, and a computer storage medium. The method is applied to a terminal device, and the method includes: after enabling a bridge mode of the terminal device, receiving a data packet, and the bridge mode is used to realize The wireless local area network WLAN of the terminal device is shared; the type of the data packet is determined according to the received data packet, and the type of the data packet includes the corresponding data packet forwarded to the network side through the client interface of the terminal device The first type and the second type corresponding to the data packet forwarded from the network side received through the client interface; when the type of the data packet is the first type, the transmission in the data packet is Perform address translation on the address; when the type of the data message is the second type, perform address translation on the receiving address in the data message; after generating a new data message according to the address translation, send the new data message data packets.
Description
技术领域technical field
本申请涉及无线通信技术领域,尤其涉及一种地址转换方法、装置以及计算机存储介质。The present application relates to the field of wireless communication technologies, and in particular, to an address translation method, apparatus, and computer storage medium.
背景技术Background technique
随着智能终端应用的不断发展,无线局域网(Wireless Local Area Networks,WLAN)热点功能已经成为智能终端的标配模块之一。而无线保真(Wireless Fidelity,WiFi)作为WLAN技术中的一种无线接入方式,打开智能终端的WLAN热点功能,智能终端将WiFi网络通过热点功能分享给其他用户(简称为WLAN共享),使得其他无线站点(Station,STA)的终端设备可以连接并访问网络。With the continuous development of intelligent terminal applications, a wireless local area network (Wireless Local Area Networks, WLAN) hotspot function has become one of the standard modules of an intelligent terminal. Wireless Fidelity (WiFi), as a wireless access method in WLAN technology, enables the WLAN hotspot function of the smart terminal, and the smart terminal shares the WiFi network with other users through the hotspot function (referred to as WLAN sharing), so that Terminal devices of other wireless stations (Station, STA) can connect to and access the network.
对其他无线站点而言,需要经过网络地址转换(Network Address Translation,NAT)以及客户端(client)接口才能访问远端网络。在现有的网络访问过程中,一方面NAT转换需要消耗中央处理器(Central Processing Unit,CPU)资源,而CPU资源紧张时会影响无线吞吐量;另一方面软无线接入点(Soft Access Point,Soft AP)还必须设置有动态主机设置协议服务器(Dynamic Host Configuration Protocol Server,DHCP Server)服务并维护本地IP地址资源,同时Soft AP还需要避免与无线路由接入点(Root Access Point,Root AP)之间的网关冲突。For other wireless stations, it needs to go through a network address translation (Network Address Translation, NAT) and a client (client) interface to access the remote network. In the existing network access process, on the one hand, NAT translation needs to consume the resources of the Central Processing Unit (CPU), and the wireless throughput will be affected when the CPU resources are tight; on the other hand, the Soft Access Point (Soft Access Point) , Soft AP) must also be provided with Dynamic Host Configuration Protocol Server (Dynamic Host Configuration Protocol Server, DHCP Server) service and maintain local IP address resources, while Soft AP also needs to avoid wireless routing access point (Root Access Point, Root AP) ) between gateway conflicts.
发明内容SUMMARY OF THE INVENTION
本申请的主要目的在于提出一种地址转换方法、装置以及计算机存储介质,通过在client驱动端中增加地址转换引擎(Address Translation Engine,ATE)机制以实现地址转换和地址转换表的更新维护,有效解决了现有方案所带来的CPU资源消耗和网关冲突问题,更好地实现了桥接模式下的WLAN共享。The main purpose of this application is to propose an address translation method, device and computer storage medium, by adding an address translation engine (Address Translation Engine, ATE) mechanism in the client driver to realize the update and maintenance of address translation and address translation table, effectively The problem of CPU resource consumption and gateway conflict caused by the existing solution is solved, and the WLAN sharing in the bridge mode is better realized.
为达到上述目的,本申请的技术方案是这样实现的:In order to achieve the above-mentioned purpose, the technical scheme of the present application is achieved in this way:
第一方面,本申请实施例提供了一种地址转换方法,所述方法应用于终端设备,所述方法包括:In a first aspect, an embodiment of the present application provides an address translation method, the method is applied to a terminal device, and the method includes:
在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;After the bridging mode of the terminal device is enabled, a data packet is received; wherein the bridging mode is used to realize WLAN sharing of the terminal device;
根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;Determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes the first type corresponding to the data packet forwarded to the network side through the client interface of the terminal device and the The client interface receives the second type corresponding to the data message forwarded from the network side;
当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;When the type of the data packet is the first type, perform address translation on the sending address in the data packet; when the type of the data packet is the second type, perform address translation on the sending address in the data packet. Receive address for address translation;
根据所述地址转换生成新的数据报文后,发送所述新的数据报文。After a new data packet is generated according to the address translation, the new data packet is sent.
第二方面,本申请实施例提供了一种地址转换装置,所述地址转换装置应用于终端设备,所述地址转换装置包括:接收单元、、确定单元、转换单元和发送单元,其中,In a second aspect, an embodiment of the present application provides an address conversion apparatus, the address conversion apparatus is applied to a terminal device, and the address conversion apparatus includes: a receiving unit, a determining unit, a converting unit, and a sending unit, wherein,
所述接收单元,配置为在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;The receiving unit is configured to receive the data packet after enabling the bridge mode of the terminal device; wherein the bridge mode is used to realize WLAN sharing of the terminal device;
所述确定单元,配置为根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;The determining unit is configured to determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes the type of the data packet that is forwarded to the network side through the client interface of the terminal device. The corresponding first type and the second type corresponding to the data message forwarded from the network side received through the client interface;
所述转换单元,配置为当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;The conversion unit is configured to perform address translation on the sending address in the data packet when the type of the data packet is the first type; when the type of the data packet is the second type, perform address translation on the sending address of the data packet. performing address translation on the receiving address in the data message;
所述发送单元,配置为根据所述地址转换生成新的数据报文后,发送所述新的数据报文。The sending unit is configured to send the new data message after generating the new data message according to the address translation.
第三方面,本申请实施例提供了一种地址转换装置,所述地址转换装置包括:存储器和处理器;其中,In a third aspect, an embodiment of the present application provides an address translation device, where the address translation device includes: a memory and a processor; wherein,
所述存储器,用于存储能够在所述处理器上运行的计算机程序;the memory for storing a computer program executable on the processor;
所述处理器,用于在运行所述计算机程序时,执行如第一方面所述方法的步骤。The processor is configured to execute the steps of the method according to the first aspect when running the computer program.
第四方面,本申请实施例提供了一种计算机存储介质,所述计算机存储介质存储有地址转换程序,所述地址转换程序被至少一个处理器执行时实现如第一方面所述方法的步骤。In a fourth aspect, an embodiment of the present application provides a computer storage medium, where an address translation program is stored in the computer storage medium, and when the address translation program is executed by at least one processor, the steps of the method described in the first aspect are implemented.
本申请实施例所提供的一种地址转换方法、装置以及计算机存储介质,该方法应用于终端设备,在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;然后根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;最后根据所述地址转换生成新的数据报文后,发送所述新的数据报文;这样,由于终端设备采用桥接模式来实现WLAN共享,而且在终端设备的client接口中增加了ATE机制以实现数据报文中的发送地址或者接收地址的地址转换,从而有效解决了现有方案所带来的CPU资源消耗和网关冲突问题,更好地实现了WLAN共享。An address translation method, device, and computer storage medium provided by the embodiments of the present application are applied to a terminal device, and after a bridge mode of the terminal device is enabled, a data packet is received; wherein, the bridge mode is used to realize all WLAN sharing of the terminal device; then determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes forwarding the data packet to the network side through the client interface of the terminal device The corresponding first type and the second type corresponding to the data packet forwarded from the network side received through the client interface; when the type of the data packet is the first type, address conversion is performed on the sending address in the text; when the type of the data message is the second type, address conversion is performed on the receiving address in the data message; finally, a new data message is generated according to the address conversion , send the new data message; in this way, because the terminal device adopts the bridge mode to realize WLAN sharing, and the ATE mechanism is added in the client interface of the terminal device to realize the address translation of the sending address or the receiving address in the data message , thereby effectively solving the problem of CPU resource consumption and gateway conflict caused by the existing solution, and better realizing WLAN sharing.
附图说明Description of drawings
图1为相关技术方案提供的一种常见网络拓扑的组成结构示意图;FIG. 1 is a schematic diagram of the composition structure of a common network topology provided by a related technical solution;
图2为本申请实施例提供的一种地址转换方法的流程示意图;2 is a schematic flowchart of an address translation method provided by an embodiment of the present application;
图3为本申请实施例提供的一种桥接模式网络拓扑的组成结构示意图;3 is a schematic structural diagram of a bridge mode network topology provided by an embodiment of the present application;
图4为本申请实施例提供的另一种桥接模式网络拓扑的组成结构示意图;FIG. 4 is a schematic diagram of the composition structure of another bridge mode network topology provided by an embodiment of the present application;
图5为本申请实施例提供的一种地址转换表的组成结构示意图;5 is a schematic diagram of a composition structure of an address translation table provided by an embodiment of the present application;
图6为本申请实施例提供的一种地址转换装置的组成结构示意图;6 is a schematic diagram of the composition and structure of an address translation device provided by an embodiment of the present application;
图7为本申请实施例提供的一种地址转换装置的具体硬件结构示意图;7 is a schematic diagram of a specific hardware structure of an address translation device provided by an embodiment of the present application;
图8为本申请实施例提供的一种终端设备的组成结构示意图。FIG. 8 is a schematic diagram of the composition and structure of a terminal device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
随着智能终端和移动互联网应用的快速发展,使得移动数据流量正在以难以估量的速度激增。为了有效缓解流量压力、持续推动移动通信业务的发展,全球越来越多的运营商选择大力发展WLAN技术。由于WLAN具有速度快、可移动、易扩展和成本低等特点,目前几乎所有的终端设备都将WLAN技术作为基本的配置。这样,打开终端设备的WLAN热点功能,终端设备作为移动热点,可以供一定覆盖范围内的其他用户连接使用。With the rapid development of smart terminals and mobile Internet applications, mobile data traffic is increasing at an inestimable speed. In order to effectively relieve traffic pressure and continue to promote the development of mobile communication services, more and more operators around the world choose to vigorously develop WLAN technology. Because WLAN has the characteristics of high speed, mobility, easy expansion and low cost, almost all terminal devices at present take WLAN technology as the basic configuration. In this way, the WLAN hotspot function of the terminal device is turned on, and the terminal device, as a mobile hotspot, can be used by other users within a certain coverage area.
其中,WiFi Tehering在终端设备中应用非常广泛,主要是将WiFi网络通过热点功能分享给其他用户,也可以称为WLAN共享。利用WLAN共享,可以使得其他终端设备能够连接并访问网络,而常见的WiFi Tehering网络拓扑的组成结构示例如图1所示。在图1所示的网络拓扑结构中,该拓扑结构包括无线路由器接入点(用Root AP表示)、具备热点功能的终端设备(用STA0表示)和周围无线接入站点(用STA1表示),STA0还包括客户端(Client)接口和软无线接入点(Soft AP)接口;其中,STA0通过Client接口与Root AP连接以访问网络,而STA1通过Soft AP接口与STA0实现WLAN共享以访问网络;而STA1要访问网络则必须经过NAT转换(包括在STA0中的源地址转换(Source NAT,SNAT)和目的地址转换(Destination NAT,DNAT))以及Client接口才能访问远端网络(比如Root AP)。Among them, WiFi Tehering is widely used in terminal devices, mainly sharing the WiFi network to other users through the hotspot function, which can also be called WLAN sharing. Using WLAN sharing, other terminal devices can connect to and access the network, and an example of the composition of a common WiFi Tehering network topology is shown in Figure 1. In the network topology shown in Figure 1, the topology includes a wireless router access point (represented by Root AP), a terminal device with a hotspot function (represented by STA0) and surrounding wireless access sites (represented by STA1), STA0 also includes a client (Client) interface and a soft wireless access point (Soft AP) interface; wherein, STA0 is connected to the Root AP through the Client interface to access the network, and STA1 implements WLAN sharing with STA0 through the Soft AP interface to access the network; To access the network, STA1 must go through NAT translation (including the source address translation (Source NAT, SNAT) and destination address translation (Destination NAT, DNAT) in STA0) and the Client interface to access the remote network (such as Root AP).
基于图1所示的网络拓扑结构,在Root AP中,网关(Gateway)假定为192.168.0.1,DHCP Server假定为192.168.0.100/200,Root AP对应的基本服务集标识符(BasicService Set Identifier,BSSID)用RootAP-BSSID表示,BSSID实际上表示为Root AP的MAC地址,用来标识Root AP侧所管理的基本服务集(Basic Service Se,BSS),RootAP-BSSID假定为xx:xx:xx:xx:xx:x0;在STA0中,对于Client接口侧,Client接口对应的媒体接入控制(Media Access Control,MAC)地址用Client-MAC表示,Client-MAC假定为xx:xx:xx:xx:xx:x4,Client接口对应的互联网协议(Internet Protocol,IP)地址用Client-IP表示,Client-IP假定为192.168.0.100;对于Soft AP接口侧,网关(Gateway)假定为192.168.43.1,DHCP Server假定为192.168.43.100/200,AP-BSSID假定为xx:xx:xx:xx:xx:x3;在STA1中,STA1对应的MAC地址用STA1-MAC表示,STA1-MAC假定为xx:xx:xx:xx:xx:x1,STA1对应的IP地址用STA1-IP表示,STA1-IP假定为192.168.43.100。Based on the network topology shown in Figure 1, in the Root AP, the Gateway (Gateway) is assumed to be 192.168.0.1, the DHCP Server is assumed to be 192.168.0.100/200, and the Basic Service Set Identifier (BSSID) corresponding to the Root AP ) is represented by RootAP-BSSID, BSSID is actually represented as the MAC address of the Root AP, which is used to identify the basic service set (Basic Service Se, BSS) managed by the Root AP side, and the RootAP-BSSID is assumed to be xx:xx:xx:xx :xx:x0; In STA0, for the Client interface side, the Media Access Control (MAC) address corresponding to the Client interface is represented by Client-MAC, and Client-MAC is assumed to be xx:xx:xx:xx:xx :x4, the Internet Protocol (IP) address corresponding to the Client interface is represented by Client-IP, which is assumed to be 192.168.0.100; for the Soft AP interface side, the gateway (Gateway) is assumed to be 192.168.43.1, and the DHCP Server is assumed to be 192.168.43.100/200, AP-BSSID is assumed to be xx:xx:xx:xx:xx:x3; in STA1, the MAC address corresponding to STA1 is represented by STA1-MAC, and STA1-MAC is assumed to be xx:xx:xx: xx:xx:x1, the IP address corresponding to STA1 is represented by STA1-IP, which is assumed to be 192.168.43.100.
具体来说,STA0通过开启WiFi Tehering热点功能可以实现WLAN共享,而STA0的一个网络接口(即Client接口)与Root AP连接,并且从Root AP的DHCP Server中获取到Client-IP为192.168.0.100,然后STA0可以通过Client接口访问无线网络;而STA0的另一网络接口(即Soft AP接口)则以接入点方式提供给周围无线站点(比如STA1),然后STA1从Soft AP中的DHCP Server获取到相应的STA1-IP为192.168.43.100,这样STA1也就可以实现网络访问。根据图1所示的网络拓扑结构,若STA1要访问远端网络,则必须经过NAT转换以及通过Client接口才能访问远端网络;但是图1所示的网络拓扑结构中仍然存在以下缺陷:一方面NAT转换需要在协议栈进行而会消耗CPU资源,尤其是CPU资源紧张时会影响无线吞吐量;另一方面Soft AP侧必须设置有DHCP Server服务并维护本地IP地址资源,同时由于Soft AP侧网关的设置与Root AP侧不同,还需要避免网关冲突。Specifically, STA0 can realize WLAN sharing by enabling the WiFi Tehering hotspot function, and a network interface (ie Client interface) of STA0 is connected to the Root AP, and the Client-IP obtained from the DHCP Server of the Root AP is 192.168.0.100. Then STA0 can access the wireless network through the Client interface; and another network interface (ie Soft AP interface) of STA0 is provided to the surrounding wireless stations (such as STA1) in the form of access points, and then STA1 obtains from the DHCP Server in the Soft AP. The corresponding STA1-IP is 192.168.43.100, so that STA1 can also access the network. According to the network topology shown in Figure 1, if STA1 wants to access the remote network, it must go through NAT conversion and through the Client interface to access the remote network; but the network topology shown in Figure 1 still has the following defects: NAT conversion needs to be performed in the protocol stack, which will consume CPU resources, especially when the CPU resources are tight, which will affect the wireless throughput; on the other hand, the Soft AP side must be provided with a DHCP Server service and maintain local IP address resources. At the same time, because the Soft AP side gateway The settings are different from those on the Root AP side, and gateway conflicts need to be avoided.
为了解决上述的缺陷问题,本申请实施例提供了一种地址转换方法,该方法应用于具有桥接(bridge)模式的终端设备,在开启终端设备的桥接模式之后,首先接收数据报文;然后根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;最后根据所述地址转换生成新的数据报文后,发送所述新的数据报文;由于终端设备采用桥接模式来实现WLAN共享,而且在终端设备的client接口中增加了ATE机制以实现数据报文中的发送地址或者接收地址的地址转换,从而有效解决了现有方案所带来的CPU资源消耗和网关冲突问题,更好地实现了WLAN共享。In order to solve the above-mentioned defects, an embodiment of the present application provides an address translation method, which is applied to a terminal device with a bridge mode. After the bridge mode of the terminal device is turned on, a data packet is first received; For the received data message, determine the type of the data message; wherein, the type of the data message includes the first type corresponding to the data message forwarded to the network side through the client interface of the terminal device and the first type corresponding to the data message forwarded through the client interface of the terminal device. The client interface receives the second type corresponding to the data packet forwarded from the network side; when the type of the data packet is the first type, address translation is performed on the sending address in the data packet; When the type of the data packet is the second type, perform address translation on the receiving address in the data packet; finally, after generating a new data packet according to the address translation, send the new data packet ;Because the terminal device adopts the bridge mode to realize WLAN sharing, and the ATE mechanism is added to the client interface of the terminal device to realize the address translation of the sending address or the receiving address in the data message, thus effectively solving the problems brought by the existing solution. The problem of CPU resource consumption and gateway conflict is better to achieve WLAN sharing.
下面将结合附图对本申请各实施例进行详细描述。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
参见图2,其示出了本申请实施例提供的一种地址转换方法,该方法应用于终端设备,该方法可以包括:Referring to FIG. 2, it shows an address translation method provided by an embodiment of the present application, the method is applied to a terminal device, and the method may include:
S201:在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;S201: After enabling the bridge mode of the terminal device, receive a data packet; wherein the bridge mode is used to implement WLAN sharing of the terminal device;
S202:根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;S202: Determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes a first type corresponding to forwarding the data packet to the network side through the client interface of the terminal device and receiving the second type corresponding to the data message forwarded from the network side through the client interface;
S203:当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;S203: When the type of the data packet is the first type, perform address translation on the sending address in the data packet; when the type of the data packet is the second type, perform address translation on the data packet The receiving address in the address is converted;
S204:根据所述地址转换生成新的数据报文后,发送所述新的数据报文。S204: After generating a new data packet according to the address translation, send the new data packet.
需要说明的是,本申请实施例所传输的数据报文,并不局限于数据信息,还可以是请求信息,甚至是其他类型信息,本申请实施例不作具体限定。It should be noted that the data message transmitted by the embodiments of the present application is not limited to data information, but may also be request information, or even other types of information, which are not specifically limited in the embodiments of the present application.
还需要说明的是,桥接模式(也称为bridge模式)是利用终端设备的桥接功能,可以与网络侧(比如无线路由器、基站等)建立无线连接,从而由终端设备自身发出新的无线信号以形成新的无线覆盖范围,有效解决了信号弱及信号盲点的无线覆盖问题。也就是说,终端设备通过采用桥接模式可以实现WLAN共享;这样,终端设备与网络侧的无线路由器之间建立网络连接以访问远端网络,而周围无线站点(比如第一无线站点和第二无线站点)通过WLAN共享也可以访问网络并进行数据交互通信。It should also be noted that the bridge mode (also called bridge mode) uses the bridging function of the terminal device to establish a wireless connection with the network side (such as a wireless router, base station, etc.), so that the terminal device itself sends out a new wireless signal to A new wireless coverage area is formed, which effectively solves the wireless coverage problem of weak signal and signal blind spots. That is to say, the terminal device can realize WLAN sharing by adopting the bridge mode; in this way, a network connection is established between the terminal device and the wireless router on the network side to access the remote network, while the surrounding wireless stations (such as the first wireless station and the second wireless station) station) can also access the network and perform data interactive communication through WLAN sharing.
可以理解地,在WLAN共享中,无线站点之间的数据传输采用IEEE 802.11协议的规定。其中,IEEE 802.11是无线局域网通用的标准协议。根据IEEE 802.11协议的规定,针对数据报文的帧格式,一般是采用MAC帧格式。参见表1,其示出了本申请实施例提供的一种基础型MAC帧格式的组成结构示例;如表1所示,MAC帧中包含有Address1,Address2,Address3,Address4等4个地址字段,其中,Address1固定表示为接收地址(ReceiverAddress,RA),Address2固定表示为发送地址(Transmitter Address,TA),Address3取决于MAC帧所使用的网络类型,用于提供接入点与分布式系统(Distributed System,DS)的过滤之用,Address4暂未使用。在某些情况下,接收地址可以为目的地址(DestinationAddress,Dest Address或者DA),发送地址可以为源地址(Source Address,SA),但本申请实施例不作具体限定。另外,MAC帧中还包含有To DS和From DS等字段;其中,To DS:1表示从无线站点STA侧发送到无线路由器AP侧的MAC帧,1表示其他MAC帧;From DS:1表示来自于无线路由器AP侧的MAC帧,0表示其他MAC帧。Understandably, in WLAN sharing, the data transmission between wireless stations adopts the stipulations of the IEEE 802.11 protocol. Among them, IEEE 802.11 is a standard protocol commonly used in wireless local area networks. According to the stipulations of the IEEE 802.11 protocol, for the frame format of the data message, the MAC frame format is generally used. Referring to Table 1, it shows an example of the composition structure of a basic MAC frame format provided by the embodiment of the present application; as shown in Table 1, the MAC frame contains 4 address fields such as Address1, Address2, Address3, and Address4. Among them, Address1 is fixedly expressed as the receiving address (ReceiverAddress, RA), Address2 is fixedly expressed as the transmitting address (Transmitter Address, TA), and Address3 depends on the network type used by the MAC frame to provide access points and distributed systems (Distributed system). System, DS) for filtering, Address4 has not been used yet. In some cases, the receiving address may be a destination address (DestinationAddress, Dest Address or DA), and the sending address may be a source address (Source Address, SA), which is not specifically limited in this embodiment of the present application. In addition, the MAC frame also includes fields such as To DS and From DS; among them, To DS: 1 indicates the MAC frame sent from the wireless station STA side to the wireless router AP side, 1 indicates other MAC frames; From DS: 1 indicates that from The MAC frame on the AP side of the wireless router, 0 means other MAC frames.
表1Table 1
根据表1可以看出,当MAC帧由无线站点STA侧发送至无线路由器AP侧时(即ToAP),此时To DS为1,From DS为0,Address1可以设置为AP侧对应的BSSID,其中,BSSID实际上表示为AP的MAC地址;Address2可以设置为STA的MAC地址(用SA表示),Address3表示MAC帧所发送的目的地址(用DA表示),若MAC帧所发送的目的地址为AP侧,则Address3可以等于Address1;It can be seen from Table 1 that when the MAC frame is sent from the wireless station STA side to the wireless router AP side (that is, ToAP), at this time To DS is 1, From DS is 0, and Address1 can be set to the BSSID corresponding to the AP side, where , BSSID actually represents the MAC address of the AP; Address2 can be set to the MAC address of the STA (represented by SA), Address3 represents the destination address sent by the MAC frame (represented by DA), if the destination address sent by the MAC frame is the AP side, then Address3 can be equal to Address1;
当MAC帧由无线路由器AP侧发送至无线站点STA侧时(即From AP),由于该MAC帧来源于DS,此时To DS为0,From DS为1,Address1可以设置为STA的MAC地址,即MAC帧所发送的目的地址(用DA表示);Address2可以设置为AP侧对应的BSSID,Address3表示MAC帧所发送的源地址,若MAC帧所发送的源地址为AP侧,则Address3可以等于Address2。When the MAC frame is sent from the AP side of the wireless router to the STA side of the wireless station (that is, From AP), since the MAC frame comes from the DS, the To DS is 0, the From DS is 1, and the Address1 can be set to the MAC address of the STA. That is, the destination address sent by the MAC frame (represented by DA); Address2 can be set to the BSSID corresponding to the AP side, and Address3 represents the source address sent by the MAC frame. If the source address sent by the MAC frame is the AP side, then Address3 can be equal to Address2.
参见图3,其示出了本申请实施例提供的一种桥接模式网络拓扑的组成结构示意图;如图3所示,该拓扑结构包括无线路由器接入点(用Root AP表示)、具备桥接模式的终端设备(用STA0表示)和周围无线接入站点(用STA1和STA2表示);其中,STA0包括Client接口和AP接口,而Client接口和AP接口位于同一个网桥(bridge)中;STA0、STA1和STA2都可以通过Root AP以访问网络,但是STA1访问网络时还需要STA0进行数据报文的转发。Referring to FIG. 3, it shows a schematic structural diagram of a bridge mode network topology provided by an embodiment of the present application; as shown in FIG. 3, the topology structure includes a wireless router access point (represented by Root AP), a bridge mode terminal equipment (represented by STA0) and surrounding wireless access sites (represented by STA1 and STA2); wherein, STA0 includes Client interface and AP interface, and Client interface and AP interface are located in the same bridge (bridge); STA0, Both STA1 and STA2 can access the network through the Root AP, but STA0 also needs to forward data packets when STA1 accesses the network.
基于图3所示的网络拓扑结构,在Root AP中,网关(Gateway)假定为192.168.0.1,DHCP Server假定为192.168.0.100/200,RootAP-BSSID假定为xx:xx:xx:xx:xx:x0;在STA0中,对于Client接口侧,Client接口对应的MAC地址用Client-MAC表示,Client-MAC假定为xx:xx:xx:xx:xx:x4,Client接口对应的IP地址用Client-IP表示,Client-IP假定为192.168.0.100;对于AP接口侧,AP-BSSID假定为xx:xx:xx:xx:xx:x3;在STA1中,STA1对应的MAC地址用STA1-MAC表示,STA1-MAC假定为xx:xx:xx:xx:xx:x1,STA1对应的IP地址用STA1-IP表示,STA1-IP假定为192.168.43.100。从图3中可以看出,本申请实施例中的STA0具备桥接模式,且STA0内的Client接口和AP接口位于同一个bridge中,此时STA0中已经无需进行DHCP Server和Soft AP网关的设置,从而也就避免了可能存在的网关冲突。Based on the network topology shown in Figure 3, in the Root AP, the Gateway (Gateway) is assumed to be 192.168.0.1, the DHCP Server is assumed to be 192.168.0.100/200, and the RootAP-BSSID is assumed to be xx:xx:xx:xx:xx: x0; In STA0, for the Client interface side, the MAC address corresponding to the Client interface is represented by Client-MAC, the Client-MAC is assumed to be xx:xx:xx:xx:xx:x4, and the IP address corresponding to the Client interface is Client-IP Indicates that the Client-IP is assumed to be 192.168.0.100; for the AP interface side, the AP-BSSID is assumed to be xx:xx:xx:xx:xx:x3; in STA1, the MAC address corresponding to STA1 is denoted by STA1-MAC, and STA1- The MAC is assumed to be xx:xx:xx:xx:xx:x1, the IP address corresponding to STA1 is represented by STA1-IP, and STA1-IP is assumed to be 192.168.43.100. As can be seen from FIG. 3 , STA0 in the embodiment of the present application has a bridge mode, and the Client interface and AP interface in STA0 are located in the same bridge. At this time, DHCP Server and Soft AP gateway settings in STA0 are no longer required. Thus, possible gateway conflicts are avoided.
在一些实施例中,在所述接收数据报文之前,所述方法还包括:In some embodiments, before the receiving the data message, the method further includes:
建立所述终端设备与网络侧的无线路由器之间的网络连接;establishing a network connection between the terminal device and the wireless router on the network side;
基于所述终端设备的桥接模式,控制第一无线站点和第二无线站点通过所述终端设备进行WLAN共享。Based on the bridge mode of the terminal device, the first wireless station and the second wireless station are controlled to perform WLAN sharing through the terminal device.
进一步地,在一些实施例中,所述接收数据报文,包括:Further, in some embodiments, the receiving the data message includes:
基于所述WLAN共享,判断所述数据报文是否符合WLAN协议的媒体接入控制MAC帧格式;Based on the WLAN sharing, determine whether the data packet conforms to the media access control MAC frame format of the WLAN protocol;
当所述数据报文符合WLAN协议的MAC帧格式时,接收所述数据报文;When the data packet conforms to the MAC frame format of the WLAN protocol, receiving the data packet;
在所述接收数据报文之后,所述方法还包括:After the receiving the data message, the method further includes:
在所述终端设备的网桥内,将MAC帧格式的数据报文转换为以太网帧格式的数据报文;其中,所述终端设备的网桥中包括client接口和无线接入点AP接口,所述以太网格式的数据报文用于在所述client接口和所述AP接口之间进行数据报文的交互。In the network bridge of the terminal device, the data message in the MAC frame format is converted into the data message in the Ethernet frame format; wherein, the network bridge of the terminal device includes a client interface and a wireless access point AP interface, The data packet in the Ethernet format is used for data packet interaction between the client interface and the AP interface.
进一步地,在一些实施例中,所述确定所述数据报文的类型,包括:Further, in some embodiments, the determining the type of the data packet includes:
当通过所述client接口向网络侧的无线路由器转发MAC帧格式的数据报文时,得到所述数据报文中的发送地址为第一无线站点的MAC地址,确定出所述数据报文的类型为第一类型;其中,所述第一类型的数据报文是由第一无线站点发送并通过所述终端设备的AP接口接收后转发到所述client接口;When forwarding the data message in the MAC frame format to the wireless router on the network side through the client interface, it is obtained that the sending address in the data message is the MAC address of the first wireless station, and the type of the data message is determined is the first type; wherein, the data packet of the first type is sent by the first wireless station and received through the AP interface of the terminal device and then forwarded to the client interface;
当通过所述client接口接收来自于网络侧的无线路由器转发的MAC帧格式的数据报文时,得到所述数据报文中的发送地址为无线路由器的MAC地址,确定出所述数据报文的类型为第二类型;其中,所述第二类型的数据报文是由第二无线站点发送并通过所述无线路由器转发到所述client接口。When receiving the data message in the MAC frame format forwarded by the wireless router on the network side through the client interface, it is obtained that the sending address in the data message is the MAC address of the wireless router, and the data message of the data message is determined. The type is the second type; wherein, the data packet of the second type is sent by the second wireless station and forwarded to the client interface through the wireless router.
需要说明的是,终端设备的client接口和AP接口位于同一个bridge中,此时终端设备内已经无需进行DHCP Server和Soft AP网关的设置,从而也就避免了可能存在的网关冲突。终端设备与无线路由器建立网络连接,而第一无线站点和第二无线站点通过终端设备的桥接模式能够进行数据交互通信。其中,第一无线站点所发送的数据报文或者由无线路由器侧所转发的数据报文均为MAC帧格式的数据报文,它是在空气中传播的数据包帧,可以称为Air Packet Frame;在bridge中会将MAC帧格式的数据报文转换为以太网帧格式的数据报文,它是在网桥中传播的数据包帧,此时也可以称为Bridge Packet Frame;然后该数据报文将以MAC帧格式的数据报文继续发送。It should be noted that the client interface and AP interface of the terminal device are located in the same bridge. At this time, there is no need to configure the DHCP Server and Soft AP gateway in the terminal device, thus avoiding possible gateway conflicts. The terminal device establishes a network connection with the wireless router, and the first wireless station and the second wireless station can perform data interactive communication through the bridge mode of the terminal device. Among them, the data packets sent by the first wireless station or the data packets forwarded by the wireless router are all data packets in MAC frame format, which are data packet frames transmitted in the air, which can be called Air Packet Frame ; In the bridge, the data message in the MAC frame format will be converted into a data message in the Ethernet frame format, which is a data packet frame transmitted in the bridge, which can also be called Bridge Packet Frame at this time; then the datagram The message will continue to be sent as a data message in the MAC frame format.
还需要说明的是,数据报文的发送包括两种情况:一种是数据报文由无线站点STA侧通过client接口发送至网络侧的无线路由器AP(即To AP),另外一种是数据报文由网络侧的无线路由器AP通过client接口发送至无线站点STA侧(即From AP)。这样,针对不同的情况,数据报文的发送地址也是不同的;比如由第一无线站点通过client接口向无线路由器所转发的数据报文,该数据报文的发送地址为第一无线站点的MAC地址,该数据报文的类型称为第一类型;比如通过client接口接收来自于无线路由器所转发的数据报文,该数据报文的发送地址为无线路由器的MAC地址,该数据报文的类型称为第二类型。It should also be noted that the sending of the data packet includes two situations: one is that the data packet is sent by the wireless station STA side to the wireless router AP (ie To AP) on the network side through the client interface, and the other is the data packet. The message is sent by the wireless router AP on the network side to the wireless station STA side (ie, From AP) through the client interface. In this way, for different situations, the sending addresses of the data packets are also different; for example, in the data packets forwarded by the first wireless station to the wireless router through the client interface, the sending address of the data packets is the MAC address of the first wireless station. Address, the type of the data packet is called the first type; for example, if the data packet is received from the wireless router through the client interface, the sending address of the data packet is the MAC address of the wireless router, and the type of the data packet called the second type.
示例性地,以图3所示的网络拓扑结构为例,根据IEEE 802.11协议的规定,得到MAC帧格式的数据报文可以用Data[To DS,From DS,Address1,Address2,Address3,SourceIP,Dest IP]表示,而在Bridge中得到以太网帧格式的数据报文可以用Data[DestAddress,Source Address,Source IP,Dest IP]表示。在数据报文的交互过程中,假定第一无线站点为STA1,第二无线站点为STA2,由STA1将数据报文发送到STA2,此时该数据报文的类型为第一类型,STA0通过AP接口将接收到STA1所发送的MAC帧格式的数据报文,用Data[1,0,AP-BSSID,STA1-MAC,STA2-MAC,STA1-IP,STA2-IP]表示,然后由Client接口将该MAC帧格式的数据报文转发到Root AP侧;其中,在bridge中Client接口侧驱动还会将接收到的MAC帧格式的数据报文转换为以太网帧格式的数据报文,用Data[STA2-MAC,STA1-MAC,STA1-IP,STA2-IP]表示;同理,假定第一无线站点为STA1,第二无线站点为STA2,由STA2将数据报文发送到STA1,此时该数据报文的类型为第二类型,STA0通过client接口将接收到STA2所发送的MAC帧格式的数据报文,该数据报文是由STA2通过Root AP转发的,用Data[0,1,Client-MAC,Root AP-MAC,STA2-MAC,STA2-IP,STA1-IP]表示;其中,在bridge中Client接口侧驱动也会将接收到的MAC帧格式的数据报文转换为以太网协议格式的数据报文,用Data[Client-MAC,STA2-MAC,STA2-IP,STA1-IP]表示。Exemplarily, taking the network topology shown in FIG. 3 as an example, according to the stipulations of the IEEE 802.11 protocol, to obtain the data message in the MAC frame format, Data[To DS, From DS, Address1, Address2, Address3, SourceIP, Dest IP] is represented, and the data message in the Ethernet frame format obtained in the Bridge can be represented by Data[DestAddress, Source Address, Source IP, Dest IP]. During the exchange of data packets, it is assumed that the first wireless station is STA1 and the second wireless station is STA2, and STA1 sends the data packet to STA2. At this time, the type of the data packet is the first type, and STA0 passes through the AP. The interface will receive the data packet in the MAC frame format sent by STA1, which is represented by Data[1,0,AP-BSSID,STA1-MAC,STA2-MAC,STA1-IP,STA2-IP], and then the Client interface will The data packet in the MAC frame format is forwarded to the Root AP side; the client interface driver in the bridge will also convert the received data packet in the MAC frame format into a data packet in the Ethernet frame format, using Data[ STA2-MAC, STA1-MAC, STA1-IP, STA2-IP]; for the same reason, assuming that the first wireless station is STA1 and the second wireless station is STA2, STA2 sends a data packet to STA1, at this time the data The type of the packet is the second type. STA0 will receive the data packet in the MAC frame format sent by STA2 through the client interface. The data packet is forwarded by STA2 through the Root AP. Data[0,1,Client- MAC, Root AP-MAC, STA2-MAC, STA2-IP, STA1-IP] means; among them, the driver on the client interface side in the bridge will also convert the received data packets in the MAC frame format into the Ethernet protocol format. Data packet, represented by Data[Client-MAC, STA2-MAC, STA2-IP, STA1-IP].
可以理解地,针对第一类型的数据报文,如果发送地址Address2采用源地址(比如图3中所示的STA1-MAC),那么Root AP侧将会无法识别而丢弃该MAC帧格式的数据报文,此时必须强制转换Address2为Client-MAC,才能确保Root AP侧对该数据报文进行正常接收;同理,针对第二类型的数据报文,在bridge中,MAC帧格式的数据报文将转换为以太网帧格式的数据报文,如果目的地址Dest Address采用接收地址(比如图3中所示的Client-MAC),那么bridge会无法正常将该以太网帧格式的数据报文转发到AP接口,此时必须强制转换Dest Address为STA1-MAC,即将MAC帧格式的数据报文中的接收地址Address1转换为STA1-MAC,这样才能够确保STA1对该数据报文进行正常接收。也就是说,为了保证数据报文的正常交互,需要在终端设备的client接口侧驱动中增加ATE机制以进行地址转换和地址转换表的更新维护,从而解决了现有方案所带来的CPU资源消耗和网关冲突问题。Understandably, for the first type of data packet, if the source address (such as STA1-MAC shown in Figure 3) is used as the sending address Address2, the Root AP side will not be able to recognize and discard the data packet in the MAC frame format. In this case, Address2 must be converted to Client-MAC forcibly to ensure that the Root AP side can receive the data packet normally. Similarly, for the second type of data packet, in the bridge, the data packet in MAC frame format It will be converted into data packets in Ethernet frame format. If the destination address Dest Address adopts the receiving address (such as Client-MAC shown in Figure 3), the bridge will not be able to normally forward the data packets in Ethernet frame format to On the AP interface, the Dest Address must be forcibly converted to STA1-MAC, that is, the receiving address Address1 in the data packet in the MAC frame format must be converted to STA1-MAC, so as to ensure that STA1 can receive the data packet normally. That is to say, in order to ensure the normal interaction of data packets, it is necessary to add an ATE mechanism to the client interface side driver of the terminal device to perform address translation and update and maintenance of the address translation table, thereby solving the CPU resources brought by the existing solution. Consumption and gateway conflict issues.
在一些实施例中,在所述确定所述数据报文的类型之后,所述方法还包括:In some embodiments, after the determining the type of the data packet, the method further includes:
通过所述client接口内的地址转换引擎ATE,获取所存储的地址转换表;其中,所述地址转换表用于对所述数据报文中的发送地址和/或接收地址进行地址转换处理。Obtain the stored address translation table through the address translation engine ATE in the client interface; wherein, the address translation table is used to perform address translation processing on the sending address and/or the receiving address in the data message.
进一步地,在一些实施例中,当所述数据报文的类型为第一类型时,所述对所述数据报文中的发送地址进行地址转换,包括:Further, in some embodiments, when the type of the data packet is the first type, performing address translation on the sending address in the data packet includes:
在所述数据报文由第一无线站点向第二无线站点的发送过程中,根据获取到的地址转换表,将所述数据报文中的发送地址由第一无线站点的MAC地址转换为所述client接口的MAC地址,得到新的数据报文。In the process of sending the data packet from the first wireless station to the second wireless station, according to the acquired address translation table, the sending address in the data packet is converted from the MAC address of the first wireless station to the address translation table. Specify the MAC address of the client interface to obtain a new data packet.
进一步地,在一些实施例中,当所述数据报文的类型为第二类型时,所述对所述数据报文中的接收地址进行地址转换,包括:Further, in some embodiments, when the type of the data packet is the second type, performing address translation on the receiving address in the data packet includes:
在所述数据报文由第二无线站点向第一无线站点的发送过程中,根据获取到的地址转换表,将所述数据报文中的接收地址由所述client接口的MAC地址转换为所述第一无线站点的MAC地址,得到新的数据报文。In the process of sending the data packet from the second wireless station to the first wireless station, according to the obtained address translation table, the receiving address in the data packet is converted from the MAC address of the client interface to the address conversion table. The MAC address of the first wireless station is described to obtain a new data packet.
需要说明的是,终端设备的client接口侧驱动中增加ATE机制;这样,当数据报文的类型为第一类型时,即通过所述client接口向无线路由器侧转发的MAC帧格式的数据报文,可以通过从ATE中获取到的地址转换表对数据报文中的发送地址Address2进行地址转换,将其转换为Client-MAC,得到新的数据报文;当数据报文的类型为第二类型时,即通过所述Client接口接收来自于无线路由器侧转发的MAC帧格式的数据报文,可以通过从ATE中获取到的地址转换表对数据报文中的接收地址Address1进行地址转换,将其转换为真正的STA的MAC地址(比如第一无线站点的MAC地址),然后将得到新的数据报文通过所述AP接口转发到第一无线站点。It should be noted that the ATE mechanism is added to the driver of the client interface side of the terminal device; in this way, when the type of the data packet is the first type, that is, the data packet in the MAC frame format forwarded to the wireless router side through the client interface , you can perform address translation on the sending address Address2 in the data message through the address conversion table obtained from the ATE, convert it to Client-MAC, and obtain a new data message; when the type of the data message is the second type When the data message in the MAC frame format forwarded by the wireless router is received through the Client interface, the address translation table obtained from the ATE can perform address translation on the receiving address Address1 in the data message, and convert the It is converted into the MAC address of the real STA (for example, the MAC address of the first wireless station), and then the obtained new data packet is forwarded to the first wireless station through the AP interface.
示例性地,仍以图3所示的网络拓扑结构为例,假定STA1将数据报文发送到STA2,那么该数据报文的类型为第一类型,STA0通过AP接口将接收到STA1所发送的MAC帧格式的数据报文,用Data[1,0,AP-BSSID,STA1-MAC,STA2-MAC,STA1-IP,STA2-IP]表示;在bridge中,该数据报文则会转换为以太网帧格式,用Data[STA2-MAC,STA1-MAC,STA1-IP,STA2-IP]表示;然后再由Client接口将该数据报文按照MAC帧格式发送到Root AP侧,其中,如果发送地址Address2采用源地址(比如图3中的STA1-MAC),那么Root AP侧所得到的MAC帧格式的数据报文为Data[1,0,Root AP-BSSID,STA1-MAC,STA2-MAC,STA1-IP,STA2-IP],由于发送地址Address2为STA1-MAC,将会导致Root AP侧无法识别该MAC帧格式的数据报文而直接丢弃,此时需要通过地址转换表将发送地址Address2强制转换为Client-MAC,即Root AP侧所得到的MAC帧格式的数据报文为Data[1,0,Root AP-BSSID,Client-MAC,STA2-MAC,STA1-IP,STA2-IP],这样才可以确保Root AP侧能够正常接收该数据报文。同理,假定STA2将数据报文发送到STA1,那么该数据报文的类型为第二类型,STA0通过Client接口将接收到RootAP侧所转发的MAC帧格式的数据报文,用Data[0,1,Client-MAC,Root AP-BSSID,STA2-MAC,STA2-IP,STA1-IP]表示;在bridge中,该数据报文则会转换为以太网帧格式,用Data[Client-MAC,STA2-MAC,STA2-IP,STA1-IP]表示;然后再由Client接口将该数据报文按照以太网帧格式发送到AP接口侧,通过AP接口转发至STA1;其中,在bridge中,如果目的地址Dest Address采用接收地址(比如图3中的Client-MAC),那么Client接口侧所得到的以太网帧格式的数据报文将会导致bridge无法将其正常转发到AP接口而直接丢弃,此时需要通过地址转换表将接收地址Address1强制转换为STA1-MAC,即通过AP接口向STA1侧所转发的MAC帧格式的数据报文为Data[0,1,STA1-MAC,AP-BSSID,STA2-MAC,STA2-IP,STA1-IP],这样才可以确保STA1侧能够正常接收该数据报文。Exemplarily, still taking the network topology shown in FIG. 3 as an example, it is assumed that STA1 sends a data packet to STA2, then the type of the data packet is the first type, and STA0 will receive the data packet sent by STA1 through the AP interface. The data packet in MAC frame format is represented by Data[1,0,AP-BSSID,STA1-MAC,STA2-MAC,STA1-IP,STA2-IP]; in bridge, the data packet will be converted to Ethernet The network frame format is represented by Data[STA2-MAC, STA1-MAC, STA1-IP, STA2-IP]; then the client interface sends the data packet to the Root AP side according to the MAC frame format. Address2 uses the source address (such as STA1-MAC in Figure 3), then the data packet in the MAC frame format obtained by the Root AP side is Data[1,0,Root AP-BSSID,STA1-MAC,STA2-MAC,STA1 -IP,STA2-IP], since the sending address Address2 is STA1-MAC, the Root AP will not recognize the data packets in the MAC frame format and discard them directly. At this time, the sending address Address2 needs to be forcibly converted through the address translation table. is Client-MAC, that is, the data packet in the MAC frame format obtained by the Root AP side is Data[1,0,Root AP-BSSID,Client-MAC,STA2-MAC,STA1-IP,STA2-IP], so that This ensures that the Root AP can receive the data packet normally. Similarly, assuming that STA2 sends a data packet to STA1, the type of the data packet is the second type, and STA0 will receive the data packet in the MAC frame format forwarded by the RootAP side through the Client interface, and use Data[0, 1, Client-MAC, Root AP-BSSID, STA2-MAC, STA2-IP, STA1-IP] means; in bridge, the data packet will be converted into Ethernet frame format, use Data[Client-MAC, STA2 -MAC,STA2-IP,STA1-IP]; then the client interface sends the data packet to the AP interface side according to the Ethernet frame format, and forwards it to STA1 through the AP interface; among them, in the bridge, if the destination address The Dest Address adopts the receiving address (such as Client-MAC in Figure 3), then the data packet in the Ethernet frame format obtained by the Client interface side will cause the bridge to fail to forward it to the AP interface normally and directly discard it. The receiving address Address1 is forcibly converted to STA1-MAC through the address conversion table, that is, the data packet in the MAC frame format forwarded to the STA1 side through the AP interface is Data[0,1,STA1-MAC,AP-BSSID,STA2-MAC ,STA2-IP,STA1-IP], so as to ensure that the STA1 side can receive the data packet normally.
参见图4,其示出了本申请实施例提供的另一种桥接模式网络拓扑的组成结构示意图;如图4所示,在图3的基础上增加了ATE机制;具体地,在Root AP和STA0内的client接口之间,可以通过ATE机制中所存储的地址转换表对数据报文的发送地址或者接收地址进行地址转换,以确保数据报文能够正常发送。其中,该ATE机制中包含有网络地址转换表(用ATE Table表示);而ATE Table中可以包含多个协议族的地址转换表,比如地址解析协议(Address Resolution Protocol,ARP)地址转换表(用ARP Table表示)、DHCP协议地址转换表(用DHCP Table表示)和互联网协议第4版(Internet Protocol Version 4,IPV4)地址转换表(用IPV4Table表示)等,本申请实施例对此不作具体限定。Referring to FIG. 4, it shows a schematic diagram of the composition structure of another bridge mode network topology provided by an embodiment of the present application; as shown in FIG. 4, an ATE mechanism is added on the basis of FIG. 3; Between the client interfaces in STA0, the address translation table stored in the ATE mechanism can be used to perform address translation on the sending address or the receiving address of the data packet to ensure that the data packet can be sent normally. Among them, the ATE mechanism includes a network address translation table (represented by ATE Table); and the ATE Table can include address translation tables of multiple protocol families, such as the Address Resolution Protocol (Address Resolution Protocol, ARP) address translation table (represented by ARP Table), DHCP protocol address translation table (represented by DHCP Table), and Internet Protocol Version 4 (Internet Protocol Version 4, IPV4) address translation table (represented by IPV4Table), etc., which are not specifically limited in this embodiment of the present application.
在本申请实施例中,下面将以IPV4地址转换表为例进行具体描述,但本申请实施例同样适用于其他协议族的地址转换表。参见图5,其示出了本申请实施例提供的一种地址转换表的组成结构示意图;如图5所示,以IPV4地址转换表为例,IPV4地址转换表包含有协议(protocol)和条目(Entry);其中,Entry可以包含多项条目(比如entry1,entry2,......),而每项Entry记录可以用[entryindex MAC IP]来表示,这里的entryindex表示为entry的索引值;比如图5中所示,当entryindex为entry1时,那么entry1记录了xx:xx:xx:xx:xx:x4和192.168.0.104,可以表示为[entry1xx:xx:xx:xx:xx:x4192.168.0.104];当entryindex为entry2时,那么entry2记录了xx:xx:xx:xx:xx:x1和192.168.0.101,可以表示为[entry2xx:xx:xx:xx:xx:x1 192.168.0.101]。In the embodiments of the present application, the following will take the IPV4 address translation table as an example for specific description, but the embodiments of the present application are also applicable to address translation tables of other protocol families. Referring to FIG. 5, it shows a schematic diagram of the composition structure of an address translation table provided by an embodiment of the present application; as shown in FIG. 5, taking the IPV4 address translation table as an example, the IPV4 address translation table includes a protocol (protocol) and an entry (Entry); where Entry can contain multiple entries (such as entry1, entry2,...), and each Entry record can be represented by [entryindex MAC IP], where entryindex is represented as the index value of entry ; For example, as shown in Figure 5, when entryindex is entry1, then entry1 records xx:xx:xx:xx:xx:x4 and 192.168.0.104, which can be expressed as [entry1xx:xx:xx:xx:xx:x4192. 168.0.104]; when entryindex is entry2, then entry2 records xx:xx:xx:xx:xx:x1 and 192.168.0.101, which can be expressed as [entry2xx:xx:xx:xx:xx:x1 192.168.0.101] .
进一步地,在一些实施例中,当所述数据报文的类型为第一类型时,所述方法还包括:Further, in some embodiments, when the type of the data packet is the first type, the method further includes:
在所述终端设备的网桥内,将MAC帧格式的数据报文转换为以太网帧格式的数据报文,并将所述以太网帧格式的数据报文发送到所述client接口;In the network bridge of the terminal device, convert the data message in the MAC frame format into a data message in the Ethernet frame format, and send the data message in the Ethernet frame format to the client interface;
获取与所述数据报文中源地址对应的MAC地址和互联网协议IP地址;Obtain the MAC address and the Internet Protocol IP address corresponding to the source address in the data message;
根据获取到的所述MAC地址和所述IP地址,通过所述client接口内的ATE对所存储的地址转换表进行更新。According to the acquired MAC address and the IP address, the stored address translation table is updated through the ATE in the client interface.
进一步地,在一些实施例中,当所述数据报文的类型为第二类型时,所述根据获取到的地址转换表,将所述数据报文中的接收地址由所述client接口的MAC地址转换为所述第一无线站点的MAC地址,包括:Further, in some embodiments, when the type of the data packet is the second type, according to the acquired address translation table, the receiving address in the data packet is converted from the MAC address of the client interface. The address is converted into the MAC address of the first wireless station, including:
通过所述client接口接收MAC帧格式的数据报文;Receive data messages in MAC frame format through the client interface;
根据所述数据报文中目的地址对应的IP地址,从所述地址转换表中查询与所述IP地址对应的MAC地址;According to the IP address corresponding to the destination address in the data message, query the MAC address corresponding to the IP address from the address translation table;
将查询到的MAC地址作为所述数据报文中的接收地址;其中,所述查询到的MAC地址为所述第一无线站点的MAC地址。The queried MAC address is used as the receiving address in the data message; wherein, the queried MAC address is the MAC address of the first wireless station.
需要说明的是,结合图5所示的IPV4地址转换表,当数据报文的类型为第一类型时,即通过client接口向无线路由器侧转发MAC帧格式的数据报文,以图4为例,第一无线站点为STA1,第二无线站点为STA2,假定由STA1向STA2发送数据报文,此时在终端设备的bridge内,首先会将MAC帧格式的数据报文转换为以太网帧格式的数据报文(比如图4中所示的Data[STA2-MAC,STA1-MAC,STA1-IP,STA2-IP]),再将该以太网帧格式的数据报文发送到client接口;在client接口侧通过ATE启动地址转发表的更新,比如针对以太网帧格式的数据报文中Source Address和Source IP,将其更新为[entryindex STA1-MAC STA1-IP];首先确定源地址对应的entryindex,假定该entryindex为图5所示的entry2,那么从图5中可以得到源地址对应的条目为[entry2xx:xx:xx:xx:xx:x1 192.168.0.101],也就可以得到源地址对应的MAC地址和IP地址分别为xx:xx:xx:xx:xx:x1和192.168.0.101,以此对地址转换表进行更新,从而实现了对地址转换表的维护,而且它同样适用于其他协议族对应的地址转换表的更新和维护;这样,当由client接口向无线路由器侧转发而重新组建MAC帧格式的数据报文时,此时将MAC帧格式的数据报文中的发送地址Address2转换为Client-MAC,而最终转发到无线路由器侧的MAC帧格式的数据报文用Data[1,0,RootAP-BSSID,Client-MAC,STA2-MAC,STA1-IP,STA2-IP]进行表示。It should be noted that, in conjunction with the IPV4 address conversion table shown in Figure 5, when the type of the data packet is the first type, the data packet in the MAC frame format is forwarded to the wireless router side through the client interface, taking Figure 4 as an example. , the first wireless station is STA1, and the second wireless station is STA2. It is assumed that STA1 sends a data packet to STA2. At this time, in the bridge of the terminal device, the data packet in the MAC frame format is first converted into the Ethernet frame format (such as Data[STA2-MAC, STA1-MAC, STA1-IP, STA2-IP] shown in Figure 4), and then send the data packet in the Ethernet frame format to the client interface; The interface side starts the update of the address forwarding table through the ATE. For example, for the Source Address and Source IP in the data packet in the Ethernet frame format, update them to [entryindex STA1-MAC STA1-IP]; first determine the entryindex corresponding to the source address, Assuming that the entryindex is entry2 shown in Figure 5, then the entry corresponding to the source address can be obtained from Figure 5 as [entry2xx:xx:xx:xx:xx:x1 192.168.0.101], and the MAC corresponding to the source address can be obtained The address and IP address are xx:xx:xx:xx:xx:x1 and 192.168.0.101 respectively, so as to update the address translation table, so as to realize the maintenance of the address translation table, and it is also applicable to other protocol families. The update and maintenance of the address translation table; in this way, when the data message in the MAC frame format is rebuilt by the client interface forwarding to the wireless router side, the sending address Address2 in the data message in the MAC frame format is converted to the Client. -MAC, and the data message in the MAC frame format that is finally forwarded to the wireless router side is represented by Data[1,0,RootAP-BSSID,Client-MAC,STA2-MAC,STA1-IP,STA2-IP].
还需要说明的是,结合图5所示的IPV4地址转换表,当数据报文的类型为第二类型时,即通过client接口接收来自于无线路由器侧的MAC帧格式的数据报文,以图4为例,第一无线站点为STA1,第二无线站点为STA2,假定由STA2向STA1发送数据报文,此时在终端设备的bridge内,首先会将client接口所接收的MAC帧格式的数据报文(比如图4中所示的Data[0,1,Client-MAC,RootAP-MAC,STA2-MAC,STA2-IP,STA1-IP])转换为以太网帧格式的数据报文,再将该以太网帧格式的数据报文发送到AP接口;在client接口侧通过ATE启动地址转发表,比如针对以太网帧格式的数据报文中Dest Address进行地址转换,首先通过Dest IP可以从地址转换表中查询出与其对应的MAC地址,比如从地址转换表中查找到与之对应的条目为[entryindex STA1-MAC STA1-IP],可以确认出查询到的MAC地址为STA1-MAC;这样,当由AP接口向STA1侧转发而重新组建MAC帧格式的数据报文时,此时需要将MAC帧格式的数据报文中的接收地址Address1转换为STA1-MAC,这样最终转发到STA1侧所得到的MAC帧格式的数据报文用Data[0,1,STA1-MAC,AP-BSSID,STA2-MAC,STA2-IP,STA1-IP]进行表示,从而确保了数据报文在STA1和STA2之间的正常发送。It should also be noted that, in conjunction with the IPV4 address conversion table shown in Figure 5, when the type of the data message is the second type, that is, the data message in the MAC frame format from the wireless router side is received through the client interface. 4 For example, the first wireless station is STA1, and the second wireless station is STA2. It is assumed that STA2 sends a data packet to STA1. At this time, in the bridge of the terminal device, the data in the MAC frame format received by the client interface is first sent. The message (such as Data[0,1,Client-MAC,RootAP-MAC,STA2-MAC,STA2-IP,STA1-IP] shown in Figure 4) is converted into a data message in the Ethernet frame format, and then the The data packet in the Ethernet frame format is sent to the AP interface; on the client interface side, the address forwarding table is activated through ATE. For example, address translation is performed for the Dest Address in the data packet in the Ethernet frame format. First, the Dest IP can be used to convert the address from the address. The corresponding MAC address is queried in the table. For example, if the corresponding entry is found in the address translation table as [entryindex STA1-MAC STA1-IP], it can be confirmed that the queried MAC address is STA1-MAC; in this way, when When the data packet in the MAC frame format is rebuilt by forwarding it from the AP interface to the STA1 side, the receiving address Address1 in the data packet in the MAC frame format needs to be converted into STA1-MAC. The data message in the MAC frame format is represented by Data[0,1,STA1-MAC,AP-BSSID,STA2-MAC,STA2-IP,STA1-IP], thus ensuring the data message between STA1 and STA2 Send normally.
上述实施例提供了一种地址转换方法,该方法应用于终端设备,在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;根据所述地址转换生成新的数据报文后,发送所述新的数据报文;这样,由于终端设备采用桥接模式来实现WLAN共享,而且还在终端设备的client接口中增加了ATE机制以实现数据报文的地址转换和地址转换表的更新维护,从而有效解决了现有方案所带来的CPU资源消耗和网关冲突问题,更好地实现了WLAN共享。The foregoing embodiment provides an address translation method, which is applied to a terminal device, and receives a data packet after enabling a bridge mode of the terminal device; wherein the bridge mode is used to implement WLAN sharing of the terminal device; according to For the received data message, determine the type of the data message; wherein, the type of the data message includes the first type corresponding to the data message forwarded to the network side through the client interface of the terminal device and the first type corresponding to the data message forwarded through the client interface of the terminal device. The client interface receives the second type corresponding to the data packet forwarded from the network side; when the type of the data packet is the first type, address translation is performed on the sending address in the data packet; When the type of the data message is the second type, perform address translation on the receiving address in the data message; after generating a new data message according to the address translation, send the new data message; In this way, because the terminal device adopts the bridge mode to realize WLAN sharing, and also adds the ATE mechanism to the client interface of the terminal device to realize the address translation of data packets and the update and maintenance of the address translation table, thus effectively solving the problem of existing solutions. The resulting CPU resource consumption and gateway conflict problems better realize WLAN sharing.
基于前述实施例相同的发明构思,参见图6,其示出了本申请实施例提供的一种地址转换装置60的组成结构示例,该地址转换装置60应用于终端设备,该终端设备的client接口和AP接口处于同一个网桥,所述地址转换装置60可以包括:接收单元601、、确定单元602、转换单元603和发送单元604,其中,所述接收单元601,配置为在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;Based on the same inventive concept of the foregoing embodiments, referring to FIG. 6 , it shows an example of the composition structure of an
所述确定单元602,配置为根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;The determining unit 602 is configured to determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes forwarding the data packet to the network side through the client interface of the terminal device The corresponding first type and the second type corresponding to the data message received from the network side forwarded through the client interface;
所述转换单元603,配置为当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;The conversion unit 603 is configured to perform address translation on the sending address in the data packet when the type of the data packet is the first type; when the type of the data packet is the second type, performing address translation on the receiving address in the data message;
所述发送单元604,配置为根据所述地址转换生成新的数据报文后,发送所述新的数据报文。The sending unit 604 is configured to send the new data message after generating the new data message according to the address translation.
在上述方案中,参见图6,所述地址转换装置60还包括建立单元605,配置为建立所述终端设备与网络侧的无线路由器之间的网络连接;以及基于所述终端设备的桥接模式,控制第一无线站点和第二无线站点通过所述终端设备进行WLAN共享。In the above solution, referring to FIG. 6 , the
在上述方案中,所述接收单元601,具体配置为基于所述WLAN共享,判断所述数据报文是否符合WLAN协议的媒体接入控制MAC帧格式;以及当所述数据报文符合WLAN协议的MAC帧格式时,接收所述数据报文;In the above solution, the receiving unit 601 is specifically configured to determine whether the data packet conforms to the media access control MAC frame format of the WLAN protocol based on the WLAN sharing; and when the data packet conforms to the WLAN protocol In the MAC frame format, receive the data message;
所述转换单元603,还配置为在所述终端设备的网桥内,将MAC帧格式的数据报文转换为以太网帧格式的数据报文;其中,所述终端设备的网桥中包括client接口和无线接入点AP接口,所述以太网格式的数据报文用于在所述client接口和所述AP接口之间进行数据报文的交互。The conversion unit 603 is further configured to convert the data message in the MAC frame format into the data message in the Ethernet frame format in the network bridge of the terminal device; wherein, the network bridge of the terminal device includes the client The interface is an AP interface of a wireless access point, and the data packet in the Ethernet format is used for data packet interaction between the client interface and the AP interface.
在上述方案中,所述确定单元602,具体配置为当通过所述client接口向网络侧的无线路由器转发MAC帧格式的数据报文时,得到所述数据报文中的发送地址为第一无线站点的MAC地址,确定出所述数据报文的类型为第一类型;其中,所述第一类型的数据报文是由第一无线站点发送并通过所述终端设备的AP接口接收后转发到所述client接口;以及当通过所述client接口接收来自于网络侧的无线路由器转发的MAC帧格式的数据报文时,得到所述数据报文中的发送地址为无线路由器的MAC地址,确定出所述数据报文的类型为第二类型;其中,所述第二类型的数据报文是由第二无线站点发送并通过所述无线路由器转发到所述client接口。In the above solution, the determining unit 602 is specifically configured to obtain that the sending address in the data packet is the first wireless router when forwarding the data packet in the MAC frame format to the wireless router on the network side through the client interface. The MAC address of the station determines that the type of the data packet is the first type; wherein, the data packet of the first type is sent by the first wireless station and received through the AP interface of the terminal device and then forwarded to The client interface; and when receiving the data message in the MAC frame format forwarded by the wireless router on the network side through the client interface, obtain that the sending address in the data message is the MAC address of the wireless router, and determine The type of the data packet is the second type; wherein, the data packet of the second type is sent by the second wireless station and forwarded to the client interface through the wireless router.
在上述方案中,参见图6,所述地址转换装置60还包括获取单元606,配置为通过所述client接口内的地址转换引擎ATE,获取所存储的地址转换表;其中,所述地址转换表用于对所述数据报文中的发送地址和/或接收地址进行地址转换处理。In the above solution, referring to FIG. 6 , the
在上述方案中,当所述数据报文的类型为第一类型时,所述转换单元603,具体配置为在所述数据报文由第一无线站点向第二无线站点的发送过程中,根据获取到的地址转换表,将所述数据报文中的发送地址由第一无线站点的MAC地址转换为所述client接口的MAC地址,得到新的数据报文。In the above solution, when the type of the data packet is the first type, the conversion unit 603 is specifically configured to, during the process of sending the data packet from the first wireless station to the second wireless station, according to The acquired address conversion table converts the sending address in the data packet from the MAC address of the first wireless station to the MAC address of the client interface to obtain a new data packet.
在上述方案中,参见图6,所述地址转换装置60还包括更新单元607,其中,In the above solution, referring to FIG. 6 , the
所述发送单元604,还配置为在所述终端设备的网桥内,将MAC帧格式的数据报文转换为以太网帧格式的数据报文,并将所述以太网帧格式的数据报文发送到所述client接口;The sending unit 604 is further configured to convert the data packet in the MAC frame format into the data packet in the Ethernet frame format in the bridge of the terminal device, and convert the data packet in the Ethernet frame format. sent to the client interface;
所述获取单元606,还配置为获取与所述数据报文中源地址对应的MAC地址和互联网协议IP地址;The obtaining unit 606 is further configured to obtain the MAC address and the Internet Protocol IP address corresponding to the source address in the data packet;
所述更新单元607,配置为根据获取到的所述MAC地址和所述IP地址,通过所述client接口内的ATE对所存储的地址转换表进行更新。The updating unit 607 is configured to update the stored address translation table through the ATE in the client interface according to the acquired MAC address and the IP address.
在上述方案中,当所述数据报文的类型为第二类型时,所述转换单元603,具体配置为在所述数据报文由第二无线站点向第一无线站点的发送过程中,根据获取到的地址转换表,将所述数据报文中的接收地址由所述client接口的MAC地址转换为所述第一无线站点的MAC地址,得到新的数据报文。In the above solution, when the type of the data packet is the second type, the conversion unit 603 is specifically configured to, in the process of sending the data packet from the second wireless station to the first wireless station, according to The acquired address conversion table converts the receiving address in the data packet from the MAC address of the client interface to the MAC address of the first wireless station to obtain a new data packet.
在上述方案中,参见图6,所述地址转换装置60还包括查询单元608,其中,In the above solution, referring to FIG. 6 , the
所述接收单元601,还配置为通过所述client接口接收MAC帧格式的数据报文;The receiving unit 601 is further configured to receive the data message in the MAC frame format through the client interface;
所述查询单元608,配置为根据所述数据报文中目的地址对应的IP地址,从所述地址转换表中查询与所述IP地址对应的MAC地址;将查询到的MAC地址作为所述数据报文中的接收地址;其中,所述查询到的MAC地址为所述第一无线站点的MAC地址。The query unit 608 is configured to query the MAC address corresponding to the IP address from the address translation table according to the IP address corresponding to the destination address in the data packet; use the queried MAC address as the data The receiving address in the message; wherein, the queried MAC address is the MAC address of the first wireless station.
可以理解地,在本实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。It can be understood that, in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., of course, it may also be a module, and it may also be non-modular. Moreover, each component in this embodiment may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of software function modules.
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or The part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product, the computer software product is stored in a storage medium, and includes several instructions for making a computer device (which can be It is a personal computer, a server, or a network device, etc.) or a processor (processor) that executes all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, removable hard disk, Read Only Memory (ROM), Random Access Memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.
因此,本实施例提供了一种计算机存储介质,该计算机存储介质存储有地址转换程序,所述地址转换程序被至少一个处理器执行时实现前述实施例中所述方法的步骤。Therefore, the present embodiment provides a computer storage medium storing an address translation program which, when executed by at least one processor, implements the steps of the methods described in the foregoing embodiments.
基于上述地址转换装置60的组成以及计算机存储介质,参见图7,其示出了本申请实施例提供的地址转换装置60的具体硬件结构,可以包括:网络接口701、存储器702和处理器703;各个组件通过总线系统704耦合在一起。可理解,总线系统704用于实现这些组件之间的连接通信。总线系统704除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图7中将各种总线都标为总线系统704。其中,网络接口701,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;Based on the composition of the above-mentioned
存储器702,用于存储能够在处理器703上运行的计算机程序;
处理器703,用于在运行所述计算机程序时,执行:The
在开启终端设备的桥接模式之后,接收数据报文;其中,所述桥接模式用于实现所述终端设备的WLAN共享;After the bridging mode of the terminal device is enabled, a data packet is received; wherein the bridging mode is used to realize WLAN sharing of the terminal device;
根据接收到的数据报文,确定所述数据报文的类型;其中,所述数据报文的类型包括通过终端设备的client接口向网络侧转发所述数据报文所对应的第一类型和通过所述client接口接收来自于网络侧转发的所述数据报文所对应的第二类型;Determine the type of the data packet according to the received data packet; wherein, the type of the data packet includes the first type corresponding to the data packet forwarded to the network side through the client interface of the terminal device and the The client interface receives the second type corresponding to the data message forwarded from the network side;
当所述数据报文的类型为第一类型时,对所述数据报文中的发送地址进行地址转换;当所述数据报文的类型为第二类型时,对所述数据报文中的接收地址进行地址转换;When the type of the data packet is the first type, perform address translation on the sending address in the data packet; when the type of the data packet is the second type, perform address translation on the sending address in the data packet. Receive address for address translation;
根据所述地址转换生成新的数据报文后,发送所述新的数据报文。After a new data packet is generated according to the address translation, the new data packet is sent.
可以理解,本申请实施例中的存储器702可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data RateSDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(DirectRambus RAM,DRRAM)。本文描述的系统和方法的存储器702旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the
而处理器703可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器703中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器703可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器702,处理器703读取存储器702中的信息,结合其硬件完成上述方法的步骤。The
可以理解的是,本文描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(ApplicationSpecific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable LogicDevice,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。It will be appreciated that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), Digital Signal Processing Device (DSP Device, DSPD), programmable logic Devices (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.
对于软件实现,可通过执行本文所述功能的模块(例如过程、函数等)来实现本文所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。For a software implementation, the techniques described herein may be implemented through modules (eg, procedures, functions, etc.) that perform the functions described herein. Software codes may be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
可选地,作为另一个实施例,处理器703还配置为在运行所述计算机程序时,执行前述实施例中所述方法的步骤。Optionally, as another embodiment, the
参见图8,其示出了本申请实施例提供的一种终端设备80的组成结构示意图;其中,所述终端设备80至少包括如前述实施例中所涉及的任意一种地址转换装置60。Referring to FIG. 8 , it shows a schematic structural diagram of a
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of this application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,这些均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the inspiration of this application, many forms can be made without departing from the scope of protection of the purpose of this application and the claims, which all fall within the protection of this application.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910111568.3A CN109922164B (en) | 2019-02-12 | 2019-02-12 | Address translation method and device and computer storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910111568.3A CN109922164B (en) | 2019-02-12 | 2019-02-12 | Address translation method and device and computer storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109922164A CN109922164A (en) | 2019-06-21 |
CN109922164B true CN109922164B (en) | 2022-07-26 |
Family
ID=66961404
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910111568.3A Expired - Fee Related CN109922164B (en) | 2019-02-12 | 2019-02-12 | Address translation method and device and computer storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109922164B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112601255B (en) * | 2020-12-16 | 2023-05-26 | 北京银牧微电子科技有限公司 | MAC frame transmitting method and device, PHY frame aggregation method and device |
CN117480744A (en) * | 2021-06-18 | 2024-01-30 | 华为技术有限公司 | Method for forwarding messages, switch and network interface card |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101043430A (en) * | 2006-06-20 | 2007-09-26 | 华为技术有限公司 | Method for converting network address between equipments |
CN101204071A (en) * | 2005-06-23 | 2008-06-18 | Xds有限公司 | Methods and apparatus for network address change for mobile devices |
CN101510853A (en) * | 2009-04-09 | 2009-08-19 | 杭州华三通信技术有限公司 | Method and apparatus for implementing WLAN wireless bridge, and wireless access client terminal |
CN101800690A (en) * | 2009-02-05 | 2010-08-11 | 北京启明星辰信息技术股份有限公司 | Method and device for realizing source address conversion by using address pool |
CN102780602A (en) * | 2012-07-31 | 2012-11-14 | 深圳市共进电子股份有限公司 | Method and device for data transmission |
CN103313308A (en) * | 2013-06-18 | 2013-09-18 | 杭州华三通信技术有限公司 | Data transmission method and device |
CN103685588A (en) * | 2012-09-10 | 2014-03-26 | 中兴通讯股份有限公司 | Bridge packet forwarding method and device for wireless network equipment in client mode |
CN104994178A (en) * | 2015-05-12 | 2015-10-21 | 广东睿江科技有限公司 | Network address translation method and device |
CN106130908A (en) * | 2016-06-03 | 2016-11-16 | 北京小米移动软件有限公司 | Message transmitting method and device, intelligent terminal |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5741312B2 (en) * | 2011-08-12 | 2015-07-01 | 富士通株式会社 | Address translation device, communication system, address translation program, and address translation method |
-
2019
- 2019-02-12 CN CN201910111568.3A patent/CN109922164B/en not_active Expired - Fee Related
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101204071A (en) * | 2005-06-23 | 2008-06-18 | Xds有限公司 | Methods and apparatus for network address change for mobile devices |
CN101043430A (en) * | 2006-06-20 | 2007-09-26 | 华为技术有限公司 | Method for converting network address between equipments |
CN101800690A (en) * | 2009-02-05 | 2010-08-11 | 北京启明星辰信息技术股份有限公司 | Method and device for realizing source address conversion by using address pool |
CN101510853A (en) * | 2009-04-09 | 2009-08-19 | 杭州华三通信技术有限公司 | Method and apparatus for implementing WLAN wireless bridge, and wireless access client terminal |
CN102780602A (en) * | 2012-07-31 | 2012-11-14 | 深圳市共进电子股份有限公司 | Method and device for data transmission |
CN103685588A (en) * | 2012-09-10 | 2014-03-26 | 中兴通讯股份有限公司 | Bridge packet forwarding method and device for wireless network equipment in client mode |
CN103313308A (en) * | 2013-06-18 | 2013-09-18 | 杭州华三通信技术有限公司 | Data transmission method and device |
CN104994178A (en) * | 2015-05-12 | 2015-10-21 | 广东睿江科技有限公司 | Network address translation method and device |
CN106130908A (en) * | 2016-06-03 | 2016-11-16 | 北京小米移动软件有限公司 | Message transmitting method and device, intelligent terminal |
Also Published As
Publication number | Publication date |
---|---|
CN109922164A (en) | 2019-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022078509A1 (en) | Method and apparatus for encapsulating extension header of ipv6 packet | |
JP5551247B2 (en) | Method and host node for multi-NAT64 environment | |
CN113872845B (en) | Method for establishing VXLAN tunnel and related equipment | |
CN110784562B (en) | Message forwarding, domain name address query method, device, equipment and medium | |
CN110324246B (en) | Communication method and device | |
EP2708001B1 (en) | Label switched routing to connect low power network domains | |
JP6118122B2 (en) | COMMUNICATION DEVICE, ITS CONTROL METHOD, PROGRAM | |
CN104038422B (en) | Message forwarding method and gateway | |
CN105792174A (en) | WLAN Roaming Methods, Access Points and Wireless Controllers | |
CN107707476B (en) | Efficient wireless forwarding device and method based on FPGA | |
WO2019096332A1 (en) | Method, device, and system for determining packet header compression mechanism | |
CN109922164B (en) | Address translation method and device and computer storage medium | |
CN101888338B (en) | information forwarding method and gateway | |
WO2018001339A1 (en) | Method and apparatus for forwarding packet in virtual extensible local area network (vxlan) | |
WO2020192565A1 (en) | Communication method and related device | |
CN114697999A (en) | A method, device and system for creating redundant paths | |
US10637825B2 (en) | Router and method for connecting an IPv4 network and an IPv6 network | |
WO2022143161A1 (en) | Method for configuring ipv6 addresses and routing device | |
CN104426816A (en) | Virtual machine communication method and device | |
CN112804137B (en) | Information processing method, apparatus and computer readable storage medium | |
CN115428415A (en) | System and method for forwarding packets in a hierarchical network architecture using variable length addresses | |
US20080215754A1 (en) | Bridging Data Network Communications | |
CN102547908B (en) | Listing maintenance, system and IAD router | |
WO2015039563A1 (en) | Method and device for implementing layer 3 virtual private network | |
CN101938526A (en) | The acquisition method, terminal and server of routing policy |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20220726 |