CN113132239A - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN113132239A
CN113132239A CN202010043669.4A CN202010043669A CN113132239A CN 113132239 A CN113132239 A CN 113132239A CN 202010043669 A CN202010043669 A CN 202010043669A CN 113132239 A CN113132239 A CN 113132239A
Authority
CN
China
Prior art keywords
address
variable
network
address field
length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010043669.4A
Other languages
Chinese (zh)
Inventor
李广鹏
蒋胜
汤佶凡
龚向阳
张万里
田野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010043669.4A priority Critical patent/CN113132239A/en
Priority to PCT/CN2021/071180 priority patent/WO2021143660A1/en
Publication of CN113132239A publication Critical patent/CN113132239A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a data transmission method and device, and belongs to the technical field of communication. The method comprises the following steps: the method comprises the steps of obtaining a data packet, wherein the data packet carries a variable-length source address, a variable-length destination address and indication information, the variable-length source address comprises a part of or all address sections in the source address, the variable-length destination address comprises a part of or all address sections in the destination address, and the indication information is used for indicating the network area grade corresponding to a starting address section in the variable-length source address and the variable-length destination address. And determining the network level address of the second network equipment of the next hop corresponding to the data packet based on the variable-length destination address and the indication information. And performing address field increase and decrease processing on the variable-length source address and the variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and updating the indication information. And transmitting the processed data packet to the second network equipment. By the method and the device, the sending efficiency of the network equipment to the data packet can be improved.

Description

