Service pack processing method and device

By setting a whitelist to store the installed and the same patches in the network device, the uninstallation and installation of patches is reduced, and the problem of being easily attacked during the process of updating strong patch packages is solved, which enhances system stability and saves resources.

CN119883343APending Publication Date: 2025-04-25NEW H3C TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411764087.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

During the process of updating the strong patch package, after the operating system uninstalls the old version of the strong patch package, before installing the new version of the strong patch package, there will be a period of not being protected by the old version of the strong patch package, resulting in the problem of being easily attacked.

Method used

By obtaining the patch package file, if the network device supports the patch incremental upgrade function, obtain the information of each patch, and add the patch directory name indicated by the same information to the whitelist, thereby installing patches that are not uninstalled, reducing the uninstallation and installation operations of patches.

Benefits of technology

It reduces the uninstallation and installation of patches, avoids the recurring problems during the patch package upgrade process, enhances the stability of the network device system, saves the time and hardware resources of the patch package upgrade, and solves the problem that the operating system is not protected by old versions of strong patch packages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883343A_ABST
    Figure CN119883343A_ABST
Patent Text Reader

Abstract

The invention provides a service pack processing method and device, the method is applied to network equipment, at least one first patch is installed in the network equipment, the method comprises the steps that a service pack file is acquired, and the service pack file comprises a plurality of second patches; if the network equipment supports the patch increment upgrading function, acquiring first information of each second patch according to each second patch; if the first information which is the same as the second information of the first patch exists in the multiple pieces of first information, adding a patch directory name of a third patch indicated by the first information which is the same as the second information into a white list; and according to the white list, obtaining a fourth patch from the patch pack file, and installing the fourth patch in the network device, the first information of the fourth patch being different from the second information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a patch package processing method and device. Background Art

[0002] Software upgrade refers to the process of upgrading the version of a software package, adding specific software features, or repairing software defects.

[0003] At present, the software packages in our operating system include: Boot package, System package, Feature package and patch package. The Boot package includes the Linux kernel program, and .bin files that provide functions such as process management, memory management, file system management, and emergency shell; the System package includes .bin files of the operating system kernel and basic functional modules, such as device management, interface management, configuration management, and routing modules; the Feature package includes .bin files for advanced or customized services, and users can configure the Feature package according to business needs; the Patch package includes .bin program files used to repair network equipment software defects.

[0004] The types of patch packages include strong patch packages and weak patch packages. Strong patch packages are usually patches that need to be installed to meet the needs of all users (for example, the operating system kernel). One basic package (including Boot package, System package, and Feature package) can install one corresponding strong patch package. When updating a strong patch package, the operating system first uninstalls the old version of the strong patch package, and then installs the new version of the strong patch package. The new version of the strong patch package includes all the patches of the old version of the strong patch package. Weak patch packages are usually patches that need to be installed to meet the needs of some users (for example, customized business functions). One basic package can install multiple corresponding weak patch packages. When installing a new version of a weak patch package, the operating system will not uninstall the old version of the weak patch package, and can directly install the new version of the weak patch package.

[0005] Taking the update of the strong patch package as an example, after the software has problem A, the problem A can be fixed by patch A included in the released strong patch package H01. After a period of time, the software has problem B again, which can be fixed by patch B included in the released strong patch package H02. Strong patch package H02 includes patch A and patch B. For an operating system that has already installed strong patch package H01, when installing strong patch package H02, the operating system first uninstalls patch A. At this time, problem A will be exposed. Although the operating system will quickly install patches A and B included in strong patch package H02, there will be a period of time in between when the operating system will not be protected by patch A.

[0006] In summary, in the process of updating the strong patch package, after uninstalling the old version of the strong patch package and before installing the new version of the strong patch package, the operating system will not be protected by the old version of the strong patch package and will be vulnerable to attacks. Summary of the invention

[0007] In view of this, the present application provides a patch package processing method and device to solve the problem that in the existing process of updating a strong patch package, after uninstalling the old version of the strong patch package and before installing the new version of the strong patch package, the operating system is not protected by the old version of the strong patch package and is vulnerable to attack.

[0008] In a first aspect, the present application provides a patch package processing method, the method being applied to a network device, wherein at least one first patch has been installed in the network device, the method comprising:

[0009] Obtaining a patch package file, wherein the patch package file includes a plurality of second patches;

[0010] If the network device supports a patch incremental upgrade function, obtaining first information of each second patch according to each second patch;

[0011] If there is first information identical to the second information of the first patch among the plurality of first information, then adding the patch directory name of the third patch indicated by the first information identical to the second information to the whitelist;

