Packet capture device, time stamp correction method, packet capture method, and packet capture program

The packet capture device uses dual local timers to synchronize and correct timestamp values, ensuring consistent ordering and accurate packet analysis by calculating differences between global and local timers.

JP7540507B2Active Publication Date: 2024-08-27NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
JP2022567939
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2020-12-09
Publication Date
2024-08-27
Estimated Expiration
2040-12-09

AI Technical Summary

Technical Problem

Existing packet capture devices face inconsistencies in timestamp ordering due to direct correction of local timers with global timers, leading to difficulties in identifying packets around the time of failure during analysis.

Method used

A packet capture device equipped with two local timers, one synchronized with a global timer and another for timestamp addition, calculates and corrects timestamp values based on the difference between these timers to ensure consistent timestamp ordering.

Benefits of technology

Prevents time inconsistencies in packet capture files by uniformly correcting timestamp values, enabling accurate packet ordering and analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007540507000004
    Figure 0007540507000004
  • Figure 0007540507000009
    Figure 0007540507000009
  • Figure 0007540507000010
    Figure 0007540507000010
Patent Text Reader

Abstract

A packet capture device (10) according to the present invention comprises: a first local timer (141) that synchronizes with an external global timer; a second local timer (142); a time stamp provision unit (11) that provides a time stamp to an input packet signal on the basis of the second local timer (142); a filter unit (12) that selects the packet signal to which the time stamp has been provided; a capture file generation unit (14) that receives input of the selected packet signal; and a storage unit (15) that stores a capture file generated by the capture file generation unit. The capture file generation unit (14) calculates the difference between the timer value (141) of the first local timer and the timer value of the second local timer (142), and corrects a time stamp value on the basis of the difference. Thus, the packet capture device according to the present invention can correct the time provided in the time stamp and prevent inconsistency in the time.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a packet capture device that corrects a timestamp, a timestamp correction method, a packet capture method, and a packet capture program. [Background technology]

[0002] With the advancement of virtualization technology in NFV (Network Function Virtualization) / SDN (Software Defined Networking), various services using virtual machines (VMs) are being provided. A packet capture device that can selectively capture packets of a specific flow is one of the essential devices for analyzing the quality and failures of the above services. Here, a specific flow is a collection of packets that have the same rules for combining source and destination MAC addresses, IP addresses, etc.

[0003] A packet capture device assigns a timestamp to each captured packet. The timestamp value indicates the time the packet was captured by the device and is assigned based on the local timer installed in the device. It is desirable to synchronize the local timer with a global timer based on an NTP server, GPS, etc. For this reason, conventional packet capture devices have been equipped with one local timer and have directly corrected the local timer value based on the global timer value notified via a time synchronization interface (Non-Patent Document 1). [Prior art documents] [Patent documents]

[0004] [Patent Document 1] Patent No. 5053918 [Non-patent literature]

[0005] [Non-Patent Document 1] fmadio, “10G Packet Capture”, https: / / fmad.io / jp.index.html Summary of the Invention [Problem to be solved by the invention]

[0006] If the local timer value is directly corrected, and the local timer value is ahead of the global timer value, the timestamp assigned to the packet input immediately before the correction will be in the future than the timestamp assigned to the packet input immediately after the correction, resulting in a time order inconsistency. In fault analysis, packets around the time of the fault are identified from the packet data recorded in the generated pcap (packet capture) file using timestamp values, so if the inconsistency occurs within the same pcap file, this identification becomes difficult.

[0007] A method has also been disclosed in which a statistical value of the time difference between the global timer value and the local timer value is calculated and the local timer value is corrected based on this statistical value (Patent Document 1). However, even if the correction frequency is reduced, the local timer value is still corrected directly, and it is difficult to prevent such inconsistencies from occurring within the same pcap file. [Means for solving the problem]