Data transmission method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for data transmission.
Background
In a hierarchical network consisting of a plurality of network regions, each network region has a corresponding network region address, which is used to globally uniquely identify the network region. For example, in a hierarchical network, the network area a of the highest level corresponds to a network area level of 1, the network area address thereof may be 1, the network area B of the next level corresponds to a network area level of 2, the network area address thereof may be 1.1, and so on. For each network region, the sub-network under it may include network devices, each sub-network has a corresponding sub-network identification number, each network device has a corresponding device number, and the network level address of each network device is the network region address of the network region to which it belongs. The network address of each network device consists of a network number and a device number, and the network number consists of a network level address and a subnet identification number. For example, the network level address of the network device X is 1.1, the subnet identification number of the network device X is 2, and the device number is10The network address of the network device X belonging to the subnet under the network area B is 1.1.2.10. The network address is composed of a plurality of address segments, each of which may be represented using a bit string of a different length. Of course, each address segment in a network address can be represented by a bit string with the same length according to the network planning according to the requirement.
In the hierarchical network, when a source network device sends a data packet to a destination network device, the source network device needs to carry a source address and a destination address in the data packet. The source address is a network address of a source network device that sends the data packet, and the destination address is a network address of a destination network device that finally receives the data packet. Thus, after the source network device sends the data packet to the switching device according to the corresponding route, the switching device can query the routing table according to the destination address to forward the data packet.
In the process of implementing the present application, the inventor finds that the prior art has at least the following problems:
when the data packet is transmitted in the hierarchical network, the source address and the destination address carried in the data packet are the complete network addresses of the source network device and the destination network device. When the network area grades corresponding to the network areas to which the source network device and the destination network device belong are low, the lengths of the source network address and the destination network address carried in the data packet are long, and for the switching device, the sending efficiency of the data packet is reduced due to the excessively long source address and destination address.
Disclosure of Invention
In order to solve the problem of low forwarding efficiency in the related art, embodiments of the present application provide a method and an apparatus for data transmission. The technical scheme is as follows:
in a first aspect, a method for data transmission is provided, where the method includes:
acquiring a data packet, wherein the data packet carries a variable-length source address, a variable-length destination address and indication information, the variable-length source address comprises part or all address sections in the source address of the data packet, the variable-length destination address comprises part or all address sections in the source address of the data packet, and the indication information is used for indicating the network area grade corresponding to a starting address section in the variable-length source address and the variable-length destination address;
determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information;
performing address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and performing update processing on the indication information in the data packet to obtain a processed data packet;
and sending the processed data packet to the second network equipment.
In the solution shown in the embodiment of the present application, the source address refers to the complete network address of the source network device, and the destination address refers to the complete network address of the destination network device. The starting address segment of the variable length source address refers to the first address segment in the variable length source address. The start address segment of the variable length destination address refers to the first address segment in the variable length destination address. The indication information may include one level identification or two level identifications. In the case where the indication information includes a level flag, the level flag is used to indicate both a network area level corresponding to the start address segment in the variable-length source address and a network area level corresponding to the start address segment in the variable-length destination address. And under the condition that the indication information comprises two grade identifications, one grade identification is used for indicating the grade of the network area corresponding to the starting address segment in the variable-length source address, and the other grade identification is used for indicating the grade of the network area corresponding to the starting address segment in the variable-length destination address.
In one possible implementation manner, the performing address segment increase and decrease processing on the variable-length source address and the variable-length destination address in the data packet based on the network level address of the second network device and the indication information includes:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the indication information.
In the scheme shown in the embodiment of the present application, the address field addition method may be performed first, and if the address field addition condition is satisfied, the address field addition processing is performed, and the address field deletion method is not performed any more. If the address field addition condition is not satisfied, a method of address field pruning is performed. In addition, the method of deleting address field may be executed first, if the condition of deleting address field is satisfied, the process of deleting address field is executed, and the method of appending address field is not executed any more, if the condition of deleting address field is not satisfied, the method of appending address field is executed. Alternatively, the address field appending method and the address field puncturing method may also be performed in parallel. No matter which execution sequence is adopted, only address field addition processing or address field deletion processing is carried out or not carried out on the variable-length source address and the variable-length destination address, and the situation that both address field addition processing and address field deletion processing are carried out cannot occur.
In one possible implementation manner, the performing address segment increase and decrease processing on the variable-length source address and the variable-length destination address in the data packet based on the network level address of the second network device and the indication information includes:
determining whether the variable-length source address and the variable-length destination address meet an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length source address and the variable-length destination address;
and if the address field deleting condition is not met, address field supplementing processing is carried out on the variable-length source address and the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
In a possible implementation manner, the indication information includes a first level identifier, where the first level identifier is used to indicate a network area level L corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the determining whether the variable-length source address and the variable-length destination address satisfy an address field addition condition based on the network hierarchy address of the first network device, the indication information, and the network hierarchy address of the second network device, and if the address field addition condition is satisfied, performing address field addition processing on the variable-length source address and the variable-length destination address, includes:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the first level identification and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
if the address field addition condition is not satisfied, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network device and the indication information, including:
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the first level identification.
In the solution shown in the embodiment of the present application, the indication information carried in the data packet may include a first rank indicator, where the first rank indicator is used to indicate a network area rank corresponding to a start address segment in the variable-length source address and is also used to indicate a network area rank corresponding to a start address segment in the variable-length destination address. Each network area corresponds to a unique level identifier, for example, the level identifier may be a level number of the network area level, and if the network area level is 1, the level identifier may be 1.
In one possible implementation, the determining whether the variable-length source address and the variable-length destination address satisfy an address field appending condition based on the network hierarchy address of the first network device, the first hierarchy identifier, and the network hierarchy address of the second network device, and performing address field appending processing on the variable-length source address and the variable-length destination address if the address field appending condition is satisfied includes:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front ends of the variable-length source address and the variable-length destination address.
In the solution shown in the embodiment of the present application, the first address field refers to an address field in a network level address of the first network device, and the second address field refers to an address field in a network level address of the second network device.
In one possible implementation, if the address field addition condition is not satisfied, performing address field reduction processing on the variable-length source address and the variable-length destination address based on the network class address of the second network device and the first class identifier includes:
after the network area level corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, and not performing address field supplement processing on the variable-length source address and the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
determining a smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st fourth address field in the variable-length source address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a fourth address field every time one second address field and one fourth address field are acquired;
when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field;
determining a smaller network area rank Y of the first network area rank and the second network area rank;
and deleting the 1 st address segment in the variable-length source address and the variable-length destination address to an address segment corresponding to the network area level Y-1.
In the solution shown in the embodiment of the present application, the third address segment refers to an address segment in a variable-length destination address, and the fourth address segment refers to an address segment in a variable-length source address.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level M corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level N corresponding to a start address segment in the variable-length destination address;
the address field appending processing is performed on the variable length source address and the variable length destination address based on the network level address of the first network device, the indication information, and the network level address of the second network device, and includes:
determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network device, the second level identification and the network level address of the second network device, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address;
determining whether the variable-length source address meets a second address field addition condition or not based on the network level address of the first network device, the third level identification and the network level address of the second network device, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address;
if the address field addition condition is not satisfied, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network device and the indication information, including:
if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the second level identification;
and if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
In the solution shown in the embodiment of the present application, the indication information carried in the data packet may include a second level identifier and third level indication information. The second level identification is used for indicating the network area level corresponding to the starting address segment in the variable-length destination address. The third level identification is used for indicating the network area level corresponding to the starting address segment in the variable-length source address. Similarly, each network area is associated with a unique rank identifier, for example, the rank identifier may be a rank number of a network area rank, and if the network area rank is 1, the rank identifier may be 1. The address field increase and decrease processing for the variable-length source address and the variable-length destination address can be executed separately, and the address field increase and decrease processing for the variable-length source address and the variable-length destination address can be performed without mutual influence, that is, the increase and decrease of the address fields for the variable-length source address and the variable-length destination address can be more flexible.
In one possible implementation, the determining, based on the network level address of the first network device, the second level identifier, and the network level address of the second network device, whether the variable length destination address satisfies a first address field addition condition, and performing address field addition processing on the variable length destination address if the variable length destination address satisfies the first address field addition condition includes:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
determining the Xth' address field to the M-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address;
the determining, based on the network level address of the first network device, the third level identifier, and the network level address of the second network device, whether the variable-length source address satisfies a second address field addition condition, and if the variable-length source address satisfies the second address field addition condition, performing address field addition processing on the variable-length source address, including:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
the Xth' address field to the N-1 th address field in the network level address of the first network device are determined as supplementary address fields and added to the front end of the variable length source address.
In one possible implementation, if the variable-length destination address does not satisfy the first address field addition condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network device and the second level identifier, includes:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is M-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Mth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level Y' corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the third address segment after the network area grade corresponding to the acquired second address segment is P ', and determining a first network area grade Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the third address segment;
deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1;
if the variable-length source address does not satisfy the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network device and the third level identifier, including:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is N-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number Q' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Nth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the fourth address segment after the network area level corresponding to the acquired second address segment is Q ', and determining a second network area level Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the fourth address segment;
and deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
In a possible implementation manner, the determining, based on the variable-length destination address and the indication information, a network level address of a second network device of a next hop corresponding to the data packet includes:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending the processed data packet to the second network device includes:
and sending the processed data packet to the second network equipment through the target port.
In the solution shown in the embodiment of the present application, the first network device may determine whether the variable-length destination address needs to be complemented according to the indication information. If the indication information indicates that the network area level corresponding to the initial address field in the variable-length destination address is 1, the variable-length destination address does not need to be supplemented. If the indication information indicates that the network area level corresponding to the starting address field in the variable-length destination address is not 1, the variable-length destination address needs to be complemented to obtain the destination address.
The completion of the variable-length destination address can be implemented according to the indication information and the network level address of the first network device. That is, the address field preceding the address field corresponding to the network area level indicated by the instruction information in the network level address of the first network device is added to the address field preceding the variable-length destination address.
The destination address may then be used to look up a routing table to obtain the port identification of the destination port for forwarding the data packet. And then, according to the port identification, determining the network level address of the network equipment directly connected with the target port. The network device directly connected to the target port is the second network device of the next hop corresponding to the data packet.
In a possible implementation manner, the obtaining a network level address of the second network device based on the target port includes:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
In the solution shown in the embodiment of the present application, a correspondence between a port identifier stored in a first network device and a network level address of a network device connected to a port corresponding to each port identifier may be configured in the first network device by a technician, or the correspondence may be actively established by the first network device through the following method.
For each port of the first network equipment, a network level address acquisition instruction is sent to the network equipment connected with the port through the port, and after receiving the network level address acquisition instruction, the network equipment returns the network level address of the network equipment to the port. The first network device may establish a correspondence between the received network level address and the port identifier of the port receiving the network level address, and store the correspondence.
By adopting the method for storing the corresponding relation locally, the network level address of the second network equipment does not need to be determined temporarily when the network equipment sends the data packet. The efficiency of data packet transmission is improved.
In a possible implementation manner, the obtaining a network level address of the second network device based on the target port includes:
sending a network level address acquisition request to the second network device through the target port
And receiving the network level address of the second network equipment returned by the second network equipment.
In a second aspect, a method for data transmission is provided, where the method is applied to a source network device, and the method includes:
acquiring a source address and a destination address of data to be sent;
generating a variable-length source address, a variable-length destination address and corresponding indication information based on the source address and the destination address, wherein the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at the front end in the source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at the front end in the destination address of the data packet, and the indication information is used for indicating the network area level corresponding to the starting address field in the variable-length source address and the variable-length destination address;
generating a data packet carrying the data, the variable-length source address, the variable-length destination address and the indication information;
transmitting the data packet based on the destination address.
In a possible implementation manner, the indication information includes a first rank indicator, where the first rank indicator is used to indicate a network area rank corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the generating a variable length source address, a variable length destination address and corresponding indication information based on the source address and the destination address comprises:
and generating a variable-length source address, a variable-length destination address and a corresponding first-level identification based on the source address and the destination address.
In one possible implementation manner, the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length source address and the variable-length destination address;
and if the address field deleting condition is not met, address field supplementing processing is carried out on the variable-length source address and the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
In one possible implementation manner, the generating a variable-length source address, a variable-length destination address, and a corresponding first rank identifier based on the source address and the destination address includes:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable-length source address and a variable-length destination address, and determining a first level identifier corresponding to the network area level B.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length destination address;
the generating a variable length source address, a variable length destination address and corresponding indication information based on the source address and the destination address comprises:
generating a variable-length source address and a corresponding third-level identification based on the source address;
and generating a variable-length destination address and a corresponding second-level identification based on the source address and the destination address.
In one possible implementation manner, the generating a variable-length source address and a corresponding third-level identifier based on the source address includes:
deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to an initial address section in the variable-length source address;
generating a variable-length destination address and a corresponding third-level identifier based on the source address and the destination address, including:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable length destination address, and determining a second level identifier corresponding to a starting address segment in the variable length destination address.
In a third aspect, a method for data transmission is provided, where the method is applied to a first network device, and the method includes:
acquiring a data packet, wherein the data packet carries a variable-length destination address and indication information, the variable-length destination address comprises part or all address segments in the destination address of the data packet, and the indication information is used for indicating the network area grade corresponding to a starting address segment in the variable-length destination address;
determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information;
based on the network level address of the second network device and the indication information, performing address segment increase and decrease processing on the variable-length destination address in the data packet, and performing update processing on the indication information in the data packet to obtain a processed data packet;
and sending the processed data packet to the second network equipment.
In one possible implementation manner, the performing, on the basis of the network level address of the second network device and the indication information, address segment increase and decrease processing on the variable-length destination address in the data packet includes:
determining whether the variable-length destination address meets an address field addition condition or not based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the indication information.
In one possible implementation manner, the performing, on the basis of the network level address of the second network device and the indication information, address segment increase and decrease processing on the variable-length destination address in the data packet includes:
determining whether the variable-length destination address meets an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length destination address;
and if the address field deleting condition is not met, performing address field addition processing on the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
In one possible implementation manner, the indicating information is used to indicate a network area level L corresponding to a start address field in the variable-length destination address, and the determining, based on the network level address of the first network device, the indicating information, and the network level address of the second network device, whether the variable-length destination address meets an address field appending condition, and if the address field appending condition is met, performing address field appending processing on the variable-length destination address includes:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address.
In one possible implementation, the indicating information is used to indicate a network area level L corresponding to a start address field in the variable-length destination address, and if the address field addition condition is not satisfied, performing address field deletion processing on the variable-length source address and the variable-length destination address based on a network level address of the second network device and the indicating information includes:
stopping acquiring the first address field and the second address field after the network area level corresponding to the currently acquired first address field is L-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade Y corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
and deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y-1.
In a possible implementation manner, the determining, based on the variable-length destination address and the indication information, a network level address of a second network device of a next hop corresponding to the data packet includes:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending the processed data packet to the second network device includes:
and sending the processed data packet to the second network equipment through the target port.
In a possible implementation manner, the obtaining a network level address of the second network device based on the target port includes:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
In a possible implementation manner, the obtaining a network level address of the second network device based on the target port includes:
sending a network level address acquisition request to the second network device through the target port
And receiving the network level address of the second network equipment returned by the second network equipment.
In a fourth aspect, an apparatus for data transmission is provided, the apparatus comprising:
an obtaining module, configured to obtain a data packet, where the data packet carries a variable-length source address, a variable-length destination address, and indication information, the variable-length source address includes a part or all of address segments in the source address of the data packet, the variable-length destination address includes a part or all of address segments in the source address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address segment in the variable-length source address and the variable-length destination address;
a determining module, configured to determine, based on the variable-length destination address and the indication information, a network level address of a second network device of a next hop corresponding to the data packet;
a processing module, configured to perform address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and perform update processing on the indication information in the data packet to obtain a processed data packet;
a sending module, configured to send the processed data packet to the second network device.
In one possible implementation manner, the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the indication information.
In a possible implementation manner, the indication information includes a first level identifier, where the first level identifier is used to indicate a network area level L corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the first level identification and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the first level identification.
In one possible implementation manner, the processing module is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front ends of the variable-length source address and the variable-length destination address.
In one possible implementation manner, the processing module is configured to:
after the network area level corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, and not performing address field supplement processing on the variable-length source address and the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
determining a smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st fourth address field in the variable-length source address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a fourth address field every time one second address field and one fourth address field are acquired;
when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field;
determining a smaller network area rank Y of the first network area rank and the second network area rank;
and deleting the 1 st address segment in the variable-length source address and the variable-length destination address to an address segment corresponding to the network area level Y-1.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level M corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level N corresponding to a start address segment in the variable-length destination address;
the processing module is configured to:
determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network device, the second level identification and the network level address of the second network device, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address;
determining whether the variable-length source address meets a second address field addition condition or not based on the network level address of the first network device, the third level identification and the network level address of the second network device, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address;
if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the second level identification;
and if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
In one possible implementation manner, the processing module is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
determining the Xth' address field to the M-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address;
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
the Xth' address field to the N-1 th address field in the network level address of the first network device are determined as supplementary address fields and added to the front end of the variable length source address.
In one possible implementation manner, the processing module is configured to:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is M-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Mth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network region grade Y' corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network region level corresponding to the acquired second address field is P ', and determining a first network region level Y' corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1;
if the variable-length source address does not satisfy the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network device and the third level identifier, including:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is N-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number Q' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Nth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the fourth address segment after the network area level corresponding to the acquired second address segment is Q ', and determining a second network area level Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the fourth address segment;
and deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
In one possible implementation manner, the determining module is configured to:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending module is configured to:
and sending the processed data packet to the second network equipment through the target port.
In one possible implementation manner, the determining module is configured to:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
In one possible implementation manner, the determining module is configured to:
sending a network level address acquisition request to the second network device through the target port
And receiving the network level address of the second network equipment returned by the second network equipment.
In a fifth aspect, an apparatus for data transmission is provided, the apparatus comprising:
the acquisition module is used for acquiring a source address and a destination address of data to be sent;
a determining module, configured to generate a variable-length source address, a variable-length destination address, and corresponding indication information based on the source address and the destination address, where the variable-length source address is obtained by deleting a front partial address field or a non-deleted address field from the source address of the data packet, the variable-length destination address is obtained by deleting a front partial address field or a non-deleted address field from the destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field of the variable-length source address and the variable-length destination address;
a generating module, configured to generate a data packet carrying the data, the variable-length source address, the variable-length destination address, and the indication information;
a sending module for sending the data packet based on the destination address.
In a possible implementation manner, the indication information includes a first rank indicator, where the first rank indicator is used to indicate a network area rank corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the determining module is configured to:
and generating a variable-length source address, a variable-length destination address and a corresponding first-level identification based on the source address and the destination address.
In one possible implementation manner, the determining module is configured to:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable-length source address and a variable-length destination address, and determining a first level identifier corresponding to the network area level B.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length destination address;
the determining module is configured to:
generating a variable-length source address and a corresponding third-level identification based on the source address;
and generating a variable-length destination address and a corresponding second-level identification based on the source address and the destination address.
In one possible implementation manner, the determining module is configured to:
deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to an initial address section in the variable-length source address;
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable length destination address, and determining a second level identifier corresponding to a starting address segment in the variable length destination address.
In a sixth aspect, a network device is provided, where the network device includes:
a transceiver, configured to obtain a data packet, where the data packet carries a variable-length source address, a variable-length destination address, and indication information, the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at a front end from a source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at a front end from a destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field in the variable-length source address and the variable-length destination address;
a memory comprising computer readable instructions;
a processor coupled to the memory and the transceiver, the processor configured to execute the computer-readable instructions to:
determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information;
performing address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and performing update processing on the indication information in the data packet to obtain a processed data packet;
the transceiver is further configured to send the processed data packet to the second network device.
A seventh aspect provides a source network device, where the source network device includes:
the transceiver is used for acquiring a source address and a destination address of data to be transmitted;
a memory comprising computer readable instructions;
a processor coupled to the memory and the transceiver, the processor configured to execute the computer-readable instructions to:
generating a variable-length source address, a variable-length destination address and corresponding indication information based on the source address and the destination address, wherein the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at the front end in the source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at the front end in the destination address of the data packet, and the indication information is used for indicating the network area level corresponding to the starting address field in the variable-length source address and the variable-length destination address;
generating a data packet carrying the data, the variable-length source address, the variable-length destination address and the indication information;
the transceiver is further configured to transmit the data packet based on the destination address.
In an eighth aspect, a computer-readable storage medium is provided, which includes computer-readable instructions, and when the computer-readable storage medium is executed on a first network device, the first network device is caused to execute the data transmission method of the first aspect.
In a ninth aspect, a computer program product containing instructions is provided, which when run on a first network device, causes the first network device to perform the method for data transmission according to the first aspect.
In a tenth aspect, a computer-readable storage medium is provided, which includes computer-readable instructions, when the computer-readable storage medium is executed on a source network device, the source network device is caused to execute the data transmission method of the second aspect.
In an eleventh aspect, a computer program product containing instructions is provided, which when run on a source network device, causes the source network device to perform the method for data transmission according to the second aspect.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
according to the embodiment of the application, the data packet carries the variable-length source address, the variable-length destination address and the indication information. The variable length source address comprises a part of or all address sections in the source address, the variable length destination address comprises a part of or all address sections in the destination address, and the indication information is used for indicating the network area grade corresponding to the starting address section in the variable length source address and the variable length destination address. It can be seen that there is no need to carry the complete destination address and the complete source address in the data packet. After receiving the data packet, the network device increases or decreases the variable-length source address and the variable-length destination address carried in the data packet, and then transmits the data packet. Therefore, the data packet does not need to carry a complete destination address and a complete source address, and the sending efficiency of the network equipment to the data packet can be effectively improved.
Drawings
Fig. 1 is a schematic diagram of a hierarchical network provided by an embodiment of the present application;
fig. 2 is a flowchart of a method for data transmission according to an embodiment of the present application;
fig. 3 is a schematic diagram of indication information in a data packet according to an embodiment of the present application;
fig. 4 is a schematic diagram of indication information in a data packet according to an embodiment of the present application;
fig. 5 is a flowchart of a method for data transmission according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus for data transmission according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an apparatus for data transmission according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a network device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a source network device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a data transmission method, which can be realized by network equipment in a hierarchical network. Fig. 1 is a schematic diagram of a hierarchical network. In the hierarchical network, a plurality of network regions are included, and a plurality of subnets, such as subnet N1, subnet N2, subnet N3, subnet N4, and the like. In each network area there may be a plurality of network devices, such as switching devices, which may be used to forward data packets. There may also be multiple network devices in each subnet, which may be in data communication with each other. For example, network device C1 in subnet N1, as the source network device, may send a data packet to network device C2 in subnet N4, and then C2 is the destination network device. In the process, the method provided by the embodiment of the application can be adopted to delete the source address and the destination address carried in the data packet or supplement the deleted source address and destination address, so as to achieve the purpose of simplifying the source address and the destination address. For the network device receiving the data packet, the complete source address and destination address can be calculated according to the deleted or supplemented source address and destination address carried in the data packet, so as to accurately forward the data.
To facilitate understanding of the embodiments of the present application, the basic concepts in the hierarchical network referred to in the embodiments of the present application are described below.
First, network zone level
A network area is assigned a rank, referred to as a network area rank, and membership based on its logical location throughout the hierarchical network, e.g., geographic location, virtual network, etc. For example, in the hierarchical network shown in fig. 1, the network area level of the network area a is 1, the network area level of the network area B is 2, the network area level of the network area C is 2, the network area level of the network area D is 3, the network area level of the network area E is 3, the network area level of the network area F is 4, and the network area level of the network area G is 1.
Second, network area address
The network area address is a globally unique label for the network area. The address of one network region inherits from its immediate high-level network region. For example, in the hierarchical network shown in fig. 1, the network area address of the network area a is 1, the network area address of the network area B is 1.1, the network area address of the network area C is 1.2, the network area address of the network area D is 1.1.1, the network area address of the network area E is 1.2.1, the network area address of the network area F is 1.1.1.1, and the network area address of the network area G is 2.
Third, network level address
The network area address is for a network area and the network level address is for network devices in the network area. All network devices in a network area are assigned network level addresses, which are network area addresses of the network area to which they belong. In a network area, all network devices have the same network level address, which is the network area address of the network area. For example, in the hierarchical network shown in fig. 1, both network device R6 and network device R7 are in network area E, the network level address of network device R6 is 1.2.1, the network level address of network device R7 is also 1.2.1, and the network area address of network area E is also 1.2.1.
Network address
The network address is a label of each network device needing to communicate in the networkThe identifier is the basis for the switching equipment to forward the data packet, and has global uniqueness. Each network address is composed of a network number and a device number, wherein the device number is used for identifying the network device in one subnet and can be represented by numbers with underlining, and the network number is a corresponding network level address and a subnet identification number of the subnet to which the network address belongs. For example, in the packet network shown in FIG. 1, the network address of network device C1 in subnet N1 may be 1.1.1.1.1.10. Where 1.1.1.1.1 is the network number of the device,10its device number.
Five, variable length source address
The variable-length source address replaces the complete source address carried in the conventional data packet. After each network device receives the data packet, it may perform address segment increase and decrease processing on the variable-length source address carried in the data packet, so that the address segment length of the variable-length source address changes. After receiving the data packet, the network device may obtain a complete source address of the data packet according to its own network level address and variable-length source address. It should be noted that the variable-length source address is only a name defined for a network address having the above-described characteristics in the embodiment of the present application. Of course, the name may be defined by other names, and the embodiment of the present application is not limited thereto.
Six, variable length destination address
The variable length destination address replaces the complete destination address carried in the conventional data packet. After each network device receives the data packet, it may add or subtract address segment of the address with variable length destination carried in the data packet, so as to change the address segment length of the address with variable length destination. After receiving the data packet, the network device may obtain a complete destination address of the data packet according to its own network level address and the variable length destination address. It should be noted that the variable-length destination address is only a name defined for the network address having the above-described feature in the embodiment of the present application. Of course, the name may be defined by other names, and the embodiment of the present application is not limited thereto.
As shown in fig. 2, for a method for data transmission provided in this embodiment of the present application, the method may be implemented by a first network device, and a processing flow of the method may include the following steps:
step 201, acquiring a data packet.
The data packet carries a variable-length source address, a variable-length destination address and indication information, wherein the variable-length source address comprises part or all of address sections in the source address of the data packet, if the partial address sections are included, the part of address sections are positioned at the rear part of the address sections except the part of address sections in the source address, the variable-length destination address is part or all of address sections in the destination address of the data packet, if the partial address sections are included, the part of address sections are positioned at the rear part of the address sections except the part of address sections in the destination address, and the indication information is used for indicating the network area grade corresponding to the starting address sections in the variable-length source address and the variable-length destination address. The indication information may also be referred to as initial network address level indication information, and the name of the indication information is not limited in this application.
In an implementation, the network device may be a source network device, and the source network device may produce data and perform grouping to obtain a data packet. The network device may also be a switching device for forwarding data, and the switching device may receive the data packet sent by the last hop network device. The variable length source address, the variable length destination address and the indication information are carried in a network layer protocol header of the data packet. The following may be the case for the initial network address level indication information.
Situation one,
The indication information carried in the data packet may include a first level identifier, where the first level identifier is used to indicate a network area level corresponding to a start address segment of a variable-length source address in the data packet, and is also used to indicate a network area level corresponding to a start address segment of a variable-length destination address in the data packet.
Referring to fig. 3, a diagram of a long source address, a long destination address, and a first level identification in a data packet is shown. In fig. 3, the first level identification may be a network area level corresponding to the start address segments of the variable length source address and the variable length destination address in the data packet. Such asThe first level is labeled L, which may represent a variable length destination address of 1.2.6.7And a source address of 1.2.3.4.5The corresponding network area level is L.
It should be noted that the first rank indication may also be represented in other forms, and a specific representation form of the first rank indication in this embodiment is not limited. In addition, fig. 3 only shows an order of the variable-length source address, the variable-length destination address and the first level identifier in the network layer protocol header for example, and the variable-length source address, the variable-length destination address and the first level identifier may be arranged in other orders in the network layer protocol header, which is not limited in this application.
The second case,
The indication information carried in the data packet may include a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level corresponding to a start address field in the variable length destination address, and the third level identifier is used to indicate a network area level corresponding to a start address field in the variable length source address.
Referring to fig. 4, a diagram of a long source address, a long destination address, a second level identifier and a third level identifier in a data packet is shown. In fig. 4, the second level identification may be a network area level corresponding to a starting address segment in a variable length destination address in the data packet. The third level identification may be a network area level corresponding to a starting address segment in the variable length source address. For example, the second level is labeled as M, i.e., it can represent a variable-length destination address of 1.1.1.10The network area level corresponding to the initial address field "1" in (1) is M, and the second level identifier is N, i.e. it can represent the source address 2.1.2.10The network area level corresponding to the start address field "2" in (1) is M.
It should be noted that the second-level identifier and the third-level identifier may also be represented in other forms, and the specific representation forms of the second-level identifier and the third-level identifier are not limited in this application. In addition, fig. 4 only exemplarily shows an order of the variable-length source address, the variable-length destination address, the second-level identifier and the third-level identifier in the network layer protocol header, and the variable-length source address, the variable-length destination address, the second-level identifier and the third-level identifier may also be arranged in other orders in the network layer protocol header, which is not limited in this application.
Step 202, determining the network level address of the second network device of the next hop corresponding to the data packet based on the variable length destination address and the indication information.
In an implementation, a first network device obtains a variable length destination address and indication information in a data packet. Corresponding to the case where the above indication information includes the first rank indication, here, the variable-length destination address and the first rank indication may be acquired. Corresponding to the case where the above indication information includes the second level identification and the third level identification, here, the variable length destination address and the third level identification may be acquired.
Then, the routing table may be queried to determine a port identifier of a destination port of the first network device, where the destination port is used for sending the data packet, and the destination port is connected to a second network device of a next hop corresponding to the data packet through a link.
Before inquiring the routing table, whether the variable-length destination address needs to be supplemented or not can be judged according to the indication information. If the indication information indicates that the network area level corresponding to the initial address field in the variable-length destination address is 1, the variable-length destination address does not need to be supplemented. If the indication information indicates that the network area level corresponding to the starting address field in the variable-length destination address is not 1, the variable-length destination address needs to be complemented to obtain the destination address.
The completion of the variable-length destination address can be implemented according to the indication information and the network level address of the first network device. That is, the address field preceding the address field corresponding to the network area level indicated by the instruction information in the network level address of the first network device is added to the address field preceding the variable-length destination address. For example, the variable-length destination address carried in the data packet is 4.1.2, the network zone level indicated by the indication information is 3, the network zone level address of the first network device is 1.1.2.1.3, and the address segment corresponding to the network zone level 3 in 1.1.2.1.3 is 2, so that the destination address needs to be 1.1.4.1.2 before the first two address segments are filled to the variable-length destination address.
After the destination address is obtained, the port identifier of the destination port used for sending the data packet in the first network device may be queried in the routing table. Then, based on the port identifier of the target port, the network level address of the second network device may be obtained. Here, the manner of acquiring the network level address of the second network device may be as follows.
In a first way,
The first network device may locally store a corresponding relationship between the port identifier of each port of the first network device and the network hierarchical address of the network device connected to the port corresponding to each port identifier. Then, the network level address corresponding to the port identifier of the target port, that is, the network level address of the second network device, may be directly obtained by querying the corresponding relationship.
In the hierarchical network shown in fig. 1, three ports of the network device R2, port 1, port 2, and port 3, are connected to the network device R1, the network device R3, and the network device R5, respectively, by links. Then, the port identification of port 1 and the network level address of the network device R1, the port identification of port 2 and the network level address of the network device R3, and the port identification of port 3 and the network level address of the network device R5 may be stored in the network device R2 correspondingly. Table 1 below shows an exemplary correspondence between port identifiers and network level addresses.
TABLE 1
Port identification Network level address of connected network device
Port 1 1
Port 2 1.1
Port 3 1.1.1
In this manner, in the first mode, the corresponding relationship may be configured in the first network device in advance by a technician, or may be the corresponding relationship actively established after the first network device is deployed to the hierarchical network. The method for actively establishing the corresponding relationship may be as follows:
and for each port of the first network equipment, sending a network level address acquisition instruction to the network equipment connected with the port through the port, and returning the network level address of the network equipment after the network equipment receives the network level address acquisition instruction. The first network device may establish a correspondence between the received network level address and the port identifier of the port receiving the network level address, and store the correspondence.
In the hierarchical network shown in fig. 1, network device R2 may send a network level address obtaining request to network device R1 through port 1, network device R2 may send a network level address obtaining request to network device R3 through port 2, and network device R2 may send a network level address obtaining request to network device R5 through port 3. Accordingly, network device R1 returns the network level address of network device R1 to port 1, network device R3 returns the network level address of network device R3 to port 2, and network device R5 returns the network level address of network device R5 to port 3.
And secondly, after the port identification of the target port for sending the data packet is inquired, sending a network level address acquisition request to the second network equipment through the target port. And receiving the network level address of the second network equipment returned by the second network equipment.
As shown in fig. 1, in the hierarchical network, the network device R2 determines that the target port is port 1, and then may send a network level address obtaining request to the network device R1 through port 1, and after receiving the network level address obtaining request, the network device R1 returns the network level address of the network device R1 to port 1.
And step 203, based on the network level address and the indication information of the second network device, performing address segment increase and decrease processing on the variable length source address and the variable length destination address in the data packet, updating the indication information in the data packet to obtain a processed data packet, and forwarding the processed data packet to the second network device.
In an implementation, the first network device may determine whether the variable-length source address and the variable-length destination address satisfy the address field addition condition based on the network class address of the first network device, the indication information, and the network class address of the second network device, and if the address field addition condition is satisfied, perform address field addition processing on the variable-length source address and the variable-length destination address. And if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address and the indication information of the second network equipment.
In both cases of the above instruction information, the address field increase/decrease processing of the variable-length source address and the variable-length destination address will be described.
And corresponding to the first condition, the indication information comprises a first grade mark.
And determining whether the variable-length source address and the variable-length destination address meet the address field addition condition or not based on the network level address of the first network equipment, the first level identification and the network level address of the second network equipment, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address. And if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address and the first level identification of the second network equipment.
The first rank indicator is used to indicate the network area rank L corresponding to the start address segment in the variable length source address and the variable length destination address.
First, the address field addition processing for the variable-length source address and the variable-length destination address may have the following method.
Respectively obtaining address fields one by one from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment. Each time a first address field and a second address field are fetched, the currently fetched first address field and second address field are compared. When the currently acquired first address field is different from the currently acquired second address field, stopping acquiring the first address field and the second address field, judging that the variable-length source address and the variable-length destination address meet the address field supplement condition, and determining the network area grade X corresponding to the currently acquired first address field. The xth to L-1 address fields in the network level address of the first network device are determined as supplementary address fields. And added to the front of the variable length source address and the variable length destination address. And after the network area grade corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, judging that the variable length source address and the variable length destination address do not meet the address field supplement condition, and not performing address field supplement processing on the variable length source address and the variable length destination address. The following method of address field pruning is performed.
Second, the address field reduction processing for the variable-length source address and the variable-length destination address may be as follows.
In the case where the address field addition processing is not performed for the variable-length source address and the variable-length destination address, the address field reduction processing may be performed for the variable-length source address and the variable-length destination address.
A smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device is determined. The address fields are acquired one by one backward starting from the L second address field in the network level address of the second network device and the 1 st third address field in the variable-length destination address, respectively. Each time a second address field and a third address field are acquired, the currently acquired second address field and third address field are compared. And when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level corresponding to the currently acquired second address field. And stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field.
A smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device is determined. And respectively acquiring address fields backwards one by one from the L-th second address field in the network level address of the second network equipment and the 1 st fourth address field in the variable-length source address. When a second address field and a fourth address field are acquired, the currently acquired second address field and the fourth address field are compared. And when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field. And stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field.
A smaller network area rank Y of the first network area rank and the second network area rank is determined. And deleting the 1 st address segment in the variable length source address and the variable length destination address to the address segment corresponding to the network area level Y-1.
The address field addition processing and the address field deletion processing of the variable-length source address and the variable-length destination address described above will be described below with reference to the packet network shown in fig. 1, taking the transmission of a data packet in the hierarchical network shown in fig. 1 as an example.
In the packet network shown in fig. 1, the network level address of the network device R1 in the network area a is 1, the network level addresses of the network devices R2 and R3 in the network area B are 1.1, and the network area C isThe network rank address of network device R4 in network area D is 1.2, the network rank address of network device R5 in network area D is 1.1.1, the network rank addresses of network devices R6 and R7 in network area E are 1.2.1, the network rank address of network device R8 in network area F is 1.1.1.1, and the network rank address of network device R9 in network area G is 2. The source network device is network device C1 in subnet N1, which has a network address of 1.1.1.1.1.10The destination network device is network device C2 in subnet N3, and its network address is 1.2.1.2.10. The transmission path of the data packet is: C1-R8-R3-R9-R7-C2.
Source network device C1 may generate a data packet with a first level identification of 1, i.e., the starting address segment indicating the variable length source address and the variable length destination address corresponds to a network area level of 1. The variable length source address is 1.1.1.1.1.10The variable length destination address is 1.2.1.2.10. C1 may first adopt the above-mentioned address field deleting method to delete the variable-length source address and the variable-length destination address. The routing table is firstly queried to determine that the network level address of the second network device R8 of the next hop is 1.1.1.1.
The number of address segments of the destination address 5 is compared with the number of address segments of the network level address of R8, and the smaller of the two is 4. From the 1 st second address segment and the variable length destination address 1.2.1.2, respectively, in the network level address 1.1.1.1 of R8.10The 1 st third address field in the first address field starts to get the address fields one by one backwards. Before the network area level corresponding to the second address field to be acquired is 5, comparing the currently acquired second address field with the third address field every time one second address field and one third address field are acquired, stopping acquiring the second address field and the third address field when the 2 nd second address field 1 and the 2 nd third address field 2 are compared, and determining that the first network area level corresponding to the currently acquired second address field is 2.
The number of address segments 6 for the source address is compared with the number of address segments 4 for the network level address of R8, and the smaller of the two is 4. From the 1 st second address segment and the variable length source address 1.1.1.1.1 in the network level address 1.1.1.1, respectively, of R8.10To (1)And 1 fourth address segment starts to acquire address segments one by one backwards. Before the network region level corresponding to the second address field to be acquired is 5, comparing the currently acquired second address field with the fourth address field every time one second address field and one fourth address field are acquired. After the 4 th second address field 1 and the 4 th fourth address field 1 are compared, the first 4 second address fields and the corresponding fourth address fields are the same. The network area level corresponding to the second address field to be acquired is 5, the acquisition of the second address field and the fourth address field is stopped, and the second network area level 4 corresponding to the currently acquired second address field is determined.
The smaller network area level of the first network area level 2 and the second network area level 4 is determined to be 2. The source address 1.1.1.1.1 will be made longer.10And a variable length destination address 1.2.1.2.10The 1 st address segment in the network area level 1 is deleted, that is, the 1 st address segment is deleted. And obtaining the variable-length source address 1.1.1.1 after the address field deletion.10And a variable length destination address 2.1.2 after the address field pruning processing.10. And updates the first level identification to 2. The processed data packet is sent to R8.
Then, R8 looks up the routing table to determine that the network level address of the second network device R3 of the next hop corresponding to the data packet is 1.1. The address field addition method is executed first, and it is judged that address field addition is not required for a variable-length source address and a variable-length destination address in a data packet. And then, executing the address field deleting method, and judging that the address field deleting is not needed to be carried out on the variable-length source address and the variable-length destination address in the data packet. Then R8 may forward the data packet directly to R3.
Then, R3 looks up the routing table to determine that the network level address of the second network device R9 of the next hop corresponding to the data packet is 2. The method of address field appending is performed first. Address segments are acquired one by one backward starting from the 1 st first address segment in the network level address 1.1 of R3 and the 1 st second address segment in the network level address of R9, respectively. Before the network region level corresponding to the first address field to be acquired is 2, acquiring one first address field and one second address each timeAnd comparing the currently acquired first address field with the second address field. For this example, only the 1 st first address field 1 and the 1 st second address field 2 need to be compared. And the currently acquired first address field 1 is different from the currently acquired second address field 2, the acquisition of the first address field and the second address field is stopped, and the network area level 1 corresponding to the currently acquired first address field is determined. The 1 st to 1 st address fields in the network level address of the first network device are determined as supplementary address fields. That is, the 1 st address field 1 in the network level address of the first network device is determined as the supplementary address field. An additional address field is added at the front end of the variable-length source address and the variable-length destination address. The source address of the variable length after the address appending processing is obtained as 1.1.1.1.1.10The destination address of the variable length after the supplement processing is 1.2.1.2.10. And updates the first level identification to 1. After the address field is supplemented, the method of deleting the address field is not executed any more. The processed data packet is forwarded to R9.
Then, R9 looks up the routing table to determine that the network level address of the second network device R7 of the next hop corresponding to the data packet is 1.2.1. The method of address field addition is executed first, and it is judged that address field addition processing is not required. And then, the method for deleting the address field is executed, and the variable-length source address obtained after the address field deleting processing is 1.1.1.1.10The length-variable destination address after the address field deletion processing is 2.1.2.10. And updates the first level identification to 2. The processed data packet is forwarded to R7.
Finally, R7 queries the routing table to determine that the next hop corresponding to the data packet is the destination network device C2, and then the data packet can be directly forwarded to C2.
Corresponding to the second case, the indication information includes the second level identifier and the third level identifier.
And determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network equipment, the second level identification and the network level address of the second network equipment, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address. And if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
And determining whether the variable-length source address meets the second address field addition condition or not based on the network level address of the first network equipment, the third level identification and the network level address of the second network equipment, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address. And if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address and the second level identification of the second network equipment.
The description will be given by taking an example that the second level identifier is used to indicate the network area level M corresponding to the start address segment in the variable length destination address, and the third level identifier is used to indicate the network area level N corresponding to the start address segment in the variable length destination address.
First, the address field addition processing for the variable-length source address and the variable-length destination address may have the following method.
Respectively obtaining address fields one by one from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment. Each time a first address field and a second address field are fetched, the currently fetched first address field and second address field are compared. And when the currently acquired first address field is different from the currently acquired second address field, stopping acquiring the first address field and the second address field, judging that the variable-length destination address meets the first address field supplement condition, and determining the network area grade X' corresponding to the currently acquired first address field. The Xth' address field to the M-1 address field in the network level address of the first network device are determined as supplementary address fields, and are added to the front end of the variable-length destination address.
And after the network area grade corresponding to the currently acquired first address field is M-1, stopping acquiring the first address field and the second address field, and judging that the variable-length destination address does not meet the first address field supplement condition, then executing the method for deleting the address field of the variable-length destination address in the second step.
Respectively obtaining address fields one by one from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment. Each time a first address field and a second address field are fetched, the currently fetched first address field and second address field are compared. And when the currently acquired first address field is different from the currently acquired second address field, stopping acquiring the first address field and the second address field, judging that the variable-length source address meets the supplement condition of the second address field, and determining the network area grade X' corresponding to the currently acquired first address field. The xth' address segment through the (N-1) address segment in the network level address of the first network device is determined as the second supplementary address segment.
A second supplementary address field is added at the front of the variable length source address. And after the network area grade corresponding to the currently acquired first address field is N-1, stopping acquiring the first address field and the second address field, and judging that the variable-length source address does not meet the second address field addition condition, then executing the method for deleting the address field of the variable-length source address in the second step.
Second, the address field reduction processing for the variable-length source address and the variable-length destination address may be as follows.
The smaller number P' of the number of address segments of the destination address and the number of address segments of the network level address of the second network device is determined. The address fields are acquired one by one backward starting from the Mth second address field in the network level address of the second network device and the 1 st third address field in the variable-length destination address, respectively. Each time a second address field and a third address field are acquired, the currently acquired second address field and third address field are compared. And when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level corresponding to the currently acquired second address field. And stopping acquiring the second address field and the third address field after the network area grade corresponding to the acquired second address field is P ', and determining a first network area grade Y' corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field. And deleting the address segment from the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1.
The smaller number Q' of the number of address segments of the source address and the number of address segments of the network class address of the second network device is determined. And respectively acquiring address fields backwards one by one from the Nth second address field in the network level address of the second network equipment and the 1 st fourth address field in the variable-length source address. When a second address field and a fourth address field are acquired, the currently acquired second address field and the fourth address field are compared. And when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field. And stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the acquired second address field is Q ', and determining a second network area grade Y' corresponding to the address field next to the currently acquired second address field if the currently acquired second address field is the same as the fourth address field. And deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
The address field addition processing and the address field deletion processing of the variable-length source address and the variable-length destination address described above will be described below with reference to the packet network shown in fig. 1, taking the transmission of a data packet in the hierarchical network shown in fig. 1 as an example.
The network address, the network level address, and the network area address of each network device are the same as those in the above example corresponding to the first case, and the transmission path of the data packet is also: C1-R8-R3-R9-R7-C2.
Source network device C1 may generate a data packet with a first level identification of 1, i.e., the starting address segment indicating the variable length source address and the variable length destination address corresponds to a network area level of 1. The variable length source address is 1.1.1.1.1.10Destination of variable lengthThe address is 1.2.1.2.10. And inquiring the routing table to determine that the network level address of the second network device R8 of the next hop is 1.1.1.1. Then, the above method of deleting address segments may be used to delete the variable-length source address and the variable-length destination address. The length-variable destination address obtained after the deletion of the address field is 2.1.2.10And the source address with variable length after the deletion of the address field is 1.10The second level identification is updated to be 2 and the third level identification is updated to be 5. The processed data packet is sent to R8.
Then, R8 looks up the routing table to determine that the network level address of the second network device R3 of the next hop corresponding to the data packet is 1.1. The address field appending method is first executed separately for the variable-length source address and the variable-length destination address. And judging that the destination address with variable length does not need to be supplemented with the address field. And then, judging that the long-length destination address does not need to be subjected to address segment deletion processing by using the method for deleting the address segment pointed by the long-length destination address. For the source address with variable length, the address field is added to become 1.1.1.10. The method of address segment pruning is no longer performed for variable length source addresses. The third level identification is updated to 3. The processed data packet is forwarded to R3.
Then, R3 looks up the routing table to determine that the network level address of the second network device R9 of the next hop corresponding to the data packet is 2. The address field appending method is first executed separately for the variable-length source address and the variable-length destination address. The variable-length destination address obtained after the address field supplement processing is 1.2.1.2.10The source address of the address field is 1.1.1.1.1.10. The second level identification is updated to be 1 and the third level identification is updated to be 1. The processed data packet is forwarded to R9.
Then, R9 looks up the routing table to determine that the network level address of the second network device R7 of the next hop corresponding to the data packet is 1.2.1. The method for adding address field is executed to the source address and destination address of variable length separately, and it is judged that the address field adding process is not needed. And then, executing the method for deleting the address segment on the variable-length source address and the variable-length destination address respectively to obtain the variable-length destination address of 2 after the address segment is deleted.10The source address of the variable length after the address field deletion is 1.1.1.1.10. And updates the second level identification to 4 and the third level identification to 2. The processed data packet is forwarded to R7.
Finally, R7 queries the routing table to determine that the next hop corresponding to the data packet is the destination network device C2, and then the data packet can be directly forwarded to C2.
Here, in the above-described address field addition/subtraction processing for the variable-length source address and the variable-length destination address in the data packet, the address field addition is performed first, and if the address field addition condition is satisfied, the address field addition processing is performed without performing the address field deletion. If the address field addition condition is not satisfied, a method of address field pruning is performed. Besides, the method of deleting address field can be executed first, if the condition of deleting address field is satisfied, the deleting process is executed, and the method of appending address field is not executed any more. If the address field pruning condition is not satisfied, a method of address field appending is performed. Alternatively, the address field appending method and the address field puncturing method may also be performed in parallel. No matter which execution sequence is adopted, only address field addition processing or address field deletion processing is carried out or not carried out on the variable-length source address and the variable-length destination address, and the situation that both address field addition processing and address field deletion processing are carried out cannot occur.
In one possible implementation, when the source network device performs address segment reduction processing on the variable source address and the variable destination address in the data packet, the processing method may be as follows. Here, the variable source address and the variable destination address in the data packet are the source address and the destination address when the address field is not deleted in the source network device.
And corresponding to the first condition, the indication information comprises a first grade mark.
The smaller number a of the number of address segments of the source address and the number of address segments of the destination address is determined. And respectively starting from the 1 st fifth address field in the destination address and the 1 st sixth address field in the source address to acquire the address fields one by one backwards. And comparing the currently acquired fifth address field with the sixth address field every time one fifth address field and one sixth address field are acquired. If the address segments are the same when the A-2 is compared, the A-1 address segments and all the address segments after the A-1 address segments in the source address and the destination address are reserved, and the rest address segments are deleted. If the Bth fifth address field is different from the Bth sixth address field, wherein B < (A-2), the Bth address field and all the address fields after the Bth address field in the source address and the destination address are reserved, and the rest address fields are deleted.
Corresponding to the second case, the indication information includes the second level identifier and the third level identifier.
The number of address segments of the source address is determined to be m, the number of address segments of the destination address is determined to be n, and the smaller number of the two is determined to be A. For the source address, only the m-1 th address field and the m-th address field can be reserved, and the rest address fields are deleted. For the destination address, the address segments are acquired one by one from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address respectively. And comparing the currently acquired fifth address field with the sixth address field every time one fifth address field and one sixth address field are acquired. If the address segments are the same when the A-2 is compared, the A-1 address segments and all the address segments after the A-1 address segments in the source address and the destination address are reserved, and the rest address segments are deleted. If the Bth fifth address field is different from the Bth sixth address field, wherein B < (A-2), the Bth address field and all the address fields after the Bth address field in the source address and the destination address are reserved, and the rest address fields are deleted.
As shown in fig. 5, for a method for data transmission provided in this embodiment of the present application, the method may be implemented by a source network device, and a processing flow of the method may include the following steps:
step 501, obtaining a source address and a destination address of data to be sent.
In implementation, the source network device may obtain data to be sent corresponding to a certain service. According to the service requirement, the destination network device for receiving the data can be determined, and the network address of the destination network device, namely the destination address, can be further determined. And the network address of the source network device is the source address.
Step 502, based on the source address and the destination address, generating a variable length source address, a variable length destination address and corresponding indication information.
The network area level indicating method comprises the steps of obtaining a variable-length source address, a variable-length destination address and indicating information, wherein the variable-length source address is obtained by deleting a front partial address section or a non-deleted address section from a source address of a data packet, the variable-length destination address is obtained by deleting a front partial address section or a non-deleted address section from a destination address of the data packet, and the indicating information is used for indicating the network area level corresponding to a starting address section of the variable-length source address and the variable-length destination address.
In implementation, before encapsulating data, the source network device may simplify the source address and the destination address to obtain the variable-length source address and the variable-length destination address, and may also obtain indication information indicating a network area level corresponding to a start address field in the variable-length source address and the variable-length destination address. The source address and destination address simplifications may also be different according to different situations of the indication information, and are described below separately for several different situations of the indication information.
In case one, the indication information includes a first rank indicator, where the first rank indicator is used to indicate a network area rank corresponding to a start address segment in the variable-length source address and is also used to indicate a network area rank corresponding to a start address segment in the variable-length destination address.
In this case, simplification of the source address and the destination address may be handled as follows:
the smaller number a of the number of address segments of the source address and the number of address segments of the destination address is determined. And respectively starting from the 1 st fifth address field in the destination address and the 1 st sixth address field in the source address to acquire the address fields one by one backwards. And comparing the currently acquired fifth address field with the sixth address field every time one fifth address field and one sixth address field are acquired. And when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field. And after the network area grade corresponding to the currently acquired fifth address field is A-2, stopping acquiring the fifth address field and the sixth address field, and if the currently acquired fifth address field is the same as the sixth address field, determining a third network area grade B corresponding to a next address field of the currently acquired fifth address field. Deleting the 1 st address segment in the source address and the destination address to the address segment corresponding to the network area level B-1 to obtain a variable length source address and a variable length destination address, and determining a first level identification corresponding to the network area level B.
For example, the source address is 1.2.3.4.5, the destination address is 1.2.6.7, and the smaller number of address segments is 4. And respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain the address segments one by one backwards, and comparing the currently obtained fifth address segment with the currently obtained sixth address segment when one fifth address segment and one sixth address segment are obtained. And acquiring the 1 st fifth address field and the 1 st sixth address field for comparison, wherein the two are the same. And then obtaining the 2 nd fifth address field and the 2 nd sixth address field for comparison, wherein the two are the same. Because the currently acquired fifth address segment is ranked 2, i.e., a-2, for the network area. Stopping or address segment, and determining that the third network area grade corresponding to the address segment next to the currently acquired fifth address segment is 3. Then, the address segment corresponding to the 1 st address segment in the source address and the destination address to the network area level 2, i.e. B-1, may be deleted to obtain the variable length source address 3.4.5 and the variable length destination 6.7, and the first level identifier corresponding to the network area level 3 corresponding to the start address segment of the variable length source address and the variable length destination address may be determined. It should be noted that the rank indicator may be represented by a corresponding network area rank, that is, for the network area rank 3, the corresponding first rank indicator is 3.
And in case two, the indication information comprises a second level identifier and a third level identifier, the second level identifier is used for indicating the network area level corresponding to the starting address field in the variable-length source address, and the third level identifier is used for indicating the network area level corresponding to the starting address field in the variable-length destination address.
In this case, simplification of the source address and the destination address may be handled as follows:
simplifying the source address: deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to the initial address section in the variable-length source address.
The destination address is simplified: the smaller number a of the number of address segments of the source address and the number of address segments of the destination address is determined. And respectively starting from the 1 st fifth address field in the destination address and the 1 st sixth address field in the source address to acquire the address fields one by one backwards. And comparing the currently acquired fifth address field with the sixth address field every time one fifth address field and one sixth address field are acquired. And when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field. And after the network area grade corresponding to the currently acquired fifth address field is A-2, stopping acquiring the fifth address field and the sixth address field, and if the currently acquired fifth address field is the same as the sixth address field, determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field. Deleting the 1 st address segment in the source address and the destination address to the address segment corresponding to the network area level B-1 to obtain the variable length destination address, and determining the second level identification corresponding to the initial address segment in the variable length destination address.
For example, the source address is 1.2.3.4.5, the destination address is 1.2.6.7, and the smaller number of address segments is 4.
For source address simplification: and reserving the last two address sections in the source address, deleting the rest address sections to obtain a variable-length source address of 4.5, and determining a third level identifier corresponding to a network area level 4 corresponding to the initial address section of the variable-length source address.
Simplification for the destination address: and respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain the address segments one by one backwards, and comparing the currently obtained fifth address segment with the currently obtained sixth address segment when one fifth address segment and one sixth address segment are obtained. And acquiring the 1 st fifth address field and the 1 st sixth address field for comparison, wherein the two are the same. And then obtaining the 2 nd fifth address field and the 2 nd sixth address field for comparison, wherein the two are the same. Because the currently acquired fifth address segment is ranked 2, i.e., a-2, for the network area. Stopping or address segment, and determining that the third network area grade corresponding to the address segment next to the currently acquired fifth address segment is 3. Then, the 1 st address segment in the destination address may be deleted to the address segment corresponding to the network area level 2 (i.e., B-1), so as to obtain the variable-length destination address 6.7, and determine the second level identifier corresponding to the network area level 3 corresponding to the start address segment of the variable-length destination address. It should be noted that the rank indicator may be represented by a corresponding network area rank, for example, for network area rank 3, the corresponding rank indicator may be 3.
Step 503, generating a data packet carrying the data, the variable length source address, the variable length destination address and the indication information.
In implementation, after determining the data packet with the variable-length source address, the variable-length destination address and the indication information, the data may be encapsulated to obtain the data packet carrying the variable-length source address, the variable-length destination address and the indication information in the network layer protocol header.
Step 504, sending the data packet based on the destination address.
In implementation, the routing table is queried according to the destination address to determine a destination port, and the data packet is sent to the network device of the next hop corresponding to the data packet through the destination port.
According to the embodiment of the application, the data packet carries the variable-length source address, the variable-length destination address and the indication information. The variable length source address comprises a part of or all address sections in the source address, the variable length destination address comprises a part of or all address sections in the destination address, and the indication information is used for indicating the network area grade corresponding to the starting address section in the variable length source address and the variable length destination address. It can be seen that there is no need to carry the complete destination address and the complete source address in the data packet. After receiving the data packet, the network device increases or decreases the variable-length source address and the variable-length destination address carried in the data packet, and then transmits the data packet. Therefore, the data packet does not need to carry a complete destination address and a complete source address, and the sending efficiency of the network equipment to the data packet can be effectively improved.
The embodiment of the present application further provides a data transmission method, in the method, a data packet may not carry a variable-length source address, and a processing flow of the method may include the following steps:
step 601, obtaining a data packet, where the data packet carries a variable length destination address and indication information, the variable length destination address is obtained by deleting a partial address field or a non-deleted address field at a front end from a destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field in the variable length destination address.
For the specific processing of this step 601, reference may be made to the above-mentioned embodiment of acquiring the data packet in step 201.
Step 602, determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information.
For a specific processing manner of this step 602, refer to the above-mentioned implementation manner of determining the network level address of the second network device in step 202.
Step 603, based on the network level address and the indication information of the second network device, performing address segment increase and decrease processing on the variable-length destination address in the data packet, updating the indication information in the data packet to obtain a processed data packet, and sending the processed data packet to the second network device.
For a specific processing manner of this step 603, refer to the above-mentioned embodiment of increasing or decreasing the address field of the variable-length destination address in step 203.
Based on the same technical concept, an embodiment of the present application further provides an apparatus for data transmission, as shown in fig. 6, the apparatus includes: an obtaining module 610, a determining module 620, a processing module 630 and a sending module 640, wherein:
an obtaining module 610, configured to obtain a data packet, where the data packet carries a variable-length source address, a variable-length destination address, and indication information, the variable-length source address includes part or all of address segments in the source address of the data packet, the variable-length destination address includes part or all of address segments in the destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address segment in the variable-length source address and the variable-length destination address. The obtaining function in step 201 and other implicit steps may be implemented specifically.
A determining module 620, configured to determine, based on the variable length destination address and the indication information, a network level address of a second network device of a next hop corresponding to the data packet. The determination in step 202, as well as other implicit steps, may be implemented in particular.
A processing module 630, configured to perform address segment increase and decrease processing on the variable-length source address and the variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and perform update processing on the indication information in the data packet to obtain a processed data packet. The processing function in step 203, as well as other implicit steps, may be implemented specifically.
A sending module 640, configured to send the processed data packet to the second network device. The sending function in step 203, as well as other implicit steps, may be implemented specifically.
In a possible implementation manner, the processing module 630 is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the indication information.
In a possible implementation manner, the processing module 630 is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length source address and the variable-length destination address;
and if the address field deleting condition is not met, address field supplementing processing is carried out on the variable-length source address and the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
In a possible implementation manner, the indication information includes a first level identifier, where the first level identifier is used to indicate a network area level L corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the processing module 630 is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the first level identification and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the first level identification.
In a possible implementation manner, the processing module 630 is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front ends of the variable-length source address and the variable-length destination address.
In a possible implementation manner, the processing module 630 is configured to:
after the network area level corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, and not performing address field supplement processing on the variable-length source address and the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
determining a smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st fourth address field in the variable-length source address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a fourth address field every time one second address field and one fourth address field are acquired;
when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field;
determining a smaller network area rank Y of the first network area rank and the second network area rank;
and deleting the 1 st address segment in the variable-length source address and the variable-length destination address to an address segment corresponding to the network area level Y-1.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level M corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level N corresponding to a start address segment in the variable-length destination address;
the processing module 630 is configured to:
determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network device, the second level identification and the network level address of the second network device, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address;
determining whether the variable-length source address meets a second address field addition condition or not based on the network level address of the first network device, the third level identification and the network level address of the second network device, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address;
if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the second level identification;
and if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
In a possible implementation manner, the processing module 630 is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
determining the Xth' address field to the M-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address;
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
the Xth' address field to the N-1 th address field in the network level address of the first network device are determined as supplementary address fields and added to the front end of the variable length source address.
In a possible implementation manner, the processing module 630 is configured to:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is M-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Mth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level Y' corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the third address segment after the network area grade corresponding to the acquired second address segment is P ', and determining a first network area grade Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the third address segment;
deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1;
if the variable-length source address does not satisfy the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network device and the third level identifier, including:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is N-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number Q' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Nth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the fourth address segment after the network area level corresponding to the acquired second address segment is Q ', and determining a second network area level Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the fourth address segment;
and deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
In a possible implementation manner, the determining module 620 is configured to:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending module is configured to:
and sending the processed data packet to the second network equipment through the target port.
In a possible implementation manner, the determining module 620 is configured to:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
In a possible implementation manner, the determining module 620 is configured to:
sending a network level address acquisition request to the second network device through the target port
And receiving the network level address of the second network equipment returned by the second network equipment.
It should be noted that, when the data transmission apparatus provided in the foregoing embodiment performs data transmission, only the division of the functional modules is illustrated, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the first network device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the data transmission device and the data transmission method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Based on the same technical concept, an embodiment of the present application further provides an apparatus for data transmission, as shown in fig. 7, the apparatus includes: an obtaining module 710, a determining module 720, a generating module 730 and a sending module 740, wherein:
the obtaining module 710 is configured to obtain a source address and a destination address of data to be sent. The obtaining function in step 501 and other implicit steps may be implemented specifically.
A determining module 720, configured to generate a variable-length source address, a variable-length destination address, and corresponding indication information based on the source address and the destination address, where the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at a front end from the source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at a front end from the destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field of the variable-length source address and the variable-length destination address. The determination function in step 501, and other implicit steps may be implemented specifically.
The generating module 730 is configured to generate a message carrying the data, the variable-length source address, the variable-length destination address, and the indication information, and may specifically implement the generating function in step 503, and other implicit steps.
A sending module 740, configured to send the data packet based on the destination address. The sending function in step 504 described above, as well as other implicit steps, may be implemented in particular.
In a possible implementation manner, the indication information includes a first rank indicator, where the first rank indicator is used to indicate a network area rank corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the determining module 720 is configured to:
and generating a variable-length source address, a variable-length destination address and a corresponding first-level identification based on the source address and the destination address.
In a possible implementation manner, the determining module 720 is configured to:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable-length source address and a variable-length destination address, and determining a first level identifier corresponding to the network area level B.
In a possible implementation manner, the indication information includes a second level identifier and a third level identifier, where the second level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length source address, and the third level identifier is used to indicate a network area level corresponding to a start address segment in the variable-length destination address;
the determining module 720 is configured to:
generating a variable-length source address and a corresponding third-level identification based on the source address;
and generating a variable-length destination address and a corresponding second-level identification based on the source address and the destination address.
In a possible implementation manner, the determining module 720 is configured to:
deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to an initial address section in the variable-length source address;
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable length destination address, and determining a second level identifier corresponding to a starting address segment in the variable length destination address.
It should be noted that, when the apparatus for data transmission provided in the foregoing embodiment performs data transmission, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the source network device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the data transmission device and the data transmission method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 8 is a schematic diagram of a network device 800 according to an embodiment of the present application, where the network device 800 may be a first network device in the foregoing embodiment. The network device 800 may be used in the hierarchical network shown in fig. 1. Operations performed by a first network device in the method for data transmission shown in fig. 2. As shown in fig. 8, network device 800 may include a processor 810, a memory 820 coupled to processor 810, and a transceiver 830. The processor 810 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP. The processor may further include a hardware chip. The hardware chip may be an Application Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a Field Programmable Gate Array (FPGA), or any combination thereof. Processor 810 may refer to a single processor or may include multiple processors. The memory 820 may include a volatile memory (RAM), such as a Random Access Memory (RAM); the memory may also include non-volatile memory, such as Read Only Memory (ROM); the memory may also comprise a combination of memories of the kind described above. The memory 820 may refer to one memory or may include a plurality of memories. The memory 820 stores computer readable instructions, and the processor 810, after executing the computer readable instructions in the memory 820, may perform all operations that the first network device may perform according to the instructions of the computer readable instructions. For example, the operations performed by the first network device in the embodiment corresponding to fig. 1.
Fig. 9 is a schematic diagram of a source network device 900 according to an embodiment of the present application. The source network device 900 may be employed in the hierarchical network shown in fig. 1. The operations performed by the source network device in the method for data transmission shown in fig. 5. As shown in fig. 9, the source network device 900 may include a processor 910, a memory 920 coupled to the processor 910, and a transceiver 930. The processor 910 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP. The processor may further include a hardware chip. The hardware chip may be an Application Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a Field Programmable Gate Array (FPGA), or any combination thereof. The processor 910 may refer to a single processor or may include multiple processors. Memory 920 may include volatile memory, such as Random Access Memory (RAM); the memory may also include non-volatile memory, such as Read Only Memory (ROM); the memory may also comprise a combination of memories of the kind described above. The memory 920 may refer to one memory, or may include a plurality of memories. The memory 920 stores computer readable instructions, and after the processor 910 executes the computer readable instructions in the memory 920, all operations that the first network device can perform may be performed according to the instructions of the computer readable instructions. For example, the operations performed by the source network device in the embodiment corresponding to fig. 5.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any combination thereof, and when the implementation is realized by software, all or part of the implementation may be realized in the form of a computer program product. The computer program product comprises one or more computer program instructions which, when loaded and executed on a device, cause a process or function according to an embodiment of the application to be performed, in whole or in part. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optics, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by the device or a data storage device, such as a server, a data center, etc., that is integrated into one or more available media. The usable medium may be a magnetic medium (such as a floppy Disk, a hard Disk, a magnetic tape, etc.), an optical medium (such as a Digital Video Disk (DVD), etc.), or a semiconductor medium (such as a solid state Disk, etc.).
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only one embodiment of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (36)