[0012] According to the white list, a fourth patch is obtained from the patch package file, and the fourth patch is installed in the network device, wherein the first information of the fourth patch is different from the second information.

[0013] In a second aspect, the present application provides a patch package processing device, the device is applied to a network device, at least one first patch has been installed in the network device, the device includes:

[0014] A first acquiring unit, configured to acquire a patch package file, wherein the patch package file includes a plurality of second patches;

[0015] A second acquisition unit is configured to acquire first information of each second patch according to each second patch if the network device supports a patch incremental upgrade function;

[0016] an adding unit, configured to add a patch directory name of a third patch indicated by the first information identical to the second information to the whitelist if there is first information identical to the second information of the first patch among the plurality of first information;

[0017] The installation unit is used to obtain a fourth patch from the patch package file according to the white list, and install the fourth patch in the network device, wherein the first information of the fourth patch is different from the second information.

[0018] In a third aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the first aspect of the present application.

[0019] Therefore, by applying the patch package processing method and device provided by the present application, the network device obtains a patch package file, which includes multiple second patches; if the network device supports the patch incremental upgrade function, then according to each second patch, the network device obtains the first information of each second patch; if there is first information that is the same as the second information of the first patch among the multiple first information, the network device adds the patch directory name of the third patch indicated by the first information that is the same as the second information to the whitelist; according to the whitelist, the network device obtains the fourth patch from the patch package file, and installs the fourth patch in the network device, the first information of the fourth patch is different from the second information.

[0020] In this way, for network devices that have installed strong patch packages, by setting up a whitelist to store previously installed and identical patches, patch uninstall and installation operations are reduced, and problems that have been fixed during patch package upgrades are avoided from reappearing, thereby enhancing the stability of network device systems and saving time and hardware resources for patch package upgrades. At the same time, it also solves the problem that in the existing process of updating strong patch packages, after uninstalling the old version of the strong patch package and before installing the new version of the strong patch package, the operating system is not protected by the old version of the strong patch package and is vulnerable to attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A flowchart of a patch package processing method provided in an embodiment of the present application;

[0022] Figure 2A A patch package processing flow chart provided in an embodiment of the present application;

[0023] Figure 2B Another patch package processing flow chart provided in an embodiment of the present application;

[0024] Figure 3 A structural diagram of a patch package processing device provided in an embodiment of the present application;

[0025] Figure 4 The network device hardware structure provided in the embodiment of the present application. DETAILED DESCRIPTION

[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0027] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.

[0028] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0029] The patch package processing method provided in the embodiment of the present application is described in detail below. Figure 1 , Figure 1 A flowchart of a patch package processing method provided in an embodiment of the present application. The method is applied to a network device in which at least one first patch has been installed. The patch package processing method provided in an embodiment of the present application may include the following steps.

[0030] Step 110: Obtain a patch package file, where the patch package file includes a plurality of second patches;

[0031] Specifically, during the operation of the network device, various emergencies (code bugs, program freezes, etc.) may occur in the system software and service modules. The first patch installed in the network device cannot solve the above emergencies, affecting the normal processing of services by the network device.

[0032] The administrator locates the sudden problem and calls the patch creation tool. The patch creation tool generates a patch package file, which includes multiple second patches. The administrator sends the patch package file to the network device in the form of a command line or Netconf.

[0033] In the embodiment of the present application, the patch package file is specifically a strong patch package file. Optionally, the patch package file also includes a patch package installation script, a patch tool, and a patch package uninstallation script.

[0034] In an example, the patch package file looks like the following.

[0035] Patch package file directory structure:

[0036] ├──Patch A

[0037] │├──action.sh / / Execute script file

[0038] │├──patch.cfg / / Configuration file

[0039] │├──patchfileA / / Patch delivery file A

[0040] │└──update.sh / / Update script file

[0041] ├──Patch B

[0042] │├──action.sh / / Execute script file

[0043] │├──patch.cfg / / Configuration file

[0044] │├──patchfileB / / Patch delivery file B

[0045] │└──update.sh / / Update script file

[0046] ├──install.sh / / Patch package installation script

[0047] ├──patchtools / / patch tools

[0048] └──uninstall.sh / / patch package uninstall script

[0049] The patch package file includes two second patches, namely patch A and patch B.

[0050] Step 120: If the network device supports the patch incremental upgrade function, then obtain the first information of each second patch according to each second patch;

[0051] Specifically, according to the description of step 110, after the network device obtains the patch package file, it first identifies whether it supports the patch incremental upgrade function.

[0052] If the network device itself supports the patch incremental upgrade function, then according to each second patch, the network device obtains the first information of each second patch.