[0008] In order to solve the above-mentioned problems, a packet capture device according to the present invention includes a first local timer synchronized with an external global timer, a second local timer, a timestamp assigning unit that assigns a timestamp to an input packet signal based on the second local timer, a filter unit that selects the packet signal to which the timestamp has been assigned, a capture file generating unit to which the selected packet signal is input, and a storage unit that stores a capture file generated by the capture file generating unit, wherein the capture file generating unit calculates a difference between the timer value of the first local timer and the timer value of the second local timer, When generating the capture file, The timestamp value is calculated based on the difference. uniformly The present invention is characterized by correcting the above-mentioned.

[0009] Furthermore, a timestamp correction method according to the present invention is a method for correcting a timestamp value in a packet signal, the method comprising the steps of: setting the timer value of a first local timer as an initial value in a second local timer; assigning a timestamp to an input packet signal based on the timer value of the second local timer; acquiring the timer values ​​of the first local timer and the second local timer; and calculating the difference between the time determined by the first local timer and the timer value of the second local timer. When generating the capture file, Based on the difference, a timestamp value assigned to the packet signal is calculated. uniformly and a step of correcting the difference.

[0010] Furthermore, a packet capture program according to the present invention includes, for a packet capture device including a timestamp assigning unit, a filter unit, a capture file generating unit, a first local timer, and a second local timer, the steps of: setting the timer value of the first local timer as an initial value in the second local timer; causing the timestamp assigning unit to assign a timestamp to a packet signal based on the timer value of the second local timer; causing the filter unit to select the packet signal to which the timestamp has been assigned; and causing the capture file generating unit to: The aforementioned The timer value of the first local timer is The aforementioned a step of acquiring a timer value of a second local timer, and a step of calculating a difference between the timer value of the first local timer and the timer value of the second local timer; When generating the capture file, Based on the difference, a timestamp value assigned to the packet signal is calculated. uniformly The packet capture device is caused to function by executing a process including the steps of: correcting the timestamp value; writing the captured packet data including the corrected timestamp value into a packet capture file; and stamping the timer value of the first local timer for the current capture file generation period into the packet capture file as the generation time of the packet capture file. [Effects of the Invention]

[0011] According to the present invention, the time given in the time stamp in the packet capture can be corrected to prevent time inconsistencies. [Brief explanation of the drawings]

[0012] [Figure 1] FIG. 1 is a schematic diagram showing the configuration of a packet capture device according to a first embodiment of the present invention. [Figure 2A] FIG. 2A is a flowchart illustrating a packet capture method according to the first embodiment of the present invention. [Figure 2B] FIG. 2B is a flowchart illustrating the packet capture method according to the first embodiment of the present invention. [Figure 3] FIG. 3 is a sequence diagram illustrating the packet capture method according to the first embodiment of the present invention. [Figure 4] FIG. 4 is a flowchart illustrating a packet capture method according to the second embodiment of the present invention. [Figure 5] FIG. 5 is a flowchart illustrating a packet capture method according to the third embodiment of the present invention. [Figure 6] FIG. 6 is a flowchart illustrating a packet capture method according to the fourth embodiment of the present invention. [Figure 7A] FIG. 7A is a diagram for explaining the operation of the packet capture device and method according to the first embodiment of the present invention. [Figure 7B] FIG. 7B is a diagram for explaining the operation of a conventional packet capture device and method. [Figure 8] FIG. 8 is a diagram illustrating an example of the configuration of a computer according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0013] First Embodiment A packet capture device according to a first embodiment of the present invention will be described with reference to FIGS.

[0014] <Configuration of packet capture device> As shown in FIG. 1, a packet capture device 10 according to this embodiment includes a timestamp adding unit 11, a filter unit 12, a buffer unit 13, a capture file generating unit 14, and a storage unit 15.

[0015] The capture file generation unit 14 includes a first local timer 141 , a second local timer 142 , and a difference calculation unit 143 .

[0016] The time stamp assigning unit 11 assigns a time stamp to a mirroring packet input from the network 1 to be monitored, based on a second local timer 142 .

[0017] The filter unit 12 selects packets to be captured.

[0018] The buffer unit 13 buffers the selected packets.

[0019] The capture file generation unit 14 converts the buffered packets into a pcap (packet capture) file, and corrects the timestamp value using the difference obtained by the difference calculation unit 143 between the times (timer values) obtained by the first local timer 141 and the second local timer 142.