1. A method for data transmission, the method being applied to a first network device, the method comprising:
acquiring a data packet, wherein the data packet carries a variable-length source address, a variable-length destination address and indication information, the variable-length source address comprises part or all address sections of the source address of the data packet, the variable-length destination address comprises part or all address sections of the destination address of the data packet, and the indication information is used for indicating the network area grade corresponding to a starting address section in the variable-length source address and the variable-length destination address;
determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information;
performing address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and performing update processing on the indication information in the data packet to obtain a processed data packet;
and sending the processed data packet to the second network equipment.
2. The method according to claim 1, wherein the performing address field increase/decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network class address of the second network device and the indication information comprises:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the indication information.
3. The method according to claim 1, wherein the performing address field increase/decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network class address of the second network device and the indication information comprises:
determining whether the variable-length source address and the variable-length destination address meet an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length source address and the variable-length destination address;
and if the address field deleting condition is not met, address field supplementing processing is carried out on the variable-length source address and the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
4. The method of claim 2, wherein the indication information comprises a first class identifier, and wherein the first class identifier is used to indicate a network area class L corresponding to a starting address segment in the variable-length source address and the variable-length destination address;
the determining whether the variable-length source address and the variable-length destination address satisfy an address field addition condition based on the network hierarchy address of the first network device, the indication information, and the network hierarchy address of the second network device, and if the address field addition condition is satisfied, performing address field addition processing on the variable-length source address and the variable-length destination address, includes:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition based on the network level address of the first network device, the first level identification and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
if the address field addition condition is not satisfied, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network device and the indication information, including:
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the first level identification.
5. The method of claim 4, wherein determining whether the variable-length source address and the variable-length destination address satisfy an address field addition condition based on the network hierarchy address of the first network device, the first hierarchy identification, and the network hierarchy address of the second network device, and if the address field addition condition is satisfied, performing address field addition processing on the variable-length source address and the variable-length destination address comprises:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front ends of the variable-length source address and the variable-length destination address.
6. The method of claim 5, wherein the performing address segment reduction processing on the variable length source address and the variable length destination address based on the network class address of the second network device and the first class identifier if the address segment appending condition is not satisfied comprises:
after the network area level corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, and not performing address field supplement processing on the variable-length source address and the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
determining a smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st fourth address field in the variable-length source address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a fourth address field every time one second address field and one fourth address field are acquired;
when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field;
determining a smaller network area rank Y of the first network area rank and the second network area rank;
and deleting the 1 st address segment in the variable-length source address and the variable-length destination address to an address segment corresponding to the network area level Y-1.
7. The method according to claim 2, wherein the indication information includes a second level identifier and a third level identifier, the second level identifier is used to indicate a network area level M corresponding to a start address segment in the variable length source address, and the third level identifier is used to indicate a network area level N corresponding to a start address segment in the variable length destination address;
the address field appending processing is performed on the variable length source address and the variable length destination address based on the network level address of the first network device, the indication information, and the network level address of the second network device, and includes:
determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network device, the second level identification and the network level address of the second network device, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address;
determining whether the variable-length source address meets a second address field addition condition or not based on the network level address of the first network device, the third level identification and the network level address of the second network device, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address;
if the address field addition condition is not satisfied, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network device and the indication information, including:
if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the second level identification;
and if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
8. The method of claim 7, wherein determining whether the variable length destination address satisfies a first address field addition condition based on the network level address of the first network device, the second level identification, and the network level address of the second network device, and if the variable length destination address satisfies the first address field addition condition, performing address field addition processing on the variable length destination address comprises:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
determining the Xth' address field to the M-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address;
the determining, based on the network level address of the first network device, the third level identifier, and the network level address of the second network device, whether the variable-length source address satisfies a second address field addition condition, and if the variable-length source address satisfies the second address field addition condition, performing address field addition processing on the variable-length source address, including:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
the Xth' address field to the N-1 th address field in the network level address of the first network device are determined as supplementary address fields and added to the front end of the variable length source address.
9. The method of claim 8, wherein the performing address field pruning on the variable length destination address based on the network level address of the second network device and the second level identification if the variable length destination address does not satisfy the first address field appending condition comprises:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is M-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Mth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level Y' corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the third address segment after the network area grade corresponding to the acquired second address segment is P ', and determining a first network area grade Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the third address segment;
deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1;
if the variable-length source address does not satisfy the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network device and the third level identifier, including:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is N-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number Q' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Nth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the fourth address segment after the network area level corresponding to the acquired second address segment is Q ', and determining a second network area level Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the fourth address segment;
and deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
10. The method according to any of claims 1-9, wherein the determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information comprises:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending the processed data packet to the second network device includes:
and sending the processed data packet to the second network equipment through the target port.
11. The method of claim 10, wherein obtaining the network level address of the second network device based on the destination port comprises:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
12. The method of claim 10, wherein obtaining the network level address of the second network device based on the destination port comprises:
sending a network level address acquisition request to the second network equipment through the target port;
and receiving the network level address of the second network equipment returned by the second network equipment.
13. A method for data transmission, the method being applied to a source network device, the method comprising:
acquiring a source address and a destination address of data to be sent;
generating a variable-length source address, a variable-length destination address and corresponding indication information based on the source address and the destination address, wherein the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at the front end in the source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at the front end in the destination address of the data packet, and the indication information is used for indicating the network area level corresponding to the starting address field in the variable-length source address and the variable-length destination address;
generating a data packet carrying the data, the variable-length source address, the variable-length destination address and the indication information;
transmitting the data packet based on the destination address.
14. The method of claim 13, wherein the indication information comprises a first class identifier indicating a class of a network area corresponding to a starting address segment of the variable-length source address and the variable-length destination address;
the generating a variable length source address, a variable length destination address and corresponding indication information based on the source address and the destination address comprises:
and generating a variable-length source address, a variable-length destination address and a corresponding first-level identification based on the source address and the destination address.
15. The method of claim 14, wherein generating a variable length source address, a variable length destination address, and a corresponding first level identification based on the source address and the destination address comprises:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable-length source address and a variable-length destination address, and determining a first level identifier corresponding to the network area level B.
16. The method according to claim 13, wherein the indication information includes a second level identifier and a third level identifier, the second level identifier is used to indicate a network area level corresponding to a start address segment in the variable length source address, and the third level identifier is used to indicate a network area level corresponding to a start address segment in the variable length destination address;
the generating a variable length source address, a variable length destination address and corresponding indication information based on the source address and the destination address comprises:
generating a variable-length source address and a corresponding third-level identification based on the source address;
and generating a variable-length destination address and a corresponding second-level identification based on the source address and the destination address.
17. The method of claim 15, wherein generating a variable-length source address and a corresponding third-level identifier based on the source address comprises:
deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to an initial address section in the variable-length source address;
generating a variable-length destination address and a corresponding third-level identifier based on the source address and the destination address, including:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable length destination address, and determining a second level identifier corresponding to a starting address segment in the variable length destination address.
18. An apparatus for data transmission, the apparatus comprising:
an obtaining module, configured to obtain a data packet, where the data packet carries a variable-length source address, a variable-length destination address, and indication information, the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at a front end from a source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at a front end from a destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field in the variable-length source address and the variable-length destination address;
a determining module, configured to determine, based on the variable-length destination address and the indication information, a network level address of a second network device of a next hop corresponding to the data packet;
a processing module, configured to perform address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and perform update processing on the indication information in the data packet to obtain a processed data packet;
a sending module, configured to send the processed data packet to the second network device.
19. The apparatus of claim 18, wherein the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address segment deletion condition or not based on the network level address of the second network device and the indication information, and if the address segment deletion condition is met, performing address segment deletion processing on the variable-length source address and the variable-length destination address;
and if the address field deleting condition is not met, address field supplementing processing is carried out on the variable-length source address and the variable-length destination address based on the network level address of the first network equipment, the indication information and the network level address of the second network equipment.
20. The apparatus of claim 18, wherein the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the indication information and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the indication information.
21. The apparatus of claim 20, wherein the indication information comprises a first class identifier, and wherein the first class identifier is used to indicate a network area class L corresponding to a starting address segment of the variable-length source address and the variable-length destination address;
the processing module is configured to:
determining whether the variable-length source address and the variable-length destination address meet an address field addition condition or not based on the network level address of the first network device, the first level identification and the network level address of the second network device, and if the address field addition condition is met, performing address field addition processing on the variable-length source address and the variable-length destination address;
and if the address field supplement condition is not met, performing address field deletion processing on the variable-length source address and the variable-length destination address based on the network level address of the second network equipment and the first level identification.
22. The apparatus of claim 21, wherein the processing module is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X corresponding to the first address field obtained currently;
and determining the Xth address field to the L-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front ends of the variable-length source address and the variable-length destination address.
23. The apparatus of claim 22, wherein the processing module is configured to:
after the network area level corresponding to the currently acquired first address field is L-1, stopping acquiring the first address field and the second address field, and not performing address field supplement processing on the variable-length source address and the variable-length destination address;
determining a smaller number P of the number of address segments of the destination address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the third address field after the network area grade corresponding to the currently acquired second address field is P, and determining a first network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the third address field;
determining a smaller number Q of the number of address segments of the source address and the number of address segments of the network level address of the second network device;
respectively starting from an L-th second address field in the network level address of the second network equipment and a 1 st fourth address field in the variable-length source address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a fourth address field every time one second address field and one fourth address field are acquired;
when the currently acquired second address field is different from the currently acquired fourth address field, stopping acquiring the second address field and the fourth address field, and determining a second network area grade corresponding to the currently acquired second address field;
stopping acquiring the second address field and the fourth address field after the network area grade corresponding to the currently acquired second address field is P, and determining a second network area grade corresponding to a next address field of the currently acquired second address field if the currently acquired second address field is the same as the fourth address field;
determining a smaller network area rank Y of the first network area rank and the second network area rank;
and deleting the 1 st address segment in the variable-length source address and the variable-length destination address to an address segment corresponding to the network area level Y-1.
24. The apparatus according to claim 20, wherein the indication information includes a second level flag and a third level flag, the second level flag is used to indicate a network area level M corresponding to a start address segment in the variable length source address, and the third level flag is used to indicate a network area level N corresponding to a start address segment in the variable length destination address;
the processing module is configured to:
determining whether the variable-length destination address meets a first address field addition condition or not based on the network level address of the first network device, the second level identification and the network level address of the second network device, and if the variable-length destination address meets the first address field addition condition, performing address field addition processing on the variable-length destination address;
determining whether the variable-length source address meets a second address field addition condition or not based on the network level address of the first network device, the third level identification and the network level address of the second network device, and if the variable-length source address meets the second address field addition condition, performing address field addition processing on the variable-length source address;
if the variable-length destination address does not meet the first address field supplement condition, performing address field deletion processing on the variable-length destination address based on the network level address of the second network equipment and the second level identification;
and if the variable-length source address does not meet the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network equipment and the third level identification.
25. The apparatus of claim 24, wherein the processing module is configured to:
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
determining the Xth' address field to the M-1 address field in the network level address of the first network equipment as supplementary address fields, and adding the supplementary address fields to the front end of the variable-length destination address;
respectively starting from the 1 st first address field in the network level address of the first network equipment and the 1 st second address field in the network level address of the second network equipment to obtain address fields one by one backwards;
comparing the currently acquired first address field with the currently acquired second address field every time one first address field and one second address field are acquired;
when a first address field obtained currently is different from a second address field obtained currently, stopping obtaining the first address field and the second address field, and determining a network area level X' corresponding to the first address field obtained currently;
the Xth' address field to the N-1 th address field in the network level address of the first network device are determined as supplementary address fields and added to the front end of the variable length source address.
26. The apparatus of claim 25, wherein the processing module is configured to:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is M-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number P' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Mth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the third address field, and determining a first network area level Y' corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the third address segment after the network area grade corresponding to the acquired second address segment is P ', and determining a first network area grade Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the third address segment;
deleting the 1 st address segment in the variable-length destination address to the address segment corresponding to the network area level Y' -1;
if the variable-length source address does not satisfy the second address field addition condition, performing address field deletion processing on the variable-length source address based on the network level address of the second network device and the third level identifier, including:
stopping acquiring the first address field and the second address field after the network area grade corresponding to the currently acquired first address field is N-1, and not performing address field supplement processing on the variable-length destination address;
determining a smaller number Q' of the number of address segments of the destination address and the number of address segments of the network class address of the second network device;
respectively starting from the Nth second address field in the network level address of the second network equipment and the 1 st third address field in the variable-length destination address to obtain address fields one by one backwards;
comparing the currently acquired second address field with a third address field every time one second address field and one third address field are acquired;
when the currently acquired second address field is different from the currently acquired third address field, stopping acquiring the second address field and the fourth address field, and determining a second network area level corresponding to the currently acquired second address field;
stopping acquiring the second address segment and the fourth address segment after the network area level corresponding to the acquired second address segment is Q ', and determining a second network area level Y' corresponding to a next address segment of the currently acquired second address segment if the currently acquired second address segment is the same as the fourth address segment;
and deleting the 1 st address segment in the variable-length source address to the address segment corresponding to the network area level Y' -1.
27. The apparatus of any one of claims 18-26, wherein the determining module is configured to:
determining a destination address field before an address field corresponding to the network area level indicated by the indication information in the network level address of the first network device;
adding the destination address segment to the front end of the variable-length destination address to obtain the destination address;
determining a port identifier of a destination port used for sending the data packet in the first network equipment based on the destination address and a stored routing table, wherein the destination port is connected with a second network equipment of a next hop corresponding to the data packet;
acquiring a network level address of the second network equipment based on the port identification of the target port;
the sending module is configured to:
and sending the processed data packet to the second network equipment through the target port.
28. The apparatus of claim 27, wherein the determining module is configured to:
and acquiring a network level address corresponding to the port identifier of the target port in the stored corresponding relationship between the port identifier of each port of the first network device and the network level address of the network device connected with the port corresponding to each port identifier, wherein the network level address is used as the network level address of the second network device.
29. The apparatus of claim 27, wherein the determining module is configured to:
sending a network level address acquisition request to the second network device through the target port
And receiving the network level address of the second network equipment returned by the second network equipment.
30. An apparatus for data transmission, the apparatus comprising:
the acquisition module is used for acquiring a source address and a destination address of data to be sent;
a determining module, configured to generate a variable-length source address, a variable-length destination address, and corresponding indication information based on the source address and the destination address, where the variable-length source address is obtained by deleting a front partial address field or a non-deleted address field from the source address of the data packet, the variable-length destination address is obtained by deleting a front partial address field or a non-deleted address field from the destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field of the variable-length source address and the variable-length destination address;
a generating module, configured to generate a data packet carrying the data, the variable-length source address, the variable-length destination address, and the indication information;
a sending module for sending the data packet based on the destination address.
31. The apparatus of claim 30, wherein the indication information comprises a first class identifier indicating a class of a network region corresponding to a starting address segment of the variable-length source address and the variable-length destination address;
the determining module is configured to:
and generating a variable-length source address, a variable-length destination address and a corresponding first-level identification based on the source address and the destination address.
32. The apparatus of claim 31, wherein the determining module is configured to:
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable-length source address and a variable-length destination address, and determining a first level identifier corresponding to the network area level B.
33. The apparatus according to claim 30, wherein the indication information includes a second level flag and a third level flag, the second level flag is used to indicate a network area level corresponding to a start address segment in the variable length source address, and the third level flag is used to indicate a network area level corresponding to a start address segment in the variable length destination address;
the determining module is configured to:
generating a variable-length source address and a corresponding third-level identification based on the source address;
and generating a variable-length destination address and a corresponding second-level identification based on the source address and the destination address.
34. The apparatus of claim 33, wherein the determining module is configured to:
deleting address sections except the last two address sections in the source address to obtain a variable-length source address, and determining a third level identifier corresponding to an initial address section in the variable-length source address;
determining a smaller number A of the number of address segments of the source address and the number of address segments of the destination address;
respectively starting from the 1 st fifth address segment in the destination address and the 1 st sixth address segment in the source address to obtain address segments one by one backwards;
comparing the currently acquired fifth address field with the sixth address field when acquiring the fifth address field and the sixth address field;
when the currently acquired fifth address field is different from the currently acquired sixth address field, stopping acquiring the fifth address field and the sixth address field, and determining a third network area level B corresponding to the currently acquired fifth address field;
stopping acquiring the fifth address field and the sixth address field after the network area grade corresponding to the currently acquired fifth address field is A-2, and determining a third network area grade B corresponding to an address field next to the currently acquired fifth address field if the currently acquired fifth address field is the same as the sixth address field;
and deleting the 1 st address segment in the source address and the destination address to an address segment corresponding to a network area level B-1 to obtain a variable length destination address, and determining a second level identifier corresponding to a starting address segment in the variable length destination address.
35. A network device, characterized in that the network device comprises:
a transceiver, configured to obtain a data packet, where the data packet carries a variable-length source address, a variable-length destination address, and indication information, the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at a front end from a source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at a front end from a destination address of the data packet, and the indication information is used to indicate a network area level corresponding to a start address field in the variable-length source address and the variable-length destination address;
a memory comprising computer readable instructions;
a processor coupled to the memory and the transceiver, the processor configured to execute the computer-readable instructions to:
determining a network level address of a second network device of a next hop corresponding to the data packet based on the variable length destination address and the indication information;
performing address segment increase and decrease processing on a variable-length source address and a variable-length destination address in the data packet based on the network level address of the second network device and the indication information, and performing update processing on the indication information in the data packet to obtain a processed data packet;
the transceiver is further configured to send the processed data packet to the second network device.
36. A source network device, the source network device comprising:
the transceiver is used for acquiring a source address and a destination address of data to be transmitted;
a memory comprising computer readable instructions;
a processor coupled to the memory and the transceiver, the processor configured to execute the computer-readable instructions to:
generating a variable-length source address, a variable-length destination address and corresponding indication information based on the source address and the destination address, wherein the variable-length source address is obtained by deleting a partial address field or a non-deleted address field at the front end in the source address of the data packet, the variable-length destination address is obtained by deleting a partial address field or a non-deleted address field at the front end in the destination address of the data packet, and the indication information is used for indicating the network area level corresponding to the starting address field in the variable-length source address and the variable-length destination address;
generating a data packet carrying the data, the variable-length source address, the variable-length destination address and the indication information;
the transceiver is further configured to transmit the data packet based on the destination address.
CN202010043669.4A 2020-01-15 2020-01-15 Data transmission method and device Pending CN113132239A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010043669.4A CN113132239A (en) 2020-01-15 2020-01-15 Data transmission method and device
PCT/CN2021/071180 WO2021143660A1 (en) 2020-01-15 2021-01-12 Method and apparatus for data transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010043669.4A CN113132239A (en) 2020-01-15 2020-01-15 Data transmission method and device