[0053] If the network device itself does not support the patch incremental upgrade function, the network device performs the installation process according to the existing process of installing a strong patch package, which will not be repeated here.

[0054] Optionally, in the embodiment of the present application, the specific process of the network device identifying whether it supports the incremental patch upgrade function is as follows: the network device identifies whether a patch script file already exists in itself; if the patch script file exists locally in the network device (system package), the network device determines that it supports the incremental patch upgrade function; if the patch script file does not exist locally in the network device, the network device determines that it does not support the incremental patch upgrade function. The patch script file can be used to implement the incremental upgrade function of the network device for the strong patch package later.

[0055] In an example, the patch script file (patch_script) is as follows.

[0056] Patch script file (patch_script) directory structure:

[0057] patch_script

[0058] ├──increasePatch.func (public function)

[0059] ├──increasePatch.sh (comparison function, used to generate whitelist)

[0060] ├──increaseUnpack.sh (incremental unpacking based on whitelist)

[0061] ├──initPath.sh (back up and restore the patch directories included in the whitelist, rename the directories of the same patch and put them in temporary files)

[0062] └──RmPatch.sh (delete temporary files during incremental unpacking)

[0063] Optionally, in an embodiment of the present application, the network device may obtain the first information through a variety of acquisition methods.

[0064] In the first implementation method, the specific process of the network device obtaining the first information of each second patch is: the network device decompresses each second patch from the patch package file, and the second patch includes a patch directory, at least one script file, a configuration file and a delivery item, and the first verification value is stored in the configuration file; the network device uses the patch directory, the configuration file and the first verification value as the first information.

[0065] In the second implementation method, the specific process for the network device to obtain the first information of each second patch is: the network device decompresses the configuration file included in each second patch from the patch package file; using the MD5 algorithm, the network device calculates the configuration file to obtain the second verification value; the network device uses the second verification value as the first information.

[0066] The first check value and the second check value are both 128-bit hash values, for example, 18684af9cf40fda36bf51b652c7d720d.

[0067] It should be noted that in the embodiment of the present application, the first check value is obtained by using the MD5 algorithm to calculate the delivered document and the script file by the patch creation tool, and the second check value is obtained by using the MD5 algorithm to calculate the configuration file by the network device.

[0068] In the aforementioned implementation, the network device obtains the first information in two ways. In one implementation, the network device decompresses all the contents of each second patch to obtain the first information; in another implementation, the network device decompresses the configuration file included in each second patch without decompressing other contents to obtain the first information.

[0069] Step 130: If there is first information identical to the second information of the first patch among the plurality of first information, then add the patch directory name of the third patch indicated by the first information identical to the second information to the whitelist;

[0070] Specifically, according to the description of step 120, after the network device obtains the first information, it will also obtain the second information of the first patch.

[0071] The network device determines whether there is first information that is the same as the second information of the first patch among the plurality of first information.

[0072] If there is first information that is identical to the second information among multiple first information, the network device determines that the third patch indicated by the first information has been installed locally on the network device, and the network device generates a whitelist, that is, the patch directory name of the third patch indicated by the first information that is identical to the second information (for example, patch A in the aforementioned example) is added to the whitelist.

[0073] The patch directory names stored in the whitelist in the embodiment of the present application are all patches that exist in the patch package file to be installed and have been previously installed locally on the network device.

[0074] If there are multiple first information that are different from the second information, the network device determines that the third patches indicated by the first information have not been installed locally on the network device before, and the network device installs each third patch.

[0075] It is understandable that, according to the description of step 120, the first information includes multiple forms, and therefore, the second information of the first patch also includes multiple forms. In a first implementation, the second information includes a patch directory, a configuration file, and a checksum of the first patch; in a second implementation, the second information includes a checksum of the first patch.

[0076] In the first implementation, the checksum of the first patch is obtained by using the MD5 algorithm to calculate the delivery document and script file of the first patch by the patch creation tool. In the second implementation, the checksum of the first patch is obtained by using the MD5 algorithm to calculate the configuration file of the first patch by the network device.

[0077] Optionally, in the embodiment of the present application, the first information is a patch directory, a configuration file, and a first check value included in each second patch;

[0078] The specific process by which the above-mentioned network device determines whether there is first information in multiple first information that is identical to the second information of the first patch is: the network device compares whether the patch directory of each second patch is the same as the patch directory of the first patch, whether the configuration file of each second patch is the same as the configuration file of the first patch, and whether the first check value of each second patch is the same as the check value of the first patch; if each of the compared contents corresponds to the same, the network device determines that the third patch indicated by the first information is the same as the first patch.

[0079] Optionally, in the embodiment of the present application, the first information is a second check value of each second patch;