[0020] Here, the first local timer 141 periodically acquires the global timer value from the global timer (NTP server / GPS signal) 2 and corrects the timer value, regardless of whether capture is started or stopped. For example, the first local timer 141 acquires the global timer value once per second.

[0021] On the other hand, when a capture start trigger is input from the outside, the second local timer 142 sets the timer value of the first local timer 141 as the initial value of the second local timer 142, and thereafter runs independently.

[0022] The packet capture device 10 according to this embodiment is equipped with two local timers, with their functions divided into a first local timer 141 for synchronizing with global timer 2 and a second local timer 142 for assigning timestamps to packets. When a packet arrives, a timestamp is assigned by the second local timer 142, and when a pcap file is generated, the assigned timestamp value is uniformly corrected based on the difference between the times (timer values) acquired by the first local timer 141 and the second local timer 142. This makes it possible to suppress inconsistencies in the time within the pcap file described above while maintaining synchronization with global timer 2.

[0023] <How to capture packets> The timestamp correction method according to this embodiment will be described in detail with reference to FIGS. 2A to 3. FIG.

[0024] In the packet capture device 10 according to this embodiment, time information is acquired from the global timer 2 into the first local timer 141 .

[0025] An external capture start trigger signal is input to the time stamp assignment unit 11, filter unit 12, buffer unit 13, capture file generation unit 14, and second local timer 142. In Fig. 3, for ease of visual understanding, the arrows indicating the input of the capture start trigger signal to each unit are shown not overlapping, but in reality they are input simultaneously. Alternatively, they may be input with a slight time difference.

[0026] 2A shows a flowchart of the sequential processing for each packet input. First, second local timer 142 sets the timer value of first local timer 141 as its initial value (step 201). Thereafter, second local timer 142 runs independently.

[0027] Next, when a mirrored packet is input from the monitored network (NW) 1 to the time stamp assigner 11, a time stamp is assigned based on the value of the second local timer 142 (step 202). For example, time stamps (t2, 1), (t2, 2), and so on (t2, N) are assigned to packets #1, #2, ..., #N, which are input in order. Here, "t2" indicates the value (timer value) of the second local timer 142, and "1", "2", and so on N indicate the first packet (packet #1), the second packet (packet #2), and the Nth packet (packet #N), respectively.

[0028] Next, the filter unit 12 selects packets to be captured (step 203). Here, the selection in the filter unit 12 is a process of selecting packets that match a list of flows to be captured. For this purpose, the filter unit 12 is provided with the list, and when a packet is input, the filter unit 12 identifies the flow of the packet, compares it with each flow recorded in the list, and passes packets that are determined to match, while discarding packets that do not match.

[0029] Next, the selected packets are buffered in the buffer unit 13 to obtain capture data (step 204).

[0030] 2B shows a flowchart of processing triggered by a predetermined condition. First, when the amount of buffered packet data reaches a predetermined amount, or when a predetermined time has elapsed, the capture file generator 14 starts converting the buffered packet data into a pcap file (step 205). For example, it starts converting the buffered data of packets #1 to #N into a pcap file.

[0031] At this time, the capture file generation unit 14 corrects the timestamp value as follows. First, the timer values ​​T1 and T2 of the first local timer 141 and the second local timer 142 are simultaneously acquired (step 206), and the difference calculation unit 143 calculates the time difference δ (=T1-T2) (step 207). In FIG. 3, for ease of visual understanding, the arrows (dotted lines) from the first local timer 141 and the second local timer 142 to the capture file generation unit 14 are shown as not overlapping, but in reality they are input simultaneously. Alternatively, they may be input with a slight time difference.

[0032] Next, the time difference δ is added to the time stamp value already assigned to each of the buffered packets, for example packets #1 to #N, to correct the time stamp value (step 208).

[0033] Next, the captured packet data including the corrected timestamp value is written to the pcap file (step 209).

[0034] When writing of all packets to be filed is completed, the pcap file is time-stamped with T1 as the time of creation of the pcap file, and the file creation is completed (step 210).