Publications (1)

Publication Number Publication Date
CN113132239A true CN113132239A (en) 2021-07-16

Family

ID=76771623

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010043669.4A Pending CN113132239A (en) 2020-01-15 2020-01-15 Data transmission method and device

Country Status (2)

Country Link
CN (1) CN113132239A (en)
WO (1) WO2021143660A1 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4460195B2 (en) * 2001-08-06 2010-05-12 株式会社日立製作所 Packet transfer device and routing control device
US7349392B2 (en) * 2001-09-14 2008-03-25 Hewlett-Packard Development Company, L.P. Assigning IP addresses in an internet data center
CN100499539C (en) * 2004-07-26 2009-06-10 毛德操 Method for addressing and routing in internet accoring to path
CN101616049A (en) * 2009-08-04 2009-12-30 罗建华 The graded communication management of high-capacity bus network
CN109698868B (en) * 2017-10-20 2021-05-04 华为技术有限公司 IP address allocation method and device, computer program and storage medium
CN110120985B (en) * 2018-02-05 2021-06-29 华为技术有限公司 Method and apparatus for communication

Also Published As

Publication number Publication date
WO2021143660A1 (en) 2021-07-22

Similar Documents

Publication Publication Date Title
EP0993144B1 (en) Packet relaying apparatus and method and circuit thereof
CN111510386B (en) Method and device for processing message
CN107925613A (en) It is used for the methods, devices and systems to E-Packet in business function chain SFC
CN102035735A (en) Device and method for providing forwarding and qos information
CN111382114B (en) Data transmission method and device for network on chip and electronic equipment
CN114253979B (en) Message processing method and device and electronic equipment
CN112787927B (en) Segmented routing message forwarding method and device and preset logic circuit unit
EP4084407A1 (en) Network slice creation method and apparatus, and message forwarding method and apparatus
CN113098770A (en) Message sending method, routing table entry generating method, device and storage medium
CN105025458A (en) Resource notification method, equipment and system
CN113132239A (en) Data transmission method and device
CN111464443B (en) Message forwarding method, device, equipment and storage medium based on service function chain
CN109922009B (en) 1553B bus message distribution configuration unit based on data characteristics
JP3970448B2 (en) Information relay method and apparatus
CN114374641B (en) Three-layer message forwarding method and device
CN107241236B (en) Forwarding information base table item detection method, detection equipment and network equipment
CN114079634B (en) Message forwarding method and device and computer readable storage medium
CN112565044B (en) Message processing method and device
CN102413038B (en) Processing method and system for inaccessibility of next hop of route
CN114666259A (en) Message transmission method, device, equipment, storage medium and system
CN104767686A (en) Routing information query method and device in ALT network
CN112822123A (en) Data acquisition method and device
CN110837583B (en) Quick searching method, system and medium based on data chain message activity
CN114567644B (en) Data synchronization method and device and electronic equipment
EP1392026A2 (en) A method of controlling a communications link

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