[0080] The specific process of the above-mentioned network device determining whether there is first information in multiple first information that is identical to the second information of the first patch is as follows: the network device compares whether the second verification value of each second patch is the same as the verification value of the first patch; if they are the same, the network device determines that the third patch indicated by the first information is the same as the first patch.

[0081] It can be understood that the number of first patches installed in the network device is at least one, and therefore, when performing the above-mentioned determination, the network device compares each first information with each second information respectively.

[0082] For example, the patch package includes patch A and patch B, and the network device has installed patch A, patch C, and patch D. At this time, the network device first judges the first information of patch A with the second information of the installed patch A, the second information of patch C, and the second information of patch D, respectively, to determine that patch A has been installed locally on the network device first; then, the network device judges the first information of patch B with the second information of the installed patch A, the second information of patch C, and the second information of patch D, respectively, to determine that patch B has not been installed locally on the network device first.

[0083] Step 140: According to the white list, obtain a fourth patch from the patch package file, and install the fourth patch in the network device, wherein the first information of the fourth patch is different from the second information.

[0084] Specifically, according to the description of step 130, after the network device generates the whitelist, the network device obtains the fourth patch from the patch package file according to the whitelist and installs the fourth patch in the network device. The first information of the fourth patch is different from the second information.

[0085] That is, the network device installs the patches in the patch package file that have not been installed locally before, and does not install the patches that have been installed locally before.

[0086] Optionally, in the embodiment of the present application, after the network device generates the whitelist, the network device first uninstalls the fifth patch different from the third patch in the installed first patch according to the whitelist. After the fifth patch is uninstalled, the network device installs the fourth patch.

[0087] It should be noted that, under normal circumstances, the patches included in the patch package file already include every patch previously installed on the network device and the new patch to be installed. In special scenarios, the patches included in the patch package file do not include every patch previously installed on the network device. In special scenarios, the aforementioned process of uninstalling the patch needs to be performed. At this time, the reasons for uninstalling the patch include: 1) there is no need to install the uninstalled patch; 2) there is a problem with the uninstalled patch itself and it is not suitable to continue to install.

[0088] As can be seen from the above, the network device obtains the first information through two different decompression methods. In this step, if the network device obtains the first information through the first implementation method, when obtaining the fourth patch, since the network device has decompressed all the second patches in advance, the network device can directly obtain the fourth patch from the decompressed second patch and install the fourth patch.

[0089] If the network device obtains the first information through the second implementation, when obtaining the fourth patch, since the network device only decompresses the configuration files of each second patch in advance, when obtaining the fourth patch, the network device also needs to decompress the other contents of the fourth patch, and then install the entire contents of the fourth patch after decompression. It can be understood that in this implementation, the network device only decompresses the patch to be installed.

[0090] According to the above example, after the network device generates a whitelist, the whitelist includes the patch directory name of patch A. According to the whitelist, the network device first uninstalls the locally installed patches C and D, and then obtains patch B (patch B can be obtained by decompressing it in the above two ways) and installs it.

[0091] Therefore, by applying the patch package processing method provided by the present application, the network device obtains a patch package file, which includes multiple second patches; if the network device supports the patch incremental upgrade function, then according to each second patch, the network device obtains the first information of each second patch; if there is first information that is the same as the second information of the first patch among the multiple first information, the network device adds the patch directory name of the third patch indicated by the first information that is the same as the second information to the whitelist; according to the whitelist, the network device obtains the fourth patch from the patch package file, and installs the fourth patch in the network device, the first information of the fourth patch is different from the second information.

[0092] In this way, for network devices that have installed strong patch packages, by setting up a whitelist to store previously installed and identical patches, patch uninstall and installation operations are reduced, and problems that have been fixed during patch package upgrades are avoided from reappearing, thereby enhancing the stability of network device systems and saving time and hardware resources for patch package upgrades. At the same time, it also solves the problem that in the existing process of updating strong patch packages, after uninstalling the old version of the strong patch package and before installing the new version of the strong patch package, the operating system is not protected by the old version of the strong patch package and is vulnerable to attacks.

[0093] The patch package processing method provided in the embodiment of the present application is described in detail below. Referring to Figure 2-A and Figure 2-B, Figure 2-A is a patch package processing flow chart provided in the embodiment of the present application, and Figure 2-B is another patch package processing flow chart provided in the embodiment of the present application.

[0094] In Figure 2-A, after patch A included in patch package file H01 has been installed in the network device, the network device continues to run and process services. During the operation of the network device, various emergencies (code bugs, program freezes, etc.) may occur in the system software and service modules. Patch A installed in the network device can no longer solve the above emergencies, affecting the normal processing of services by the network device.

