Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/nfcapd.1
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ The following hierarchies are defined:
.El
.It Fl t Ar interval
Sets the time interval in seconds to rotate files. The default value is 300s ( 5min ).
The smallest available interval is 2s.
The smallest available interval is 1s.
.It Fl s Ar rate
Apply sampling rate
.Ar rate
Expand Down
2 changes: 1 addition & 1 deletion man/nfpcapd.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ The base directory (
.Fl l )
is concatenated with the specified sub hierarchy format to form the final data directory. For a full list of hierarchies see nfcapd(1).
.It Fl t Ar interval
Specifies the time interval in seconds to rotate files. The default value is 300s ( 5min ). The smallest interval can be set to 2s. The intervals are in sync with wall clock.
Specifies the time interval in seconds to rotate files. The default value is 300s ( 5min ). The smallest interval can be set to 1s. The intervals are in sync with wall clock.
.It Fl P Ar pidfile
Specify name of pidfile. Default is no pidfile.
.It Fl D
Expand Down
2 changes: 1 addition & 1 deletion man/sfcapd.1
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ The following hierarchies are defined:
.El
.It Fl t Ar interval
Sets the time interval in seconds to rotate files. The default value is 300s ( 5min ).
The smallest available interval is 2s.
The smallest available interval is 1s.
.It Fl z=lzo
Compress flow files with LZO1X-1 compression. Fastest compression.
.It Fl z=bz2
Expand Down
11 changes: 5 additions & 6 deletions src/nfcapd/nfcapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ static void run(collector_ctx_t *ctx, packet_function_t receive_packet, int sock
uint32_t ignored_packets = 0;
uint64_t packets = 0;

// wake up at least at next time slot (twin) + 1s
alarm(t_start + twin + 1 - time(NULL));
// wake up at next time slot (twin) for precise rotation
alarm(t_start + twin - time(NULL));
/*
* Main processing loop:
* this loop, continues until = 1, set by the signal handler
Expand Down Expand Up @@ -374,11 +374,10 @@ static void run(collector_ctx_t *ctx, packet_function_t receive_packet, int sock
* update alarm for next cycle
* t_start = filename time stamp: begin of slot
* + twin = end of next time interval
* + 1 = act at least 1s after time window expired
* - t_now = difference value to now
*/
t_start += twin;
alarm(t_start + twin + 1 - t_now);
alarm(t_start + twin - t_now);
}

/* check for EINTR and continue */
Expand Down Expand Up @@ -694,8 +693,8 @@ int main(int argc, char **argv) {
break;
case 't':
twin = atoi(optarg);
if (twin < 2) {
LogError("time interval <= 2s not allowed");
if (twin < 1) {
LogError("time interval < 1s not allowed");
exit(EXIT_FAILURE);
}
if (twin < 60) {
Expand Down
4 changes: 2 additions & 2 deletions src/nfpcapd/nfpcapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ int main(int argc, char *argv[]) {
} break;
case 't':
t_win = atoi(optarg);
if (t_win < 2) {
LogError("time interval <= 2s not allowed");
if (t_win < 1) {
LogError("time interval < 1s not allowed");
exit(EXIT_FAILURE);
}
if (t_win < 60) {
Expand Down
11 changes: 5 additions & 6 deletions src/sflow/sfcapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ static void run(collector_ctx_t *ctx, packet_function_t receive_packet, int sock
uint32_t ignored_packets = 0;
uint64_t packets = 0;

// wake up at least at next time slot (twin) + 1s
alarm(t_start + twin + 1 - time(NULL));
// wake up at next time slot (twin) for precise rotation
alarm(t_start + twin - time(NULL));
/*
* Main processing loop:
* this loop, continues until = 1, set by the signal handler
Expand Down Expand Up @@ -352,11 +352,10 @@ static void run(collector_ctx_t *ctx, packet_function_t receive_packet, int sock
* update alarm for next cycle
* t_start = filename time stamp: begin of slot
* + twin = end of next time interval
* + 1 = act at least 1s after time window expired
* - t_now = difference value to now
*/
t_start += twin;
alarm(t_start + twin + 1 - t_now);
alarm(t_start + twin - t_now);
}

/* check for EINTR and continue */
Expand Down Expand Up @@ -643,8 +642,8 @@ int main(int argc, char **argv) {
break;
case 't':
twin = atoi(optarg);
if (twin < 2) {
LogError("time interval <= 2s not allowed");
if (twin < 1) {
LogError("time interval < 1s not allowed");
exit(EXIT_FAILURE);
}
if (twin < 60) {
Expand Down