[0035] Finally, the data is stored in the storage unit 15 (for example, a hard disk) (step 211).

[0036] Hereinafter, the period from packet input to completion of pcap file creation and storage in the storage unit 15 will be referred to as the "capture file generation period."

[0037] After that, the same correction is made for subsequent input packets (for example, packets #N+1 onwards) and a pcap file is created.

[0038] In the packet capture device 10 according to this embodiment, for example, the timestamp assignment unit 11, the filter unit 12, the buffer unit 13, and the second local timer 142 are implemented as hardware, the capture file generation unit 14 is implemented as a general-purpose processor, and the first local timer 141 is implemented as a time source in the general-purpose processor, thereby enabling the packet capture device 10 to be constructed efficiently.

[0039] <Second embodiment> A packet capture device 20 and method according to a second embodiment of the present invention will now be described.

[0040] The packet capture device 20 and method according to this embodiment are substantially the same as those of the first embodiment, but differ in that it has a function of skipping correction of the timestamp value.

[0041] The configuration of the packet capture device 20 is the same as that of the first embodiment.

[0042] In the packet capture method according to the present embodiment, if the time difference δ is sufficiently small, there is no need to correct the timestamp value.

[0043] In detail, in the packet capture method, the sequential processing for each packet input (steps 301 to 304) is performed as follows: of This is the same as in the embodiment (steps 201 to 204).

[0044] In the process triggered by a predetermined condition shown in FIG. 4, steps 305 to 307 are of This is the same as in the embodiment (steps 205 to 207). After calculating the time difference δ (step 307), it is determined whether δ is less than a predetermined value (step 307a).

[0045] If δ is less than the specified value, the correction of the timestamp value (step 308) is skipped, and the data of the captured packet is written to the pcap file (step 309).

[0046] If δ is equal to or greater than a specified value, the timestamp value is corrected (step 308), and the captured packet data is written to the pcap file (step 309).

[0047] Step 309 and after are of It is the same as the embodiment.

[0048] This reduces the processing for δ addition in the capture file generation unit, thereby reducing the processing load.

[0049] <Third embodiment> A packet capture device and method according to a third embodiment of the present invention will now be described.

[0050] The packet capture device 30 and method according to this embodiment are substantially the same as those of the first embodiment, but the correction of the timestamp value is different.

[0051] The configuration of the packet capture device 30 is the same as that of the first embodiment.

[0052] In the packet capture method according to the present embodiment, the time average value of the time difference δ is used to correct the timestamp value instead of the time difference δ(T1-T2). Here, the timing for acquiring δ is the same as that in the first embodiment.

[0053] In detail, in the packet capture method, the sequential processing for each packet input (steps 401 to 404) is performed as follows: of This is the same as in the embodiment (steps 201 to 204).

[0054] In the process triggered by a predetermined condition shown in FIG. 5, steps 405 to 407 are of This is the same as in the embodiment (steps 205 to 207). After calculating the time difference δ (step 407), the time average value of δ calculated for each capture file generation period is calculated (step 407a). For example, a moving average of δ is calculated.

[0055] Step 408 and onwards are of It is the same as the embodiment.

[0056] This reduces time fluctuations in the timing of pcap file generation.

[0057] <Fourth embodiment> A packet capture device and method according to a fourth embodiment of the present invention will now be described.

[0058] The packet capture device 40 and method according to this embodiment are substantially the same as those of the first embodiment, but the correction of the timestamp value is different.

[0059] The configuration of the packet capture device 40 is the same as that of the first embodiment.

[0060] In this embodiment, the timestamp value correction is performed during capture operation by linear interpolation using the δ value (δprev) calculated in the previous capture file generation period and the δ value (δcurrent) calculated in the current capture file generation period to correct the timestamp value of each packet in the current capture file generation period.

[0061] In detail, in the packet capture method, the sequential processing for each packet input (steps 501 to 504) is performed as follows: of This is the same as in the embodiment (steps 201 to 204).

[0062] In the process triggered by a predetermined condition shown in FIG. 6, steps 505 to 507 are of This is the same as in the embodiment (steps 205 to 207). During the capture operation, the capture file generation unit holds the Δprev and T1 value (T1, prev) calculated during the immediately preceding capture file generation period.

[0063] After calculating the time difference δ (step 507), the δ value (δcurrent) and the T1 value (T1, current) at the current time are acquired at the timing of generating the pcap file (step 507a).

[0064] Next, it is determined whether δprev and δcurrent have the same sign (step 507b).

[0065] If δprev and δcurrent have the same sign, the timestamp value before correction is set to t, the timestamp value after correction is set to tmod, and tmod is calculated by linear interpolation using equation (1) (step 508a).

[0066]

number

[0067] If the signs of δprev and δcurrent are different, δcurrent is added to t to correct the timestamp value (step 508b), as in the first embodiment. Note that the initial value of δprev is 0, and the initial value of the T1 value (T1, prev) calculated during the immediately preceding capture file generation period is the capture start time.

[0068] Next, the capture file generator writes the data of the capture packet including the corrected timestamp value to the pcap file (step 509). of It is the same as the embodiment.

[0069] <First Example> A packet capture device and method according to a first embodiment of the present invention will be described below, which uses the packet capture device 10 and method according to the first embodiment.

[0070] In this embodiment, consider the case where packet #1 is input at 13:10:20.030 (13:10:20.030), packet #2 is input 10 milliseconds later, and the time (timer value) on the second local timer 142 is 20 milliseconds ahead of the time (timer value) on global timer 2 (first local timer 141).

[0071] In the packet capture device and method according to this embodiment, as shown in FIG. 7A, packet #1 is first input, and the second local timer 142 assigns a time of 13:10:20.030 to it, and the packet is buffered in the buffer unit 13 via the filter unit 12.

[0072] Next, packet #2 is input, and similarly, a time of 13:10:20.040 is assigned by the second local timer 142, and the packet is buffered in the buffer unit 13 via the filter unit 12.

[0073] Next, the capture file generation unit calculates the difference (-20 milliseconds) between the time (timer value) of the first local timer 141 (13:10:20.030) and the time (timer value) of the second local timer 142 (13:10:20.040), and adds this to the input time of each of packets #1 and #2, thereby correcting the timestamp values ​​of each of packets #1 and #2 to 13:10:20.010 and 13:10:20.020.

[0074] On the other hand, in a conventional packet capture device and method, as shown in Figure 7B, packet #1 is first input at 13:10:20.030. If a -20 millisecond correction is made after packet #1 is input, packet #2, which is input 10 milliseconds after packet #1, is timestamped at 13:10:20.020. In this way, the times at which timestamps are assigned (timestamp values) are reversed between packet #1 and packet #2, resulting in a mismatch in the time order.

[0075] As described above, according to the packet capture device and method of this embodiment, it is possible to correct the timestamp value without causing inconsistencies in the time order at which timestamped packets are input.

[0076] 8 shows an example of the configuration of a computer in a packet capture device according to an embodiment of the present invention. The packet capture device can be realized by a computer 60 including a CPU (Central Processing Unit) 63, a storage device (storage section) 62, and an interface device 61, and a program that controls these hardware resources. Here, for example, a buffer section 13 and a second local timer 142 are connected to the interface device 61. The CPU 63 executes the processing according to the embodiment of the present invention in accordance with a packet capture program stored in the storage device 62. In this way, the packet capture program causes the packet capture device to function.

[0077] In a packet capture device according to an embodiment of the present invention, a computer may be provided inside the device, or at least part of the computer's functions may be realized using an external computer. Furthermore, the time source in the CPU 63 may be used as the first local timer 141. Furthermore, the storage unit may also be a storage medium 64 external to the device, and a packet capture program stored in the storage medium 64 may be read and executed. Examples of the storage medium 64 include various magnetic recording media, magneto-optical recording media, CD-ROMs, CD-Rs, and various memories. Furthermore, the packet capture device program may be supplied to the computer via a communication line such as the Internet.

[0078] Although the packet capture device according to the embodiment of the present invention has been described as including a buffer unit, this is not limiting. It is also possible to buffer packets and store them sequentially in a memory unit without including a buffer unit, and then read and correct the packets from the memory unit when generating a capture file to create a pcap file.

[0079] Although the embodiment of the present invention has been described with reference to an example in which mirroring packets are input, the present invention can also be applied to other packet signals, such as optically copied packet signals. [Industrial Applicability]

[0081] The present invention relates to a packet capture device and method, and can be applied to a communication system. [Explanation of symbols]

[0082] 10 Packet Capture Device 11 Time stamp assignment section 12 Filter section 13 Buffer section 14 Capture file generator 141 First Local Timer 142 Second Local Timer 143 Difference calculation part 15 Storage section

Claims

1. a first local timer synchronized with an external global timer; a second local timer; a time stamp providing unit that provides a time stamp to an input packet signal based on the second local timer; a filter unit for selecting a packet signal to which the time stamp is added; a capture file generator to which the selected packet signal is input; a storage unit that stores the capture file generated by the capture file generation unit, A packet capture device characterized in that the capture file generation unit calculates the difference between the timer value of the first local timer and the timer value of the second local timer, and uniformly corrects the timestamp value based on the difference when generating the capture file.

2. 1. A method for correcting a timestamp value in a packet signal, comprising: setting a second local timer to an initial value equal to the timer value of the first local timer; providing a time stamp to an input packet signal based on a timer value of the second local timer; obtaining a timer value of the first local timer and a timer value of the second local timer; calculating a difference between the time measured by the first local timer and a timer value of the second local timer; a step of uniformly correcting the time stamp values ​​added to the packet signals based on the difference when generating a capture file; A time stamp correction method comprising:

3. comparing the difference with a predetermined specified value; When the difference is equal to or greater than a predetermined value, the time stamp value added to the packet signal is corrected based on the difference.

3. The method for correcting a time stamp according to claim 2, further comprising:

4. 4. The time stamp correction method according to claim 2, further comprising adding the difference to the time stamp value.

5. 4. The time stamp correction method according to claim 2, further comprising adding a time average value of the difference to the time stamp value.

6. 4. The time stamp correction method according to claim 2, wherein the time stamp value is corrected by equation (1). [0010] Here, tmod is the corrected timestamp value, t is the timestamp value before correction, δprev and δcurrent are the differences calculated during the previous and current capture file generation periods, respectively, and T1,prev and T1,current are the timer values ​​of the first local timer during the previous and current capture file generation periods, respectively.

7. The method for correcting a timestamp according to any one of claims 2 to 6, filtering said time-stamped packet signals; writing data of the captured packets including the corrected timestamp values ​​to a packet capture file; stamping the timer value of the first local timer into the packet capture file as a generation time of the packet capture file; A packet capture method comprising:

8. A packet capture device including a time stamp providing unit, a filter unit, a capture file generating unit, a first local timer, and a second local timer, setting the second local timer to an initial value equal to the timer value of the first local timer; causing the time stamp providing unit to provide a time stamp to a packet signal based on a timer value of the second local timer; causing the filter unit to select a packet signal to which the time stamp has been added; causing the capture file generation unit to acquire a timer value of the first local timer and a timer value of the second local timer; calculating a difference between a timer value of the first local timer and a timer value of the second local timer; a step of uniformly correcting the time stamp values ​​added to the packet signals based on the difference when a capture file is generated; causing a packet capture file to write data of the captured packets including the corrected timestamp values; a step of stamping a timer value of the first local timer during a current capture file generation period as a generation time of the packet capture file in the packet capture file; A packet capture program for causing the packet capture device to function, the packet capture program causing the packet capture device to execute a process comprising the steps of:

Citation Information

Patent Citations

  • JP1975053918A

  • Cycle control synchronizing system

    JP2002164872A

  • Packet time correcting method

    JP2006275937A

  • Accuracy improving method by post-processing time correction in packet measurement, correcting system, and program of same

    JP2009260706A

  • Packet capture device, packet capture method, and computer program

    JP2011250364A