[0095] The manager locates the sudden problem and calls the patch making tool to generate a patch package file H02, which includes two patches, namely, patch A and patch B.

[0096] The administrator sends the patch package file H02 to the network device in the form of command line or Netconf.

[0097] In the embodiment of the present application, both the patch package file H01 and the patch package file H02 are strong patch package files. The patch package file directory structure has been described in step 110 of the above embodiment, and will not be repeated here.

[0098] After the network device obtains the patch package file H02, it first identifies whether it supports the patch incremental upgrade function. The network device identifies whether a patch script file (patch_script) already exists in itself; if the patch script file (patch_script) exists locally in the network device (system package), the network device determines that it supports the patch incremental upgrade function; if the patch script file (patch_script) does not exist locally in the network device, the network device determines that it does not support the patch incremental upgrade function.

[0099] The structure of the patch script file (patch_script) has been described in step 120 of the aforementioned embodiment and will not be repeated here.

[0100] If the network device itself supports the patch incremental upgrade function, then according to the patch A and the patch B included in the patch package file H02, the network device obtains information 1 of each patch.

[0101] The network device extracts patch A from the patch package file H02 to the directory / etc / patch / 2 / patchA, and extracts patch B to the directory / etc / patch / 2 / patchB. The above two directories are patch installation directories.

[0102] It should be noted that in the embodiment of the present application, there is also a temporary patch backup directory / etc / patch / bak / 2 in the network device. When the network device installs patch A included in the patch package file H01, the patch A is installed in the directory / etc / patch / 2, that is, / etc / patch / 2 / patchA.

[0103] Before the network device extracts the patch from the patch package file H02, it first backs up the patch A included in the patch package file H01 to avoid overwriting the installed patch A when the patch is extracted from the patch package file H02. The network device calls the patch script file (patch_script) to back up the patch A included in the patch package file H01, and backs up the patch A included in the patch package file H01 to the temporary patch backup directory / etc / patch / bak / 2. That is, mv-rf / etc / patch / 2 / patchA / etc / patch / bak / 2 / patchA.

[0104] After the network device A decompresses the patch A and the patch B included in the patch package file H02, it obtains the information 1 of each patch. The information 1 of each patch includes the patch directory, the configuration file, and the check value 1 stored in the configuration file.

[0105] After the network device obtains the information 1 of each patch included in the patch package file H02, it also obtains the information 2 of patch A included in the patch package file H01.

[0106] The network device determines whether the information 1 of each patch contains the same information 1 as the information 2 of patch A. It is understandable that the information 2 also includes the patch directory, the configuration file, and the check value 2 stored in the configuration file. Each content included in the information 1 must correspond to each content included in the information 2.

[0107] In the embodiment of the present application, the checksum value of each patch included in the patch package file H02 is obtained by calculating the patch delivery and script file by the patch production tool using the MD5 algorithm, and is stored in the configuration file.

[0108] In the embodiment of the present application, the information 1 of patch A included in the patch package file H02 is the same as the information 2 of patch A included in the patch package file H01. The network device determines that the patch A indicated by the information 1 has been previously installed locally on the network device, and the network device generates a whitelist. The whitelist includes the patch directory name (patch) A of the patch A included in the patch package file H02.

[0109] After generating the whitelist, network device A uninstalls the patch in patch package file H01 according to the patch directory name recorded in the whitelist. In the embodiment of the present application, patch package file H01 includes patch A, and since patch A is the same as patch A included in patch package file H02, the network device does not uninstall the previously installed patch A.

[0110] At the same time, the network device calls the patch script file (patch_script) to restore patch A backed up in the temporary patch backup directory to the directory / etc / patch / 2 / , that is, / etc / patch / 2 / patchA. The network device deletes patch A in the temporary patch backup directory.

[0111] The network device calls the patch script file (patch_script) again, and according to the whitelist, the network device determines to incrementally decompress and install patch B included in the patch package file H02, and decompresses and installs patch B in the directory / etc / patch / 2 / patchB.

[0112] At this point, the network device has realized that the installed same strong patch package is not uninstalled, and different strong patch packages are installed at the same time.

[0113] In Figure 2-B, after patch A included in patch package file H01 has been installed in the network device, the network device continues to run and process services. During the operation of the network device, various emergencies (code bugs, program freezes, etc.) may occur in the system software and service modules. Patch A installed in the network device can no longer solve the above emergencies, affecting the normal processing of services by the network device.

[0114] The manager locates the sudden problem and calls the patch making tool to generate a patch package file H02, which includes two patches, namely, patch A and patch B.

