A kind of port data separation method and device
Technical field
The invention belongs to the communications field, particularly relate to a kind of port data separation method and device.
Background technology
When using thin access point (English full name is fitAP) equipment to carry out data communication, be generally used for and realize control data message and be separated with the VLAN vlan of user data message, thus control data message and user data message are not interfere with each other.
At present for realizing the method that port data is separated, being generally at transmission packet through protocol stack, creating vlan interface by the vlan passage of specification, then in protocol stack, encapsulation distribution being carried out to the data message of user.
But if when the data of the user of access point connection are very many, such as be in show ground, concert is on-the-spot, and thin access point fitAP may overload operation.This is because the efficient packet of thin access point fitAP protocol stack is lower, because needs need to forward layer by layer through protocol stack to user data package, a large amount of system resource can be taken like this, and, the network equipment, when receiving packet, needs to unpack too, removes tag mark.Like this, often send a packet, need once to encapsulate packet, often receive a packet, need once to unpack packet, need consume system resources to complete at the package of protocol stack and de-packaging operation, when user is very many, then can affect the normal operation of field network, response user normally uses.
Summary of the invention
The object of the present invention is to provide a kind of port data separation method, if time very many with the data solving the user that prior art access point connects, consume system resources is needed to complete at the package of protocol stack and de-packaging operation, then can affect the normal operation of field network, the problem that response user normally uses.
First aspect, embodiments provide a kind of port data separation method, described method comprises:
When receiving the data that second line of a couplet port sends, ignore protocol stack package flow process, and when described data are sent to upper layer network, determine corresponding VLAN ID vlanid according to the data received, and described data are added VLAN ID vlanid;
When receiving the data that upper layer network sends, parsing being carried out to the data received and obtains VLAN ID vlanid, and according to described VLAN ID vlanid by port extremely corresponding for described data retransmission.
In conjunction with first aspect, in the first possibility implementation of first aspect, the described data according to receiving determine that corresponding VLAN ID vlanid step comprises:
Extraction source MAC Address and source network card equipment title in the received data;
Judge that whether described source network card equipment title is identical with the network card equipment title preset;
If described source network card equipment title is identical with the network card equipment title preset, then described VLAN ID vlanid is wireline interface VLAN ID vlanid;
If described source network card equipment title is different with the network card equipment title preset, then search corresponding wave point according to described source MAC, determine corresponding VLAN ID vlanid according to described wave point.
In conjunction with first aspect, in the second possibility implementation of first aspect, described VLAN ID vlanid step of described data being added comprises:
In data storage area, described data are passed backward, before the data storage location of data storage area, obtain structure control head space;
Described structure control head space is reset assignment, the VLAN ID vlanid that write is corresponding.
In conjunction with first aspect, in the third possibility implementation of first aspect, described when receiving the data that upper layer network sends, parsing is carried out to the data received and obtains VLAN ID vlanid, and according to described VLAN ID vlanid, described data retransmission is comprised to corresponding port step:
When receiving the data that upper layer network sends, resolving the structure control head of described data, obtaining the network interface that described data are corresponding;
Described data are sent to corresponding network interface.
In conjunction with first aspect, in the 4th kind of possibility implementation of first aspect, described port data separation method is based on thin base station fitAP.
Second aspect, embodiments provide a kind of port data separation method, described method comprises:
Mark adding device, for when receiving the data that second line of a couplet port sends, ignore protocol stack package flow process, and when described data are sent to upper layer network, determine corresponding VLAN ID vlanid according to the data received, and described data are added VLAN ID vlanid;
Identification (RNC-ID) analytic unit, for when receiving the data that upper layer network sends, carrying out parsing to the data received and obtaining VLAN ID vlanid, and according to described VLAN ID vlanid by port extremely corresponding for described data retransmission.
In conjunction with second aspect, in the first possibility implementation of second aspect, described mark adding device comprises:
Extract subelement, for extraction source MAC Address and source network card equipment title in the received data;
Judgment sub-unit, for judging that whether described source network card equipment title is identical with the network card equipment title preset;
First mark subelement, if identical with the network card equipment title preset for described source network card equipment title, then described VLAN ID vlanid is wireline interface VLAN ID vlanid;
Second mark subelement, if different with the network card equipment title preset for described source network card equipment title, then searches corresponding wave point according to described source MAC, determines corresponding VLAN ID vlanid according to described wave point.
In conjunction with second aspect, in the second possibility implementation of second aspect, described mark adding device comprises:
Pass subelement, in data storage area, described data are passed backward, before the data storage location of data storage area, obtain structure control head space;
Mark write subelement, for described structure control head space is reset assignment, the VLAN ID vlanid that write is corresponding.
In conjunction with second aspect, may in implementation at the third of second aspect, described identification (RNC-ID) analytic unit specifically for:
When receiving the data that upper layer network sends, resolving the structure control head of described data, obtaining the network interface that described data are corresponding, described data are sent to corresponding network interface.
In conjunction with second aspect, in the 4th kind of possibility implementation of second aspect, described port data separation method is based on thin base station fitAP.
In the present invention, when receiving the data of second line of a couplet port, ignore the package flow process of protocol stack, when sending data to upper layer network, corresponding VLAN ID is determined according to data, and described virtual net mark is added to described data, when receiving the data of upper layer network, parsing is carried out to the data received and obtains VLAN ID, corresponding port is forwarded the data to according to described VLAN ID, thus can avoid entering protocol stack package and de-packaging operation to data, improve the treatment effeciency of data, decrease the consumption of system resource, thus better can adapt to the requirement that multi-user uses simultaneously.
Accompanying drawing explanation
Fig. 1 is the realization flow figure of the port data separation method that first embodiment of the invention provides;
Fig. 2 is the realization flow figure determining corresponding VLAN ID according to the data received that second embodiment of the invention provides;
Fig. 3 is the structural representation of the port data separator that third embodiment of the invention provides.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
The object of the embodiment of the present invention is to solve in prior art because many people use same access point, such as during thin access point, thin access point may overload operation, its reason is, thin access point needs to use protocol stack to forward layer by layer packet, a large amount of system resource can be taken, need when receiving data to unpack, send a packets need and carry out package operation, waste a large amount of system resource, thus cause network data to block, affect the rate request of the normal use of user.Below in conjunction with accompanying drawing, the present invention is specifically described.
Embodiment one:
Fig. 1 shows the realization flow of the port data separation method that first embodiment of the invention provides, and details are as follows:
In step S101, when receiving the data that second line of a couplet port sends, ignore protocol stack package flow process, and when described data are sent to upper layer network, determine corresponding VLAN ID vlanid according to the data received, and described data are added VLAN ID vlanid.
Concrete, receive the data that second line of a couplet port sends described in the embodiment of the present invention, refer to access point, the routing devices such as such as thin access point.Described second line of a couplet port, refers to one end of close user side in a network, and in a network near one end of server, is then the upper layer network described in the embodiment of the present invention.
The package flow process of described protocol stack, refers to the regulation of protocol stack according to protocol layer, carries out package layer by layer to data, when namely data enter into each protocol stack layers, adds header packet information according to the agreement of this layer to data.Ignore protocol stack package flow process in embodiments of the present invention, the identification information realization of package can be carried out by Update Table, can certainly do not carried out the triggering of package instruction by alternate manner, realize ignoring protocol stack package flow process.
After ignoring described package flow process, when sending data to upper layer network, according to the identification information in data, obtain the VLAN ID vlanid that data are corresponding, and described VLAN ID vlanid is added into described data, thus the data comprising mark can be sent to target location accurately, and can reduce the package of data is operated.
In step s 102, when receiving the data that upper layer network sends, parsing being carried out to the data received and obtains VLAN ID vlanid, and according to described VLAN ID vlanid by port extremely corresponding for described data retransmission.
When receiving the data sent by upper layer network, need to resolve the target location of data, the present invention obtains VLAN ID vlanid according to the Data Analysis received, according to the corresponding relation of described VLAN ID and the port preset, thus forward the data to the port of correspondence.
Such as, source physical MAC address and network card equipment title can be obtained according to Data Analysis, according to network card equipment title and source physical MAC address, in conjunction with the corresponding relation preset, the port corresponding to data can be obtained, thus data are separated.
The embodiment of the present invention is when receiving the data of second line of a couplet port, ignore the package flow process of protocol stack, when sending data to upper layer network, corresponding VLAN ID is determined according to data, and described virtual net mark is added to described data, when receiving the data of upper layer network, parsing is carried out to the data received and obtains VLAN ID, corresponding port is forwarded the data to according to described VLAN ID, thus can avoid entering protocol stack package and de-packaging operation to data, improve the treatment effeciency of data, decrease the consumption of system resource, thus better can adapt to the requirement that multi-user uses simultaneously.
Embodiment two:
Fig. 2 shows the realization flow determining corresponding VLAN ID vlanid according to the data received that second embodiment of the invention provides, on the basis of embodiment one, to this step carry out concrete introduce as follows:
In step s 201, extraction source MAC Address and source network card equipment title in the received data.
Concrete, extraction source MAC Address and source network card equipment title in the received data, can add add_vlan code at network card interface outlet module, the field of extraction source mac address field and source network card equipment title in the data part of sk_buff.Wherein, described sk_buff is the most important structure of ICP/IP protocol stack, and it is the form of expression of network data report in kernel, can extract corresponding mac address, source and the information of source network card equipment title in data data division wherein.
In step S202, judge that whether described source network card equipment title is identical with the network card equipment title preset.
In embodiments of the present invention, preset wired network card apparatus title, such as, described default network card equipment title can be Eth1, so by the comparison of network card equipment title, can carry out the identification of wired network interface fast.
In step S203, if described source network card equipment title is identical with the network card equipment title preset, then described VLAN ID vlanid is wireline interface VLAN ID vlanid.
Because the title presetting all wired network adapters is identical, so, if network card equipment title is identified as preset selected title, then can identify wired network interface fast.
By the identification to wired network adapter title, the problem in prior art, wire user and wireless user being carried out identifying difficulty can be overcome.In the prior art, wired mouth that thin access point is connected and the data of wireless mouth, be all unified forwarding, so also bring a lot of inconvenience, if we will extract wireless user to management, just must reject wire user inside user list, obtain wireless user with this, moreover current fitAP equipment generally has a WAP (wireless access point) at least, great majority all concentrate between 2-10 WAP (wireless access point), are separated different access point users so just more difficult.And the present invention is by the identification of network card equipment title, wireline interface can be identified fast.
Such as, if the source network card equipment name preset is called Eth1, when the network card equipment name of resolving described equipment is called Eth1, then can determine that this interface is the vlanid of wired mouthful of Eth1 according to described network card equipment title.
In step S204, if described source network card equipment title is different with the network card equipment title preset, then search corresponding wave point according to described source MAC, determine corresponding VLAN ID vlanid according to described wave point.
If compare obtain network card equipment title from preset network card equipment title different, then represent that current interface is wave point, then need the corresponding relation further according to mac address, source and VLAN ID vlanid, determine the VLAN ID vlanid of wave point further.Namely the VLAN ID vlanid that different mac addresses, source is corresponding different.Thus different wave points can be distinguished.
Distinguishing the VLAN ID vlanid of wireline interface, and the VLAN ID vlanid of different wave points, also comprise the step of further data being added VLAN ID vlanid, comprising:
In data storage area, described data are passed backward, before the data storage location of data storage area, obtain structure control head space; Described structure control head space is reset assignment, the VLAN ID vlanid that write is corresponding.
Skb_push instruction can be passed through by data field to pusher, for adding vlan_ethhdr structure control head memory space, after assignment is emptied to vlan_ethhdr structure control head, corresponding VLAN ID vlanid is write in h_vlan_TCI element and has got final product paired data interpolation VLAN ID vlanid.
Corresponding with step S102 in embodiment one, described when receiving the data that upper layer network sends, parsing is carried out to the data received and obtains VLAN ID vlanid, and according to described VLAN ID vlanid, described data retransmission is comprised to corresponding port step:
When receiving the data that upper layer network sends, resolving the structure control head of described data, obtaining the network interface that described data are corresponding; Described data are sent to corresponding network interface.
Corresponding with above-mentioned interpolation VLAN ID vlanid, when the data received are resolved, according to the structure of structure control head, remove_vlan code is added in network card interface access, when network device entrance receives packet, first extract the structured data of structure control head, determine to mail to which network interface according to the VLAN ID vlanid in the data extracted, such as wired network interface and concrete radio network interface etc., forward the data to corresponding network interface.
The embodiment of the present invention is on the basis of embodiment one, further to wired network interface data and radio network interface data, and different radio network interface data are distinguished, while the system resources consumption of the effective minimizing network equipment, also improve the convenience of data separation.
Embodiment three:
The structural representation that the port data that Fig. 3 shows third embodiment of the invention to be provided is separated, details are as follows:
Port data separator described in the embodiment of the present invention, comprising:
Mark adding device 301, for when receiving the data that second line of a couplet port sends, ignore protocol stack package flow process, and when described data are sent to upper layer network, determine corresponding VLAN ID vlanid according to the data received, and described data are added VLAN ID vlanid;
Identification (RNC-ID) analytic unit 302, for when receiving the data that upper layer network sends, carrying out parsing to the data received and obtaining VLAN ID vlanid, and according to described VLAN ID vlanid by port extremely corresponding for described data retransmission.
Preferably, described mark adding device comprises:
Extract subelement, for extraction source MAC Address and source network card equipment title in the received data;
Judgment sub-unit, for judging that whether described source network card equipment title is identical with the network card equipment title preset;
First mark subelement, if identical with the network card equipment title preset for described source network card equipment title, then described VLAN ID vlanid is wireline interface VLAN ID vlanid;
Second mark subelement, if different with the network card equipment title preset for described source network card equipment title, then searches corresponding wave point according to described source MAC, determines corresponding VLAN ID vlanid according to described wave point.
Preferably, described mark adding device comprises:
Pass subelement, in data storage area, described data are passed backward, before the data storage location of data storage area, obtain structure control head space;
Mark write subelement, for described structure control head space is reset assignment, the VLAN ID vlanid that write is corresponding.
Preferably, described identification (RNC-ID) analytic unit specifically for:
When receiving the data that upper layer network sends, resolving the structure control head of described data, obtaining the network interface that described data are corresponding, described data are sent to corresponding network interface.
Preferably, described port data separation method is based on thin base station fitAP.
Port data separator described in the embodiment of the present invention, the port data separation method described in the present embodiment one, two is corresponding, does not repeat at this.
In several embodiment provided by the present invention, should be understood that, disclosed apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If described integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), magnetic disc or CD etc. various can be program code stored medium.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.