A debugging method, device, equipment and storage medium for network forwarding equipment
By inserting operation information into the messages of the network forwarding device and forming target messages, the problems of long time, low efficiency and insufficient security debugging in the prior art are solved, and an efficient and secure debugging process is achieved.
Patent Information
- Application Number
- CN202111015793.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-08-31
AI Technical Summary
In the prior art, debugging network forwarding equipment is long, inefficient, and has problems of insufficient security.
By adding operation information for processing the message to the message received by the network forwarding device, a target message is formed, and a target storage space is inserted into the target message to store information in the IP option field. The debugging device obtains the target message on the outgoing path of the network forwarding device and parses out the operation information to debug the network forwarding device.
It realizes that the equipment can be debugged without logging into the network forwarding device, which improves debugging efficiency and security and saves debugging time.
Smart Images

Figure CN115733889B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a debugging method, apparatus, device and storage medium for a network forwarding device. Background Art
[0002] With the popularization and rapid development of the Internet, various applications and services have emerged one after another. Application developers and service providers usually need to build a network by deploying forwarding devices to achieve the desired effect. Among them, the function of the network forwarding device can be to process the message sent by the upstream device in the network and forward it to the downstream device. For example, when user device A sends information to user device B, the message carrying the information is sent from user device A to the switch, and then processed by the switch and forwarded to user device B. Among them, the switch acts as a network forwarding device to process and forward the message.
[0003] In actual applications, the network may be abnormal. At this time, it is necessary to debug the network forwarding device and troubleshoot the problems that cause the network abnormality. In the prior art, in order to debug the network forwarding device, it is usually necessary to remotely log in to the network forwarding device. After logging in to the network forwarding device, a large amount of network-related information is collected from the device for debugging, which takes a lot of time and has low debugging efficiency. In addition, the permission to log in to the network forwarding device needs to be applied for, and the application also increases the time cost of debugging. In addition, logging in to the network forwarding device requires opening the corresponding network channel, and the intranet environment is easily exposed directly to the external network, and is sniffed and attacked by the external network. Therefore, the prior art takes a long time to debug the network forwarding device, is inefficient, and has insufficient security. Summary of the invention
[0004] The embodiments of the present application provide a debugging method, apparatus, device and storage medium for a network forwarding device to save debugging time, improve debugging efficiency and ensure network security during the debugging process.
[0005] In view of this, the first aspect of the present application provides a debugging method for a network forwarding device, the method comprising:
[0006] The network forwarding device performs preset processing operations on the message to be forwarded;
[0007] The network forwarding device inserts a target storage space into the processed message, wherein the target storage space is used to store information of the IP option field;
[0008] The network forwarding device stores the operation information of the preset processing operation into the target storage space to form a target message for forwarding;
[0009] The debugging device obtains the target message on the outgoing path of the network forwarding device;
[0010] The debugging device debugs the network forwarding device based on the operation information parsed from the target message.
[0011] A second aspect of the present application provides a debugging device for a network forwarding device, comprising:
[0012] A processing unit, used to perform a preset processing operation on the message to be forwarded;
[0013] An inserting unit, used for inserting a target storage space into the processed message, wherein the target storage space is used for storing information of the IP option field;
[0014] A storage unit, used to store the operation information of the preset processing operation into the target storage space to form a target message for forwarding;
[0015] An acquisition unit, configured to acquire the target message on an outgoing path of a network forwarding device;
[0016] A debugging unit is used to debug the network forwarding device based on the operation information parsed from the target message.
[0017] A third aspect of the present application provides a device for debugging a network forwarding device, the device comprising a processor and a memory:
[0018] The memory is used to store the program code and transmit the program code to the processor;
[0019] The processor is used to execute the steps of the debugging method for the network forwarding device of the first aspect according to the instructions in the program code.
[0020] A fourth aspect of the present application provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the steps of the debugging method for the network forwarding device of the first aspect.
[0021] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0022] In an embodiment of the present application, a debugging method for a network forwarding device is provided. In the technical scheme of the present application, the network forwarding device and the debugging device cooperate successively to complete the debugging work. For the network forwarding device side, it performs a preset processing operation on the message to be forwarded, and inserts a target storage space dedicated to storing IP option field information in the message, and then stores the operation information of the preset processing operation in the target storage space as the information of the IP option field. For the debugging device side, it obtains the message forwarded by the network forwarding device on the outgoing path of the network forwarding device, and debugs the network forwarding device by parsing the operation information therein. Therefore, in this scheme, as long as the network forwarding device stores the operation information in the message to be forwarded in the above manner, when the network forwarding device needs to be debugged, the debugging work can be completed through the operation information of the message on its outgoing path. Since the device debugging can be realized without logging into the forwarding device specifically, the efficiency and safety of debugging the network forwarding device are improved, and the debugging time is saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1A A schematic diagram of an application scenario of a network forwarding device provided in an embodiment of the present application;
[0024] Figure 1B A schematic diagram of another application scenario of a network forwarding device provided in an embodiment of the present application;
[0025] Figure 1C A schematic diagram of a scenario for debugging a network forwarding device provided in an embodiment of the present application;
[0026] Figure 2 A flowchart of a debugging method for a network forwarding device provided in an embodiment of the present application;
[0027] Figure 3 A flowchart of another method for debugging a network forwarding device provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of a message storage structure provided in an embodiment of the present application;
[0029] Figure 5 A schematic diagram of message insertion operation information provided in an embodiment of the present application;
[0030] Figure 6 A flowchart of a debugging method for a network forwarding device provided in an embodiment of the present application;
[0031] Figure 7 A schematic diagram of the length of a message before adding an IP option field provided in an embodiment of the present application;
[0032] Figure 8A schematic diagram of the length of a message after adding an IP option field provided in an embodiment of the present application;
[0033] Fig. 9 A schematic diagram of the structure of a debugging device for a network forwarding device provided in an embodiment of the present application;
[0034] Fig.10 This is a schematic diagram of the structure of a server for debugging a network forwarding device in an embodiment of the present application;
[0035] Fig.11 This is a schematic diagram of the structure of a terminal device used to debug a network forwarding device in an embodiment of the present application. DETAILED DESCRIPTION
[0036] At present, in order to debug the forwarding device in the network, it is usually necessary to log in to the forwarding device to collect relevant information, such as log information of the forwarding device working in the network, debug information, etc. In order to obtain this information for device debugging, you first need to log in to the network forwarding device, so you need to apply for login permission. The application for permission takes a certain amount of time, and the collected information is relatively complex and time-consuming to collect. Therefore, when debugging the network forwarding device, the debugging efficiency is low and the time is long. In addition, logging in to the network forwarding device requires opening the corresponding channel of the network forwarding device, which makes the network environment of the device easily exposed to the external network, making the device vulnerable to attacks from the external network. It can be seen that this solution of logging in to the device for debugging has deficiencies in security.
[0037] Based on the above problems, the present application proposes a debugging method for a network forwarding device. By adding the operation information for processing the message to the message received by the network forwarding device, the original message is modified so that the message alone has information that can be used for debugging. When it is necessary to debug the network forwarding device, it is only necessary to parse out the operation information contained in the message regarding the previous preset processing operation of the network forwarding device, and then the device can be debugged based on this operation information. This solution does not require logging into the network forwarding device to be debugged, and therefore has high security and is not susceptible to external network attacks. In addition, there is no need to apply for login permissions and collect information locally on the device, which accordingly improves the efficiency of device debugging and reduces the time spent on debugging.
[0038] To facilitate understanding, the application scenarios of network forwarding devices are first introduced. Figure 1A A schematic diagram of an application scenario of a network forwarding device provided in an embodiment of the present application. Figure 1AAs shown, in this scenario, a first device, a second device, and a network forwarding device are provided in the network. The message sent by the first device to the second device specifically needs to be forwarded by the network forwarding device to reach the second device. As an example, the first device and the second device may be devices located upstream and downstream of the network forwarding device, respectively. For example, the first device is a mobile phone of user a, the second device is a mobile phone of user b, and the network forwarding device may be a router.
[0039] The network forwarding device can be a Software Defined Wide Area Network (SDWAN) edge device. SDWAN edge devices usually refer to devices that access and forward user data at the outermost side of the SDWAN service. Specifically, the form of the edge device may vary depending on the access method (VPN, dedicated line, peer-to-peer connection, etc.). As an example, the SDWAN edge device can be a router or a firewall. The following uses a router as an SDWAN edge device used in an SDWAN service scenario as an example to illustrate the application scenario of the network forwarding device.
[0040] Figure 1B Figure 1 is a schematic diagram of another application scenario of network forwarding equipment. Figure 1B As shown, the scenario includes a first router, a second router, a first computer room, and a second computer room. The first computer room includes at least one first server, and the second computer room includes at least one second server. In actual applications, the first server in the first computer room and the second server in the second computer room can access each other through the SDWAN built by the first router and the second router.
[0041] When the first computer room sends a message to the server in the second computer room, the first server in the first computer room can be regarded as the first device, the first router can be regarded as the network forwarding device, and the second router can be regarded as the second device. Alternatively, the first router can be regarded as the first device, the second router can be regarded as the network forwarding device, and the second server in the second computer room can be regarded as the second device.
[0042] Similarly, when the second computer room sends a message to the server in the first computer room, the second server in the second computer room can be regarded as the first device, the second router can be regarded as the network forwarding device, and the first router can be regarded as the second device. Alternatively, the second router can be regarded as the first device, the first router can be regarded as the network forwarding device, and the first server in the first computer room can be regarded as the second device.
[0043] In the message forwarding method provided in the embodiment of the present application, the network forwarding device performs a preset processing operation on the message to be forwarded received from the first device, and records the operation information of the preset processing operation in the IP option field (i.e., the IP option field) as the content information of the IP option field. In the embodiment of the present application, a target storage space is specifically inserted into the message to store the information of the IP option field. Since the IP option field is a field that allows custom content under the IP protocol, the above-mentioned operation information can be freely placed. The addition of the operation information enables the added message to have information basis for device debugging. The debugging device can debug the network forwarding device based on the operation information by obtaining the message of the network forwarding device out of the path and parsing the operation information therein. In this way, there is no need to log in to the network forwarding device specifically, and the target message on the outgoing path of the network forwarding device can be directly captured. In order to facilitate the distinction between the changes before and after the message, in the embodiment of the present application, the message processed by the network forwarding device, adding the operation information and sending to the second device is named as the target message.
[0044] Figure 1C A schematic diagram of a scenario for debugging a network forwarding device provided in an embodiment of the present application. Figure 1C and Figure 1A Corresponding to each other. Figure 1C As shown, compared to Figure 1A The scenario shown also includes a debugging device in the debugging scenario. The debugging device is specifically used for debugging the network forwarding device in the scenario. The debugging device captures the target message on the outgoing path of the network forwarding device, and performs message parsing based on the captured target message to obtain the operation information of the message processed inside the network forwarding device. Further, the debugging of the network forwarding device is implemented based on the parsed operation information. In an optional implementation, the debugging device can obtain the target message from the second device. In addition, the second device itself can also be used as a debugging device.
[0045] like Figure 2 The flowchart of the debugging method of the network forwarding device is shown. It should be noted that the network forwarding device may have various implementation methods based on different network deployment methods and different deployment components. Therefore, the specific type of the network forwarding device is not limited here.
[0046] like Figure 2 As shown, the debugging method of the network forwarding device includes:
[0047] S201: The network forwarding device performs a preset processing operation on the message to be forwarded.
[0048] Combination Figure 1A or Figure 1CIn the scenario shown, the network forwarding device needs to forward the message provided by the first device to the second device. Before forwarding the message, the network forwarding device must first process the message to be forwarded. The preset processing operation can be configured here according to actual needs. In an optional implementation method, the preset processing operation mainly consists of three parts, namely, analysis, disposal and sending processing. Among them, as an example, the disposal can be routing disposal. The specific links of the preset processing operation are not limited here.
[0049] The preset processing operations performed on the message may include:
[0050] Perform parsing operations on the message; perform processing operations on the message based on pre-configured processing rules; process the message based on pre-configured sending rules.
[0051] During the above operation, operation information may be recorded. For example, the operation information that can be recorded in the analysis aspect may include: the operation content of the analysis operation and the result of the analysis operation. The operation content of the analysis operation may include the analysis object, such as the network protocol related information analyzed (for example, a certain layer of the message is analyzed), the memory address, etc. The analysis operation result may include a successful analysis or a failed analysis. In addition, if the analysis fails, specific information about the failure of the analysis, such as a failure code, etc., may also be generated. The operation information that can be recorded in the disposal aspect may include: disposal rules and disposal operation results. The disposal rules may be determined by matching information such as ip tuples and tunnel protocols. When the disposal operation is performed according to the disposal rules, the disposal rules are recorded. The disposal operation result may include a disposal failure or a successful disposal. Of course, if the disposal fails, specific information about the disposal failure, such as a disposal failure code, may also be generated. Of course, a specific disposal module may also be included, such as a routing disposal module. The operation information that can be recorded in the sending aspect includes a sending rule. The sending rule may be configured by the user. For example, the sending rule may be sent to a designated manufacturer for intrusion detection, a global wide area network firewall, and a deep packet inspection device.
[0052] S202: The network forwarding device inserts a target storage space into the processed message, and the target storage space is used to store information of the IP option field.
[0053] In the embodiment of the present application, a target storage space is inserted into the processed message, which is dedicated to storing the information of the IP option field. Generally speaking, the IP layer in the message does not contain a functional IP option field. In the embodiment of the present application, the operation information to be inserted into the message belongs to a custom addition method, and the IP option field supports this custom addition method. Therefore, this target storage space is prepared for use with the IP option field.
[0054] S203: The network forwarding device stores the operation information of the preset processing operation into the target storage space to form a target message for forwarding.
[0055] The operation information has been described exemplarily above and will not be described here. Based on the target storage space inserted in S202, the operation information of the preset processing operation is stored in the target storage space of the processed message. The storage of information enriches the information contained in the message. For the sake of distinction, the message to which the operation information is added is referred to as the target message.
[0056] The target message formed not only contains the operation information, but also undergoes internal processing of the network forwarding device, so the target message can be forwarded to the second device. It should be noted that in the embodiment of the present application, the network forwarding device can directly forward the target message to the second device, or forward the target message to another forwarding device, which then processes the message again and then forwards it to the second device. There is no limit on the number of forwarding devices that the message goes through.
[0057] S204: The debugging device obtains the target message on the outgoing path of the network forwarding device.
[0058] In this embodiment, the outgoing path of the network forwarding device specifically refers to the path for forwarding the target message. Since the second device is arranged on the path for forwarding the target message, in specific implementation, the target message can be obtained through the second device.
[0059] S205: The debugging device debugs the network forwarding device based on the operation information parsed from the target message.
[0060] In the embodiment of the present application, the operation information added by the network forwarding device to the message can be used by the debugging device to debug the network forwarding device, thereby diagnosing network anomalies. To this end, the debugging device needs to parse the operation information related to the preset processing operation contained in the target message after obtaining it. Since the operation information is stored in the target storage space, when parsing the operation information, the operation information can be specifically parsed from the target storage space of the target message.
[0061] In an embodiment of the present application, a debugging method for a network forwarding device is provided. In the technical solution of the present application, on the network forwarding device side, the operation information for message processing is stored in a dedicated space in the message before forwarding the message, so that the message forwarding carries the operation information. On the debugging device side, by obtaining the message of the network forwarding device outgoing path and parsing the operation information therein, the network forwarding device can be debugged according to the operation information. Since the device debugging can be realized without logging into the forwarding device, the efficiency and security of debugging the network forwarding device are improved, and the debugging time is saved.
[0062] In practical applications, the operation information may occupy a large space. In order to save the space it occupies in the message, the operation information can be compressed and stored in the target storage space after processing. The following is an explanation of this implementation method in conjunction with the embodiment. Figure 3 As shown, in another debugging method of a network forwarding device, the method includes:
[0063] S301: The network forwarding device performs a preset processing operation on the message to be forwarded.
[0064] S302: The network forwarding device inserts a target storage space into the processed message, and the target storage space is used to store information of the IP option field.
[0065] The implementation of S301-S302 is basically the same as the implementation of S201-S202 in the above embodiment, so it will not be described in detail here. Please refer to the above embodiment for the specific implementation.
[0066] It should be noted that, in the embodiment of the present application, since the target storage space is used to store the information of the IP option field, the target storage space can also be specifically divided into multiple different storage spaces based on different information to store different contents of different IP option fields, such as dividing into a first storage space and a second storage space. Among them, the first storage space is used to store the operation information of the preset processing operation, and the second storage space is used to store the category information of the IP option field. The category information will be specifically introduced later, and will not be described in detail in this embodiment.
[0067] The length of the first storage space is N bits, where N is a positive integer greater than 1. The length of the second storage space is M bits, where M is a positive integer greater than 1. As an example, N is 96, i.e., the length of the first storage space is 12 bytes; and M is 16, i.e., the second storage space occupies 2 bytes.
[0068] S303: The network forwarding device obtains an information mapping table of the network forwarding device, where the information mapping table includes a mapping relationship between bits in N bits of the first storage space and operation information in an operation information set, where the operation information set includes operation information of a preset processing operation.
[0069] In practical applications, the information mapping table is generated before the network forwarding device performs the preset processing operation on the message. Specifically, it can be generated by other devices, or the network forwarding device can generate the information mapping table. In some possible implementations, the information mapping table can be generated after the network forwarding device leaves the factory. For example, after the network forwarding device leaves the factory, its operation information set can be established based on the function of the device, which contains operation information of a limited number of preset processing operations. In addition, the length of the first storage space expected to be inserted into the message is also limited, so that bits can be allocated for each preset processing operation and its operation information, so as to establish the information mapping table.
[0070] In an example implementation, the length of the first storage space is 96 bits, wherein the upper 32 bits store parsing-related operation information, the middle 32 bits store handling-related operation information, and the lower 32 bits store sending-related operation information.
[0071] As an example, the encodings on multiple different bits match different operation information of the same processing operation. Taking the high 32 bits storing the parsing-related operation information as an example, each bit is set to 0 by default, and is set to 1 only when the actual operation information matches the operation information corresponding to the bit. The first bit position 1 corresponds to the successful parsing of IP, and the second bit position 1 corresponds to the failure of parsing IP. Similarly, the third bit position 1 corresponds to the successful parsing of TCP, and the fourth bit position 1 corresponds to the failure of parsing TCP. And so on.
[0072] As another example, different codes on the same bit position match different operation information. Take the high 32 bits storing the operation information related to the analysis as an example, where the first bit position corresponds to the analysis of the IP. Among them, the first bit position 0 indicates that the analysis of the IP is not performed, setting it to 1 indicates that the analysis of the IP is performed and succeeded, and setting it to 2 indicates that the analysis of the IP is performed and failed. In this implementation, different codes placed on the same bit position represent different operation information. Of course, the above codes 0, 1, and 2 are only examples, and the encoding method and the correspondence with the operation information are not limited here. Similarly, the second bit position corresponds to the analysis of the TCP. Among them, the second bit position 0 indicates that the analysis of the TCP is not performed, setting it to 1 indicates that the analysis of the TCP is performed and succeeded, and setting it to 2 indicates that the analysis of the TCP is performed and failed. And so on.
[0073] S304: The network forwarding device places a code on a corresponding bit in the first storage space according to the operation information of the preset processing operation based on the information mapping table to form a target message for forwarding.
[0074] In practical applications, combined with the above-mentioned example description, a code may be placed in the corresponding bit mapped in the information mapping table according to the preset processing operation actually performed in S301 and the specific situation of the operation (such as success or failure).
[0075] For the case where the codes on multiple different bits match different operation information of the same processing operation, in this step, the actual operation information is combined to place a valid code (for example, the code is 1). For the case where different codes on the same bit match different operation information, the bit corresponding to the operation information of the preset processing operation can be first determined according to the information mapping table. For example, the operation information of the parsed IP corresponds to the first bit, and the operation information of the preset processing operation is converted to the matching code on its corresponding bit. Specifically, if the parsing is successful, it is converted to code 1; if the parsing fails, it is converted to code 2. Finally, the matching code is placed in the bit corresponding to the operation information of the preset processing operation in the first storage space.
[0076] In this way, when the operation information of all preset processing operations is placed in the corresponding bits in the first storage space in a coded form, the addition of the operation information of the preset processing operations in the message is completed, and the target message is obtained.
[0077] S305: The debugging device obtains the target message on the outgoing path of the network forwarding device.
[0078] If the target storage space contains the encoding form of the operation information in each bit, in order to parse out the operation information, the debugging device can also use the information mapping table used by the network forwarding device to add the operation information to the message to parse the operation information in the target message. See the following steps S306-S307.
[0079] S306: The debugging device obtains the information mapping table.
[0080] S307: The debugging device converts the encoding of each bit in the first storage space into operation information of the preset processing operation through the information mapping table.
[0081] For example, the first bit in the first storage space corresponds to a certain operation information, and when the bit has a valid code (eg, code 1), it means that the first storage space contains the operation information.
[0082] S308: The debugging device debugs the network forwarding device based on the operation information parsed from the target message.
[0083] If all the operation information of the preset processing operation is stored in the target storage space as the content of the IP option field, it is possible that the operation information is too large and inserted into a target storage space that is too large, affecting the performance of reading and sending and receiving the target message. In combination with the use of the information mapping table introduced in the embodiment of the present application, it can be known that in order to avoid occupying too much space, the embodiment of the present application proposes to establish a mapping relationship between the bit position and the operation information in the first storage space of the target storage space, and enter the code in the corresponding bit position to represent the operation information. In the debugging method of the network forwarding device introduced in the embodiment of the present application, the operation information of the preset processing operation of the message is converted into a coded form through the information mapping table and placed in the corresponding position in the target storage space, so as to realize the compression processing of the operation information that occupies a large space and ensure that the message carries the operation information completely. When the debugging device needs to debug the network forwarding device, the information mapping table is also used to realize the parsing of the operation information in the target message.
[0084] In the present application, the network forwarding device adds the operation information of performing the preset processing operation on the message to the message to form the target message. In order to improve the security of the operation information in the message and reduce the difficulty of being attacked and deciphered, in the embodiment of the present application, the mapping relationship between the bit position and the operation information in the mapping table can also be processed based on the category information (type) of the IP option field mentioned above, so that the mapping relationship used when adding the operation information of the message with different IP option field category information changes.
[0085] First, the generation method of the category information of the IP option field is introduced. In an embodiment of the present application, the category information of the IP option field is allocated based on the type information of the network forwarding device and / or the service type of the message received by the network forwarding device from the first device. For example, the network forwarding device is of the first device type, the service type of the message is the first service type, and the category information of the IP option field is allocated as 0x21; the network forwarding device is of the second device type, the service type of the message is the first service type, and the category information of the IP option field is allocated as 0x22; the network forwarding device is of the second device type, the service type of the message is the second service type, and the category information of the IP option field is allocated as 0x23. In other possible implementations, the category information of the IP option field can also be allocated based on the type information of the network forwarding device and / or the service type of the message, combined with the data format of the message. After the category information is allocated, it will be stored in the second storage space in the target storage space.
[0086] Combined with the allocation method of the IP option field category information described above, it can be known that the category information realizes the differentiated representation of the IP option field category. Subsequently, based on this category information, the mapping relationship between the bit in the N bit in the information mapping table and the operation information in the operation information set can be offset. The information mapping table has a default mapping relationship between the bit and the operation information in the operation information set, for example, the first bit corresponds to the first operation information, the second bit corresponds to the second operation information, and the third bit corresponds to the third operation information. The offset of the mapping relationship is achieved by determining the number of offset bits based on the category information of the IP option field. For example, if the number of offset bits corresponding to 0x21 is 1, then in the mapping relationship obtained after the offset, the second bit corresponds to the first operation information, the third bit corresponds to the second operation information, and the fourth bit corresponds to the third operation information. It should be noted that the number of offset bits corresponding to the category information of the IP option field can be set according to specific needs, or the number of bits to be offset can be determined according to the category information by a preset rule (for example, by calculating the relationship formula).
[0087] It can be understood that the mapping relationship obtained by the above-mentioned offset processing has changed compared with the default mapping relationship in the information mapping table. Furthermore, in S304 introduced in the above embodiment, when it is specifically implemented, it can be based on the operation information of the preset processing operation, and the coding is placed on the corresponding bit in the first storage space based on the mapping relationship after the offset processing. In the embodiment of the present application, the mapping relationship in the information mapping table is changed by offset processing, and the encryption and hiding of the operation information to be added are realized, thereby improving the security and deciphering difficulty of the operation information. Optionally, the information mapping table also includes a mapping relationship between the IP option category information and the number of offset bits. The IP option category information and the number of offset bits assist in the subsequent debugging, and use the information mapping table to parse the real operation information represented by the coding on each bit. For S307 provided in the above embodiment, when parsing the operation information in the target message, the real operation information indicated by the coding on the bit before the offset can be identified based on the IP option category information and the corresponding number of offset bits in the information mapping table. Thereby, accurate and safe parsing of the operation information is achieved.
[0088] In the embodiment described above, it is proposed that the network forwarding device performs three levels of processing on the received first device message: parsing, handling, and sending. In addition to the operation information of the preset processing operations at these three levels, in an optional implementation method, based on the requirements for debugging accuracy, comprehensiveness, reliability, etc., operations other than the preset processing operations can also be performed on the code position specified in the message to record the operation information of the specified code position, add it to the target storage space, and forward it by the target message for debugging. Two optional implementation methods are introduced below.
[0089] In an optional implementation, the network forwarding device adds a processing code at a target location in the message code (i.e., a designated code location of interest), and the message can be processed by the processing code at the target location, and operation information corresponding to the target location is generated after the processing is completed. In another optional implementation, the function name at the target location can also be stored in the target storage space by the network forwarding device as the operation information of the target location. The function call relationship can reflect the processing logic, and therefore can be used to locate the scope of the problem.
[0090] In order to understand the changes in the message before and after adding operation information, the following is combined Figures 4 to 5 Provide explanation.
[0091] Before receiving the message of the first device (ie, the message to be forwarded), a memory block is allocated for the message in the memory of the network forwarding device as a message storage structure, such as Figure 4 4 is a schematic diagram of a message storage structure 400. At the front end of the message storage structure 400 is a message structure header 401, which is used to store the structure information of the memory block format. The structure information of the message structure header is used to directly index the corresponding memory block when performing a preset processing operation on the message, thereby improving performance.
[0092] For a received message to be forwarded, the network forwarding device inserts its message data (unprocessed) into a position other than the message structure header 401 in the message storage structure 400. Figure 4 As shown, after the message data is inserted, space is reserved at the end, namely, reserved header space 402 and reserved tail space 403. Among them, the reserved tail space 403 is used as an information storage space, and the information storage space stores the detailed execution status of each step when the preset processing operation is performed on the message, including information other than the operation information, for example, the business information of the message (such as business type), the target IP of the message, etc. When the preset processing operation is performed, the generated operation information will be recorded in the information storage space. The reserved header space 402 is prepared for the subsequent insertion of operation information. The reserved header space 402 can reduce the amount of content that needs to be copied when inserting the target storage space.
[0093] Figure 5 The figure is a schematic diagram of inserting operation information into a processed message. Figure 5In the embodiment, the processed message data is divided into two parts, one is the message header 501 (such as the IP layer), and the other is the message remaining data 502. The space between the message header 501 and the message remaining data 502 is the target storage space 503. The target storage space 503 moves (copies) the message header 501 forward in the entire message storage structure 400, which is equivalent to occupying a part of the reserved header space, so that the reserved header space 402′ after the target storage space 503 is inserted is smaller than Figure 4 The reserved header space 402 shown when not inserted into the target storage space is shorter, that is, the space occupied is smaller. In this solution, only the message header 501 needs to be copied to complete the insertion into the target storage space, and the content to be copied is significantly reduced compared to not reserving the header space 402. For example, if the header space 402 is not reserved, the remaining message data 502 needs to be copied backward in large quantities. Obviously, the data volume of the message header 501 is much smaller than the data volume of the remaining message data 502.
[0094] In the embodiment of the present application, during the execution of the preset processing operation, the network forwarding device stores the operation information of the preset processing operation into the information storage space 404 corresponding to the message in the local memory of the network forwarding device. Figure 5 The middle information storage space 404 does not completely fill the reserved tail space 403 because the reserved tail space 404 can also be more sufficient to provide other uses with the remaining space.
[0095] Here, it is not directly stored in the target storage space 503 because the message data needs to be analyzed and processed during processing. If the operation information is written to the target storage space 503 during this period, the packet to be processed will be changed every time it is processed, which may easily cause abnormalities in the subsequent analysis of the message. Therefore, the present application proposes that the network forwarding device first stores the operation information in the information storage space 404 in the storage structure 400 allocated for the message, and when all the preset processing operations are executed, the operation information associated with the executed preset processing operations is extracted from the information storage space 404 and stored in the target storage space 503, such as Figure 5 In conjunction with the description of the information mapping table function in the above-mentioned embodiment, the network forwarding device Figure 5 When the operation information in the information storage space 404 is added to the target storage space 503, the operation information may be stored in a coded form in a corresponding bit of the first storage space of the target storage space 503 through the information mapping table.
[0096] After storing the operation information between the message header and the remaining data of the message, it is not necessary to Figure 5All the data in the complete storage structure in the target storage space are sent to the second device as the target message. Instead, the processed message data and the operation information in the target storage space are sent to the second device as the target message. Figure 5 The interval indicated by the curly brackets 500.
[0097] It should be noted that in actual applications, the operation information can be first stored in the information storage space, and then stored in the target storage space after conversion through the information mapping table; the operation information can also be first stored in the information storage space after conversion through the information mapping table, and then the converted code can be extracted to the target storage space in sequence; in addition, the operation information related to analysis and disposal can be first stored in the information storage space, and the operation information of the information storage space together with the sending-related operation information can be converted through the information mapping table and stored in the target storage space. There is no restriction on the timing of conversion here, because a section of space can also be specially designated in the information storage space for storing the codes converted from the operation information, such as a 96-bit space. When the operation information needs to be extracted from it, the information in this section of space can be moved bit by bit into the target storage space.
[0098] The following describes an implementation method in which the debugging device debugs the network forwarding device based on the operation information.
[0099] In actual applications, network anomalies may occur in scenarios where network forwarding devices are located. Figure 1B The following scenarios are used as examples to describe several network anomalies:
[0100] 1) The first server in the first computer room suddenly cannot access the second computer room, while the first router and the second router are powered on normally.
[0101] 2) Some of the first servers in the first computer room cannot access the second computer room.
[0102] 3) The first server in the first computer room can access the second server in the second computer room, but the second server in the second computer room cannot access the first server in the first computer room.
[0103] The several exemplary network anomaly scenarios provided above often cannot directly locate the problem through the phenomenon. For this reason, it is necessary to debug the network forwarding device (the first router and / or the second router) to locate the problem that causes the network anomaly. Common problems that cause network anomalies include: problems with the network forwarding device itself, problems with the configuration of the network forwarding device, problems with the processing of messages by the network forwarding device, or problems with the message itself.
[0104] For problems with the network forwarding device itself, if the target message cannot be obtained on the outbound path of the network forwarding device, it means that there is a problem with the network forwarding device itself.
[0105] For problems with the configuration of the network forwarding device, problems with the processing of messages, or problems with the messages themselves, the network forwarding device can be debugged based on the matching of the operation information and the information indicating the abnormality.
[0106] Information indicating an abnormality includes abnormal configuration information of the network forwarding device. For problems with the configuration of the network forwarding device, after the network forwarding device parses the operation information, the configuration information of the network forwarding device can be deduced from the operation information based on the association between the operation information and the configuration information. In actual applications, the configuration of the network forwarding device needs to comply with preset rules, otherwise it will affect the function of the network forwarding device. Configuration information that does not comply with preset rules is defined as abnormal configuration information. Based on the matching of the actual configuration information of the network forwarding device and the abnormal configuration information of the network forwarding device, it can be determined whether the configuration of the network forwarding device is abnormal. Of course, it is also possible to determine whether the configuration is abnormal based on the matching of the actual configuration information of the network forwarding device and the configuration rules for the network forwarding device.
[0107] The information indicating the abnormality includes: the operation result indicating the abnormality of the processing logic. For the problem of the network forwarding device processing the message, if the operation information parsed by the network forwarding device contains the operation result indicating the abnormality of the processing logic (for example, the code indicating the processing error), it can be determined that there is an abnormality in the preset processing operation of the network forwarding device. In addition, the erroneous processing operation can be located according to the bit position of the error code and the information mapping table.
[0108] The information indicating the abnormality includes: the result of the operation indicating the code error. For the problem existing in the message itself, if the operation information parsed by the network forwarding device contains the result of the operation indicating the code error (for example, the encoding indicating the code error), it can be determined that there is an error in the message code. In addition, the corresponding processing operation can be determined based on the bit position of the encoding indicating the code error and the information mapping table, and then the code position targeted by the processing operation can be determined to locate the error code.
[0109] In the debugging method of the network forwarding device introduced in the above embodiment, only based on the target message obtained by the network forwarding device outgoing path, the operation information previously added by the network forwarding device to the message can be obtained by parsing. In turn, it is convenient for the debugging device to debug the network forwarding device and locate problems in the abnormal network. In this method, there is no need to log in to the network forwarding device specifically to debug the network forwarding device. Only the message processed and transferred by the device can be obtained to realize device debugging, which reduces the debugging time, improves the debugging efficiency, and ensures the security of the network during the debugging process.
[0110] Figure 6 A flowchart of another method for debugging a network forwarding device provided in an embodiment of the present application.
[0111] like Figure 6 As shown, the method includes:
[0112] S701: A network forwarding device receives a message from a first device and pre-processes a storage space of the message.
[0113] In specific implementation, messages can be received through DPDK technology. DPDK stands for Intel Data Plane Development Kit, which is a data plane development tool set provided by Intel.
[0114] When storing message information, the pre-allocated memory block is formatted and the structure information is stored in the header of the message structure, so that subsequent processing can directly index the corresponding memory block and improve performance; according to the size of the information to be stored, a sufficient length of header space is reserved for subsequent addition of IP option information, which results in less copying and higher performance. Figure 4 Understand the storage structure of the pre-processed message. In addition, reserve enough space at the end of the message as information storage space. The information storage space is used to record various processing details of the message, including operation information, when the network forwarding device performs preset processing operations on the message.
[0115] S702: The network forwarding device parses the message, and records the currently parsed memory address and network protocol related information in the information storage space for easy recursive calling again; each parsing operation and parsing result is recorded in the information storage space as parsing-related operation information.
[0116] S703: The network forwarding device performs a processing operation on the message according to the processing rule; and records the processing rule and the execution result of each processing operation into the information storage space.
[0117] The handling rule can be determined by matching information such as IP tuples and tunnel protocols. The information can be matched by numerical values, comparison after hashing, or Berkeley Packet Filter (BPF) expressions. There is no limitation on the matching method used to match the information. The handling operation refers to the operation performed on the message that hits the handling rule, such as forwarding to security detection, random discarding, message statistics, message modification, etc. The handling operation can be customized by the user.
[0118] As an example, the handling rule is "rdsample", and this handling rule rdsample(4) means randomly dropping packets at a rate of 4%. Specifically, it can be: the sum of the message receiving time and the message sequence number is used as the random number seed, and the random number is modulo 100 after the random number is generated. If it is less than the rate parameter 4, the message is not forwarded but discarded.
[0119] S704: The network forwarding device processes the message according to the sending rule.
[0120] S705: The network forwarding device copies the memory information from the start address of the message to the complete IP header to the header reserved space to form a target storage space.
[0121] Copying the memory information from the start address of the message to the complete IP header to the reserved space in the header is equivalent to moving the memory segment forward, thereby inserting the target storage space into the message data. For the effects before and after the target storage space is formed, please refer to Figure 4 and Figure 5 shown.
[0122] S706: The network forwarding device allocates category information of the IP option field according to the type of the network forwarding device, the service type of the message, and the data format, and stores the category information into the target storage space.
[0123] As an example, the category of the IP option field is 0x21. The target storage space allocates 2 bytes as the second storage space for storing category information, and allocates 12 bytes as the first storage space for storing operation information for performing parsing, handling and sending related processing operations on the message.
[0124] S707: The network forwarding device converts the sending rules and the analysis and processing related information pre-stored in the information storage device according to the category information and the information mapping table, and stores them in the corresponding bit of the target storage space in a coded form.
[0125] The operation information is added by executing S707.
[0126] S708: The network forwarding device updates the IP header length information, and recalculates and stores the IP header check value.
[0127] Before adding the operation information, the content fields of the message are as follows: Figure 7 As shown in the figure, the header length is only 20 bytes, and the total length is 110 bytes. After adding the operation information, the IP layer has more IP option fields. The content fields of the target message are as follows: Figure 8 As shown in the figure, the header length becomes 36 bytes and the total length becomes 126 bytes. To do this, the IP header length information needs to be updated from 20 bytes to 36 bytes.
[0128] Since the length of the IP header has changed, if the header length information is not updated and the IP header check value is not recalculated and stored, the parsing of the message will be affected. For example, the data packet will be determined to be deformed and will not be processed or forwarded. Therefore, in the embodiment of the present application, it is necessary to recalculate and store the IP header check value. Calculating the IP header check value based on the new IP header length information is a relatively mature technology, and relevant algorithms can be applied for calculation. The implementation of this process will not be described in detail here.
[0129] It should be noted that the reason why the length is increased by 16 bytes instead of 14 bytes is to comply with the protocol specification. Every 4 bytes are aligned. Therefore, in the embodiment of the present application, for alignment, the length of the target storage space serving the IP option field is 16 bytes (i.e., an integer multiple of 4 bytes).
[0130] After executing S708, the target message is obtained.
[0131] S709: The network forwarding device executes the forwarding method configured by the user in the network forwarding device, and forwards the target message to the second device.
[0132] By executing S709, the message is forwarded. As an example, the forwarding method configured by the user may include: IP routing, Destination Network Address Translation (DNAT), etc. The specific forwarding method to be executed is not limited here.
[0133] S710: The debugging device obtains the target message and stores it as a pcap file.
[0134] In practical applications, this step can use tcpdump (a network data collection and analysis tool) or wireshark (a network packet capture tool) to capture the target message on the outgoing path through the network forwarding device and store it as a pcap file.
[0135] S711: The debugging device parses the pcap file to determine whether there is an IP layer protocol. If there is an IP layer protocol, enter S712; if there is no IP layer protocol, end the parsing.
[0136] S712: The debugging device determines whether there is an IP option field. If so, the process proceeds to S713; if not, the parsing ends.
[0137] S713: The debugging device determines whether the category information of the IP option is included in the information mapping table. If it is included, the process proceeds to S714; if it is not included, the parsing ends.
[0138] S714: The debugging device decodes the code stored in the IP option field into operation information according to the information mapping table.
[0139] As an example, the extracted 96-bit information is traversed, and the encoding of the operation information related to the analysis of the high 32 bits, the encoding of the operation information related to the disposal of the middle 32 bits, and the encoding of the operation information related to the forwarding of the low 32 bits are obtained. The above encoding can be converted into the corresponding operation information according to the number of offset bits corresponding to the category information in the information mapping table. Optionally, the obtained operation information can also be displayed for reference and analysis by operation and maintenance personnel.
[0140] S715: The debugging device debugs the network forwarding device according to the operation information.
[0141] In the original network troubleshooting scenario, the network forwarding equipment is in black box mode, and the operation and maintenance personnel can only verify the ideas through continuous trial and error. With the expansion of the network environment, it is very difficult to locate the problematic equipment in a huge number of network environments. Network forwarding equipment experts need to apply for the permission to log in to the relevant environment to locate the problem. When seeking support from the relevant network forwarding equipment manufacturers, the support personnel cannot avoid the security issues such as the environment and traffic of the debugging equipment. When locating the internal logic problems of the network forwarding equipment, it is often necessary to log in to the device, turn on the debugging mode to capture the message, etc. Turning on the debugging mode will cause the performance of the device to decrease and affect the current normal business.
[0142] The above debugging method of the network forwarding device provided in the embodiment of the present application greatly simplifies the operation and maintenance cost of the network forwarding device. In the embodiment of the present application, it is only necessary to capture the message at the message receiving end of the abnormal network to analyze the internal processing flow of the network forwarding device passed through the path. Since there is no need to log in to the device, there is no need to open the relevant channels, which ensures the security of debugging. In addition, debugging does not require repeated reading of the device memory, so the impact on the device performance is small, ensuring the normal execution of the network forwarding device business.
[0143] Based on the debugging method of the network forwarding device provided in the above embodiment, the present application also provides a debugging device for the network forwarding device. The implementation of the device is described below in conjunction with the embodiments and drawings.
[0144] See also Fig. 9 , which is a schematic diagram of the structure of a debugging device for a network forwarding device provided in an embodiment of the present application. Fig. 9 As shown, the device 1100 includes:
[0145] Processing unit 1101, used for the network forwarding device to perform a preset processing operation on the message to be forwarded;
[0146] Insertion unit 1102, used for the network forwarding device to insert a target storage space into the processed message, wherein the target storage space is used to store information of the IP option field;
[0147] The storage unit 1103 is used for the network forwarding device to store the operation information of the preset processing operation into the target storage space to form a target message for forwarding;
[0148] An acquisition unit 1104 is configured to enable the debugging device to acquire the target message on an outgoing path of the network forwarding device;
[0149] The debugging unit 1105 is used for the debugging device to debug the network forwarding device based on the operation information parsed from the target message.
[0150] Optionally, the target storage space includes a first storage space, the first storage space is used to store the operation information, and the length of the first storage space is N bits, where N is a positive integer greater than 1; the debugging device 1100 of the network forwarding device also includes:
[0151] A mapping table acquisition unit 1104 is used for the network forwarding device to acquire an information mapping table of the network forwarding device, wherein the information mapping table includes a mapping relationship between bits in the N bits and operation information in an operation information set, and the operation information set includes the operation information of the preset processing operation;
[0152] The storage unit 1103 includes:
[0153] A first storage subunit, configured for the network forwarding device to place a code on a corresponding bit in the first storage space based on the information mapping table according to the operation information of the preset processing operation;
[0154] The debugging unit 1105 includes:
[0155] A mapping table acquisition subunit, used for the debugging device to acquire the information mapping table;
[0156] The conversion subunit is used for the debugging device to convert the encoding of each bit in the first storage space into the operation information of the preset processing operation through the information mapping table.
[0157] Optionally, different codes on the same bit match different operation information; the first storage subunit includes:
[0158] A bit determination subunit, used for the network forwarding device to determine a bit corresponding to the operation information of the preset processing operation according to the information mapping table;
[0159] An information conversion subunit, used for the network forwarding device to convert the operation information of the preset processing operation into a code matching the corresponding bit position;
[0160] The code placement subunit is used for the network forwarding device to place the matching code into a bit corresponding to the operation information of the preset processing operation in the first storage space.
[0161] Optionally, the target storage space further includes a second storage space, and the second storage space is used to store the category information of the IP option field; the debugging device 1100 of the network conversion device further includes:
[0162] A category allocation unit, configured for the network forwarding device to allocate the category information based on the type of the network forwarding device and / or the service type of the message;
[0163] a category information storing unit, used for the network forwarding device to store the category information into the second storage space;
[0164] An offset processing unit 1101 is used for the network forwarding device to perform offset processing on the mapping relationship between the bits in the N bits in the information mapping table and the operation information in the operation information set according to the category information to obtain a mapping relationship after the offset processing;
[0165] The first storage subunit is specifically used for the network forwarding device to place a code on a corresponding bit in the first storage space based on the mapping relationship after the offset processing according to the operation information of the preset processing operation.
[0166] Optionally, the processing unit 1101 includes:
[0167] A parsing processing subunit, used for the network forwarding device to perform a parsing operation on the message to be forwarded;
[0168] A processing subunit, configured for the network forwarding device to perform a processing operation on the message to be forwarded based on a pre-configured processing rule;
[0169] A sending processing subunit, used for the network forwarding device to process the message to be forwarded based on a pre-configured sending rule;
[0170] The operation information of the preset processing operation includes: the operation content of the parsing operation, the parsing operation result, the handling rule, the handling operation result, and the sending rule.
[0171] Optionally, the debugging unit 1105 is used by the debugging device to debug the network forwarding device according to the matching of the operation information and the information indicating the abnormality.
[0172] Optionally, the information indicating the abnormality includes: abnormal configuration information of the network forwarding device; the debugging unit 1105 includes:
[0173] The first debugging sub-unit is used to infer the configuration information of the network forwarding device from the operation information based on the association between the operation information and the configuration information; and determine whether there is any abnormality in the configuration of the network forwarding device based on the matching between the configuration information and the abnormal configuration information of the network forwarding device.
[0174] Optionally, the information indicating the abnormality includes: an operation result indicating the abnormality of the processing logic; the debugging unit 1105 includes:
[0175] The second debugging sub-unit is used for, when the operation information contains an operation result indicating a processing logic abnormality, the debugging device determines that an abnormality exists in a preset processing operation of the network forwarding device.
[0176] Optionally, the information indicating the abnormality includes: an operation result indicating a code error; the debugging unit 1105 includes:
[0177] The third debugging subunit is configured to determine, by the debugging device, that a code error exists in the message when an operation result indicating a code error exists in the operation information.
[0178] Optionally, the storage unit 1103 includes:
[0179] A second storage subunit is used for storing the operation information of the preset processing operation into the information storage space corresponding to the message in the local memory of the network forwarding device during the execution of the preset processing operation by the network forwarding device;
[0180] The extraction subunit is used for, when the preset processing operation is completed, the network forwarding device extracts the operation information from the information storage space and stores it into the target storage space.
[0181] Optionally, the debugging device 1100 of the network forwarding device further includes:
[0182] A code adding unit, used for the network forwarding device to add a processing code to a target position in the code of the message;
[0183] an operation information generating unit, configured for the network forwarding device to generate operation information corresponding to the target location based on the processing code for processing the message;
[0184] A first additional storage unit 1103, used for the network forwarding device to store the operation information corresponding to the target location into the target storage space;
[0185] Alternatively, the second additional storage unit 1103 is used for the network forwarding device to store the function name where the target location is located into the target storage space.
[0186] Fig.10 This is a schematic diagram of the server structure for debugging a network forwarding device provided in an embodiment of the present application. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 922 (for example, one or more processors) and a memory 932, and one or more storage media 930 (for example, one or more massive storage devices) storing application programs 942 or data 944. Among them, the memory 932 and the storage medium 930 may be short-term storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 922 may be configured to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the server 900.
[0187] The server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958, and / or one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0188] The steps performed by the server in the above embodiment can be based on the Fig.10 The server structure shown.
[0189] The CPU 922 is used to execute the following steps:
[0190] Perform preset processing operations on the messages to be forwarded through the network forwarding device;
[0191] Inserting a target storage space into the processed message through the network forwarding device, wherein the target storage space is used to store information of the IP option field;
[0192] The operation information of the preset processing operation is stored in the target storage space through the network forwarding device to form a target message for forwarding;
[0193] Obtaining the target message on the outgoing path of the network forwarding device through a debugging device;
[0194] The network forwarding device is debugged by the debugging device based on the operation information parsed from the target message.
[0195] The embodiment of the present application also provides another device for forwarding messages or for debugging network forwarding devices, such as Fig.11 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (English full name: Personal Digital Assistant, English abbreviation: PDA), a sales terminal (English full name: Point of Sales, English abbreviation: POS), a car computer, etc., taking the terminal as a mobile phone as an example:
[0196] Fig.11 The figure shows the structure of the terminal device used to debug the network forwarding device. Fig.11 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art can understand that Fig.11 The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0197] Combine the following Fig.11 A detailed introduction to the various components of the mobile phone:
[0198] The RF circuit 1010 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 1080 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (full name: LowNoiseAmplifier, English abbreviation: LNA), a duplexer, etc. In addition, the RF circuit 1010 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communications may use any communication standard or protocol, including but not limited to Global System of Mobile communications (Global System of Mobile communication, English abbreviation: GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, English abbreviation: CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (Long Term Evolution, English abbreviation: LTE), e-mail, Short Messaging Service (SMS), etc.
[0199] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0200] The input unit 1030 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1031 or near the touch panel 1031 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1080, and can receive and execute the command sent by the processor 1080. In addition, the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1031, the input unit 1030 may further include other input devices 1032. Specifically, the other input devices 1032 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
[0201] The display unit 1040 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1040 may include a display panel 1041. Optionally, the display panel 1041 may be configured in the form of a liquid crystal display (full name in English: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (full name in English: Organic Light-Emitting Diode, English abbreviation: OLED), etc. Further, the touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it is transmitted to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of touch event. Although in Fig.11 In the embodiment, the touch panel 1031 and the display panel 1041 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0202] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1041 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0203] The audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone. The audio circuit 1060 can transmit the received audio data to the speaker 1061 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, and then the audio data is output to the processor 1080 for processing, and then sent to another mobile phone through the RF circuit 1010, or the audio data is output to the memory 1020 for further processing.
[0204] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 1070. It provides users with wireless broadband Internet access. Fig.11 A WiFi module 1070 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.
[0205] The processor 1080 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1020 and calling data stored in the memory 1020. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1080.
[0206] The mobile phone also includes a power supply 1090 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0207] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0208] In the embodiment of the present application, the processor 1080 included in the terminal also has the following functions:
[0209] Perform preset processing operations on the messages to be forwarded through the network forwarding device;
[0210] Inserting a target storage space into the processed message through the network forwarding device, wherein the target storage space is used to store information of the IP option field;
[0211] The operation information of the preset processing operation is stored in the target storage space through the network forwarding device to form a target message for forwarding;
[0212] Obtaining the target message on the outgoing path of the network forwarding device through a debugging device;
[0213] The network forwarding device is debugged by the debugging device based on the operation information parsed from the target message.
[0214] The embodiment of the present application also provides a computer-readable storage medium for storing program code, which is used to execute any one of the embodiments of a message forwarding method described in the above embodiments, or any one of the embodiments of a debugging method for a network forwarding device. The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any one of the embodiments of a message forwarding method described in the above embodiments, or any one of the embodiments of a debugging method for a network forwarding device.
[0215] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0216] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0217] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0218] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0219] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store program codes.
[0220] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A debugging method for a network forwarding device, characterized in that: include: The network forwarding device performs preset processing operations on the message to be forwarded; The network forwarding device inserts a target storage space into the processed message, wherein the target storage space is used to store information of the IP option field; The network forwarding device stores the operation information of the preset processing operation into the target storage space to form a target message for forwarding; The debugging device obtains the target message on the outgoing path of the network forwarding device; The debugging device debugs the network forwarding device based on the operation information parsed from the target message.
2. The method according to claim 1, characterized in that: The target storage space includes a first storage space, the first storage space is used to store the operation information, the length of the first storage space is N bits, and N is a positive integer greater than 1; the method further includes: The network forwarding device obtains an information mapping table of the network forwarding device, wherein the information mapping table includes a mapping relationship between bits in the Nbit and operation information in an operation information set, and the operation information set includes operation information of the preset processing operation; The network forwarding device stores the operation information of the preset processing operation into the target storage space, including: The network forwarding device places a code on a corresponding bit in the first storage space based on the information mapping table according to the operation information of the preset processing operation; The debugging device parses the operation information from the target message, including: The debugging device obtains the information mapping table; The debugging device converts the encoding of each bit in the first storage space into the operation information of the preset processing operation through the information mapping table.
3. The method according to claim 2, characterized in that Different codes on the same bit position match different operation information; the network forwarding device places the code on the corresponding bit position in the first storage space based on the information mapping table according to the operation information of the preset processing operation, including: The network forwarding device determines the bit corresponding to the operation information of the preset processing operation according to the information mapping table; The network forwarding device converts the operation information of the preset processing operation into a code matching the corresponding bit position; The network forwarding device places the matching code into a bit corresponding to the operation information of the preset processing operation in the first storage space.
4. The method according to claim 2, characterized in that: The target storage space also includes a second storage space, and the second storage space is used to store the category information of the IP option field; the method also includes: The network forwarding device allocates the category information based on the type of the network forwarding device and / or the service type of the message; The network forwarding device stores the category information into the second storage space; The network forwarding device performs offset processing on the mapping relationship between the bits in the N bits in the information mapping table and the operation information in the operation information set according to the category information to obtain a mapping relationship after the offset processing; The network forwarding device places a code on a corresponding bit in the first storage space based on the information mapping table according to the operation information of the preset processing operation, including: The network forwarding device places a code on a corresponding bit in the first storage space according to the operation information of the preset processing operation and based on the mapping relationship after the offset processing.
5. The method according to claim 1, characterized in that The network forwarding device performs a preset processing operation on the message to be forwarded, including: The network forwarding device performs a parsing operation on the message to be forwarded; The network forwarding device performs a processing operation on the message to be forwarded based on a pre-configured processing rule; The network forwarding device processes the message to be forwarded based on a pre-configured sending rule; The operation information of the preset processing operation includes: the operation content of the parsing operation, the parsing operation result, the handling rule, the handling operation result, and the sending rule.
6. The method according to claim 1, characterized in that The debugging device debugs the network forwarding device based on the operation information parsed from the target message, including: The debugging device debugs the network forwarding device according to the matching of the operation information and the information indicating the abnormality.
7. The method according to claim 6, characterized in that The information indicating the abnormality includes: abnormal configuration information of the network forwarding device; The debugging device debugs the network forwarding device according to the matching of the operation information and the information indicating the abnormality, including: According to the association between the operation information and the configuration information, inferring the configuration information of the network forwarding device from the operation information; Whether there is any abnormality in the configuration of the network forwarding device is determined according to the matching between the configuration information and the abnormal configuration information of the network forwarding device.
8. The method according to claim 6, characterized in that The information indicating the abnormality includes: an operation result indicating the abnormality of the processing logic; The debugging device debugs the network forwarding device according to the matching of the operation information and the information indicating the abnormality, including: When the operation information contains an operation result indicating an abnormality in the processing logic, the debugging device determines that an abnormality exists in the preset processing operation of the network forwarding device.
9. The method according to claim 6, characterized in that The information indicating the abnormality includes: an operation result indicating a code error; The debugging device debugs the network forwarding device according to the matching of the operation information and the information indicating the abnormality, including: When the operation information contains an operation result indicating a code error, the debugging device determines that a code error exists in the message.
10. The method according to claim 1, characterized in that The network forwarding device stores the operation information of the preset processing operation into the target storage space, including: During the execution of the preset processing operation, the network forwarding device stores the operation information of the preset processing operation into the information storage space corresponding to the message in the local memory of the network forwarding device; When the preset processing operation is completed, the network forwarding device extracts the operation information from the information storage space and stores it into the target storage space.
11. The method according to claim 5, characterized in that Also includes: The network forwarding device adds a processing code to a target position in the code of the message; The network forwarding device processes the message based on the processing code to generate operation information corresponding to the target location; The network forwarding device stores the operation information corresponding to the target location into the target storage space; or, The network forwarding device stores the function name where the target location is located in the target storage space.
12. A debugging device for a network forwarding device, characterized in that: include: A processing unit, used to perform a preset processing operation on the message to be forwarded; An inserting unit, used for inserting a target storage space into the processed message, wherein the target storage space is used for storing information of the IP option field; A storage unit, used to store the operation information of the preset processing operation into the target storage space to form a target message for forwarding; An acquisition unit, configured to acquire the target message on an outgoing path of a network forwarding device; A debugging unit is used to debug the network forwarding device based on the operation information parsed from the target message.
13. The device according to claim 12, characterized in that The target storage space includes a first storage space, the first storage space is used to store the operation information, the length of the first storage space is N bits, and N is a positive integer greater than 1; the device also includes: A mapping table acquisition unit, configured for the network forwarding device to acquire an information mapping table of the network forwarding device, wherein the information mapping table includes a mapping relationship between bits in the N bits and operation information in an operation information set, wherein the operation information set includes operation information of the preset processing operation; The storage unit comprises: A first storage subunit, configured for the network forwarding device to place a code on a corresponding bit in the first storage space based on the information mapping table according to the operation information of the preset processing operation; The debugging unit comprises: A mapping table acquisition subunit, used for the debugging device to acquire the information mapping table; The conversion subunit is used for the debugging device to convert the encoding of each bit in the first storage space into the operation information of the preset processing operation through the information mapping table.
14. The device according to claim 13, characterized in that Different encodings on the same bit match different operation information; The first storage subunit comprises: A bit determination subunit, used for the network forwarding device to determine a bit corresponding to the operation information of the preset processing operation according to the information mapping table; An information conversion subunit, used for the network forwarding device to convert the operation information of the preset processing operation into a code matching the corresponding bit position; The code placement subunit is used for the network forwarding device to place the matching code into a bit corresponding to the operation information of the preset processing operation in the first storage space.
15. The device according to claim 13, characterized in that The target storage space also includes a second storage space, and the second storage space is used to store the category information of the IP option field; the device also includes: A category allocation unit, configured for the network forwarding device to allocate the category information based on the type of the network forwarding device and / or the service type of the message; a category information storing unit, used for the network forwarding device to store the category information into the second storage space; An offset processing unit, configured for the network forwarding device to perform offset processing on a mapping relationship between a bit in the Nbit in the information mapping table and operation information in the operation information set according to the category information, to obtain a mapping relationship after the offset processing; The first storage subunit is specifically used for the network forwarding device to place a code on a corresponding bit in the first storage space based on the mapping relationship after the offset processing according to the operation information of the preset processing operation.
16. The device according to claim 12, characterized in that The processing unit comprises: A parsing processing subunit, used for the network forwarding device to perform a parsing operation on the message to be forwarded; A processing subunit, configured for the network forwarding device to perform a processing operation on the message to be forwarded based on a pre-configured processing rule; A sending processing subunit, used for the network forwarding device to process the message to be forwarded based on a pre-configured sending rule; The operation information of the preset processing operation includes: the operation content of the parsing operation, the parsing operation result, the handling rule, the handling operation result, and the sending rule.
17. The device according to claim 12, characterized in that The debugging unit is used for the debugging device to debug the network forwarding device according to the matching between the operation information and the information indicating the abnormality.
18. The device according to claim 17, characterized in that The information indicating the abnormality includes: abnormal configuration information of the network forwarding device; The debugging unit comprises: The first debugging sub-unit is used to infer the configuration information of the network forwarding device from the operation information based on the association between the operation information and the configuration information; and determine whether there is any abnormality in the configuration of the network forwarding device based on the matching between the configuration information and the abnormal configuration information of the network forwarding device.
19. The device according to claim 17, characterized in that The information indicating the abnormality includes: an operation result indicating the abnormality of the processing logic; The debugging unit comprises: The second debugging sub-unit is used for, when the operation information contains an operation result indicating a processing logic abnormality, the debugging device determines that an abnormality exists in a preset processing operation of the network forwarding device.
20. The device according to claim 17, characterized in that The information indicating the abnormality includes: an operation result indicating a code error; The debugging unit comprises: The third debugging subunit is configured to determine, by the debugging device, that a code error exists in the message when an operation result indicating a code error exists in the operation information.
21. The device according to claim 12, characterized in that The storage unit comprises: A second storage subunit is used for storing the operation information of the preset processing operation into the information storage space corresponding to the message in the local memory of the network forwarding device during the execution of the preset processing operation by the network forwarding device; The extraction subunit is used for, when the preset processing operation is completed, the network forwarding device extracts the operation information from the information storage space and stores it into the target storage space.
22. The device according to claim 16, characterized in that Also includes: A code adding unit, used for the network forwarding device to add a processing code to a target position in the code of the message; an operation information generating unit, configured for the network forwarding device to generate operation information corresponding to the target location based on the processing code for processing the message; A first additional storage unit, used for the network forwarding device to store the operation information corresponding to the target location into the target storage space; or, The second additional storage unit is used for the network forwarding device to store the function name where the target location is located into the target storage space.
23. A device for debugging a network forwarding device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the debugging method of the network forwarding device according to any one of claims 1-11 according to the instructions in the program code.
24. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the debugging method for the network forwarding device according to any one of claims 1 to 11.
25. A computer program product comprising instructions, characterized in that When it runs on a computer, it enables the computer to execute the debugging method for a network forwarding device according to any one of claims 1 to 11.
Citation Information
Patent Citations
Network diagnosis method, system and equipment based on software defined network
CN102946325A
Equipment control method and device, electronic equipment and storage medium
CN109981747A