[0115] The administrator sends the patch package file H02 to the network device in the form of command line or Netconf.

[0116] In the embodiment of the present application, both the patch package file H01 and the patch package file H02 are strong patch package files. The patch package file directory structure has been described in step 110 of the above embodiment, and will not be repeated here.

[0117] After the network device obtains the patch package file H02, it first identifies whether it supports the patch incremental upgrade function. The network device identifies whether a patch script file (patch_script) already exists in itself; if the patch script file (patch_script) exists locally in the network device (system package), the network device determines that it supports the patch incremental upgrade function; if the patch script file (patch_script) does not exist locally in the network device, the network device determines that it does not support the patch incremental upgrade function.

[0118] The structure of the patch script file (patch_script) has been described in step 120 of the aforementioned embodiment and will not be repeated here.

[0119] If the network device itself supports the patch incremental upgrade function, then according to the patch A and the patch B included in the patch package file H02, the network device obtains the information 3 of each patch.

[0120] The network device decompresses the configuration files included in patch A from the patch package file H02 to the directory / etc / patch / 2 / patchA, and decompresses the configuration files included in patch B to the directory / etc / patch / 2 / patchB. The above two directories are patch installation directories.

[0121] It should be noted that in the embodiment of the present application, there is also a temporary patch backup directory / etc / patch / bak / 2 in the network device. When the network device installs patch A included in the patch package file H01, the patch A is installed in the directory / etc / patch / 2, that is, / etc / patch / 2 / patchA.

[0122] Before the network device extracts the configuration files included in each patch from the patch package file H02, it first backs up the patch A included in the patch package file H01 to avoid overwriting the installed patch A when extracting the configuration files included in each patch from the patch package file H02. The network device calls the patch script file (patch_script) to back up the patch A included in the patch package file H01, and backs up the patch A included in the patch package file H01 to the patch temporary backup directory / etc / patch / bak / 2. That is, mv-rf / etc / patch / 2 / patchA / etc / patch / bak / 2 / patchA.

[0123] After decompressing the configuration files of each patch included in the patch package file H02, the network device A calculates the configuration files of each patch using the MD5 algorithm to obtain the check value 3 of patch A and the check value 4 of patch B. The network device uses the check value of each patch as the information 1 of each patch.

[0124] After the network device obtains the information 1 of each patch included in the patch package file H02, it also obtains the configuration file of patch A included in the patch package file H01. Using the MD5 algorithm, the network device calculates the configuration file of patch A and obtains the check value 5 of patch A. The network device uses the check value 5 as the information 2 of patch A.

[0125] The network device determines whether there is information 1 identical to information 2 of patch A in the information 1 of each patch. In the embodiment of the present application, information 1 of patch A included in patch package file H02 is identical to information 2 of patch A included in patch package file H01. The network device determines that patch A indicated by information 1 has been previously installed locally on the network device, and the network device generates a whitelist. The whitelist includes the patch directory name (patch) A of patch A included in patch package file H02.

[0126] After generating the whitelist, network device A uninstalls the patch in patch package file H01 according to the patch directory name recorded in the whitelist. In the embodiment of the present application, patch package file H01 includes patch A, and since patch A is the same as patch A included in patch package file H02, the network device does not uninstall the previously installed patch A.

[0127] At the same time, the network device calls the patch script file (patch_script) to restore patch A backed up in the temporary patch backup directory to the directory / etc / patch / 2 / , that is, / etc / patch / 2 / patchA. The network device deletes patch A in the temporary patch backup directory.

[0128] The network device calls the patch script file (patch_script) again, and according to the whitelist, the network device determines to incrementally decompress and install patch B included in the patch package file H02. The network device incrementally decompresses patch B in the patch package file H02 in the directory / etc / patch / 2 / , and installs patch B in the directory / etc / patch / 2 / .

[0129] At this point, the network device has realized that the installed same strong patch package is not uninstalled, and different strong patch packages are installed at the same time.

[0130] Based on the same inventive concept, the present application embodiment also provides a patch package processing device corresponding to the patch package processing method. Figure 3 , Figure 3 A patch package processing device provided in an embodiment of the present application is applied to a network device, in which at least one first patch has been installed, and includes:

[0131] A first acquiring unit 310 is used to acquire a patch package file, where the patch package file includes a plurality of second patches;

[0132] A second acquisition unit 320 is configured to acquire first information of each second patch according to each second patch if the network device supports a patch incremental upgrade function;

[0133] an adding unit 330, configured to add a patch directory name of a third patch indicated by the first information identical to the second information to the whitelist if there is first information identical to the second information of the first patch among the plurality of first information;

[0134] The installation unit 340 is used to obtain a fourth patch from the patch package file according to the white list, and install the fourth patch in the network device, wherein the first information of the fourth patch is different from the second information.

[0135] Optionally, the device further comprises:

[0136] An uninstallation unit (not shown in the figure) is used to uninstall a fifth patch different from the third patch in the installed first patch according to the white list.

[0137] Optionally, the device further comprises:

[0138] An identification unit (not shown in the figure), used to identify whether a patch script file already exists in the network device;

[0139] A first determining unit (not shown in the figure) is used to determine that the network device supports a patch incremental upgrade function if the patch script file exists;

[0140] The second determining unit (not shown in the figure) is used to determine that the network device does not support the patch incremental upgrade function if the patch script file does not exist.

[0141] Optionally, the second obtaining unit 320 is specifically configured to decompress each second patch from the patch package file, wherein the second patch includes a patch directory, at least one script file, a configuration file, and a delivery item, and the first check value is stored in the configuration file;

[0142] Using the patch directory, the configuration file, and the first check value as the first information;

[0143] or;

[0144] The second acquisition unit 320 is specifically used to decompress the configuration file included in each second patch from the patch package file;

[0145] Using the MD5 algorithm, the configuration file is calculated to obtain a second check value;

[0146] The second check value is used as the first information.

[0147] Optionally, the first information is a patch directory, a configuration file, and a first check value included in each second patch;

[0148] The device also includes:

[0149] a comparing unit (not shown in the figure), used to compare whether the patch directory, configuration file and first check value of each second patch are the same as the patch directory, configuration file and check value of the first patch;

[0150] A third determining unit (not shown in the figure) is used to determine that the third patch indicated by the first information is the same as the first patch if they are the same.

[0151] Optionally, the first information is a second check value of each second patch;

[0152] The device also includes:

[0153] a comparing unit (not shown in the figure), used for comparing whether the second check value of each second patch is the same as the check value of the first patch;

[0154] A third determining unit (not shown in the figure) is used to determine that the third patch indicated by the first information is the same as the first patch if they are the same.

[0155] Optionally, the patch package file also includes a patch package installation script, a patch tool, and a patch package uninstallation script.

[0156] Therefore, by applying the patch package processing device provided by the present application, the network device obtains a patch package file, which includes multiple second patches; if the network device supports the patch incremental upgrade function, then according to each second patch, the network device obtains the first information of each second patch; if there is first information that is the same as the second information of the first patch among the multiple first information, the network device adds the patch directory name of the third patch indicated by the first information that is the same as the second information to the whitelist; according to the whitelist, the network device obtains the fourth patch from the patch package file, and installs the fourth patch in the network device, the first information of the fourth patch is different from the second information.

[0157] In this way, for network devices that have installed strong patch packages, by setting up a whitelist to store previously installed and identical patches, patch uninstall and installation operations are reduced, and problems that have been fixed during patch package upgrades are avoided from reappearing, thereby enhancing the stability of network device systems and saving time and hardware resources for patch package upgrades. At the same time, it also solves the problem that in the existing process of updating strong patch packages, after uninstalling the old version of the strong patch package and before installing the new version of the strong patch package, the operating system is not protected by the old version of the strong patch package and is vulnerable to attacks.

[0158] Based on the same inventive concept, the embodiment of the present application also provides a network device, such as Figure 4As shown, it includes a processor 410, a transceiver 420 and a machine-readable storage medium 430, the machine-readable storage medium 430 stores machine-executable instructions that can be executed by the processor 410, and the processor 410 is prompted by the machine-executable instructions to execute the patch package processing method provided in the embodiment of the present application. Figure 3 The patch package processing device shown in the figure can be used as follows Figure 4 The network device hardware structure shown is implemented.

[0159] The computer-readable storage medium 430 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the computer-readable storage medium 430 may also be at least one storage device located away from the processor 410.

[0160] The processor 410 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components.

[0161] In the embodiment of the present application, the processor 410 reads the machine executable instructions stored in the machine readable storage medium 430, and the machine executable instructions enable the processor 410 itself and the transceiver 420 to execute the patch package processing method described in the aforementioned embodiment of the present application.

[0162] In addition, an embodiment of the present application provides a machine-readable storage medium 430, which stores machine-executable instructions. When called and executed by the processor 410, the machine-executable instructions prompt the processor 410 itself and the calling transceiver 420 to execute the patch package processing method described in the aforementioned embodiment of the present application.

[0163] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0164] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0165] As for the patch package processing device and the machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0166] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A patch package processing method, characterized in that: The method is applied to a network device, in which at least one first patch has been installed, and the method comprises: Obtaining a patch package file, wherein the patch package file includes a plurality of second patches; If the network device supports a patch incremental upgrade function, obtaining first information of each second patch according to each second patch; If there is first information identical to the second information of the first patch among the plurality of first information, then adding the patch directory name of the third patch indicated by the first information identical to the second information to the whitelist; According to the white list, a fourth patch is obtained from the patch package file, and the fourth patch is installed in the network device, wherein the first information of the fourth patch is different from the second information.

2. The method according to claim 1, characterized in that: After adding the patch directory name of the third patch indicated by the first information that is the same as the second information to the whitelist, the method further includes: According to the white list, a fifth patch different from the third patch in the installed first patch is uninstalled.

3. The method according to claim 1, characterized in that The method further comprises: Identify whether a patch script file already exists in the network device; If the patch script file exists, determining that the network device supports the patch incremental upgrade function; If the patch script file does not exist, it is determined that the network device does not support the patch incremental upgrade function.

4. The method according to claim 1, characterized in that The obtaining of the first information of each second patch specifically includes: Decompress each second patch from the patch package file, wherein the second patch includes a patch directory, at least one script file, a configuration file, and a delivery item, wherein the configuration file stores a first check value; Using the patch directory, the configuration file, and the first check value as the first information; or; The obtaining of the first information of each second patch specifically includes: Decompressing the configuration files included in each second patch from the patch package file; Using the MD5 algorithm, the configuration file is calculated to obtain a second check value; The second check value is used as the first information.

5. The method according to claim 1, characterized in that The first information includes a patch directory, a configuration file, and a first check value included in each second patch; After obtaining the first information of each second patch, the method further includes: Comparing whether the patch directory, configuration file, and first check value of each second patch are the same as the patch directory, configuration file, and check value of the first patch; If they are the same, it is determined that the third patch indicated by the first information is the same as the first patch.

6. The method according to claim 1, characterized in that The first information is a second check value of each second patch; After obtaining the first information of each second patch, the method further includes: comparing whether the second check value of each second patch is the same as the check value of the first patch; If they are the same, it is determined that the third patch indicated by the first information is the same as the first patch.

7. The method according to claim 1, characterized in that The patch package file also includes a patch package installation script, a patch tool, and a patch package uninstallation script.

8. A patch package processing device, characterized in that: The device is applied to a network device, in which at least one first patch has been installed, and comprises: A first acquiring unit, configured to acquire a patch package file, wherein the patch package file includes a plurality of second patches; A second acquisition unit is configured to acquire first information of each second patch according to each second patch if the network device supports a patch incremental upgrade function; an adding unit, configured to add a patch directory name of a third patch indicated by the first information identical to the second information to the whitelist if there is first information identical to the second information of the first patch among the plurality of first information; The installation unit is used to obtain a fourth patch from the patch package file according to the white list, and install the fourth patch in the network device, wherein the first information of the fourth patch is different from the second information.

9. The device according to claim 8, characterized in that The device also includes: The uninstallation unit is used to uninstall a fifth patch different from the third patch in the installed first patch according to the white list.

10. The device according to claim 8, characterized in that The device also includes: An identification unit, used to identify whether a patch script file already exists in the network device; A first determining unit, configured to determine whether the network device supports a patch incremental upgrade function if the patch script file exists; The second determining unit is configured to determine that the network device does not support a patch incremental upgrade function if the patch script file does not exist.

11. The device according to claim 8, characterized in that The second acquisition unit is specifically used to decompress each second patch from the patch package file, wherein the second patch includes a patch directory, at least one script file, a configuration file, and a delivery item, and the first check value is stored in the configuration file; Using the patch directory, the configuration file, and the first check value as the first information; or; The second obtaining unit is specifically used to decompress the configuration file included in each second patch from the patch package file; Using the MD5 algorithm, the configuration file is calculated to obtain a second check value; The second check value is used as the first information.

12. The device according to claim 8, characterized in that The first information includes a patch directory, a configuration file, and a first check value included in each second patch; The device also includes: a comparing unit, configured to compare whether the patch directory, configuration file, and first check value of each second patch are the same as the patch directory, configuration file, and check value of the first patch; The third determining unit is configured to determine that the third patch indicated by the first information is the same as the first patch if they are the same.

13. The device according to claim 8, characterized in that The first information is a second check value of each second patch; The device also includes: a comparing unit, configured to compare whether a second check value of each second patch is the same as the check value of the first patch; The third determining unit is configured to determine that the third patch indicated by the first information is the same as the first patch if they are the same.

14. The device according to claim 8, characterized in that The patch package file also includes a patch package installation script, a patch tool, and a patch package uninstallation script.