c8d73c597a
Changes since 1.6.6: 2014-02-16 v1.6.12 - Add NAT pool port allocation - Modify/fix NAT vrf tags. Add egress vrf ID - Modify common record due to exporter exhaustion. new common record type 10 adds 4 extra bytes. Reads v1 common record transparently - Fix sflow potential crash 2013-11-13 v1.6.11 - Add ASA/NSEL 9.x protcol changes - Make it llvm compilable 2013-08-12 v1.6.10p1 - Fix -t +/- n timeslot option - Fix bug in nfanon - stat record update. - Fix bug in netflow v5 mudule: extension map size wrong. - Fix bug nfexport: In some cases could result in wrong flow counter. - Fix nftrack - could coredump in some cases. 2013-05-16 v1.6.10 - Fix SPARC compile/optimise bug - Add output packet/bytes counter to global stat - importatnt for NSEL flows ASA > 8.5 - Add NSEL filter options xnet - Modify extension descriptor code for nfdump1.7. Still use 1.6 extension map layout for compatibility - Add prototype for nfpcapd - pcap -> nfdump collector. Converts traffoc directly to nfdump files. - Fix bug in ipfix module: uninitialised variable - Cleanup syslog/LogError calls - Fix minor non critical bugs and compile issues 2013-03-02 v1.6.9 - Fix some bugs in beta 1.6.9 NSEL code - Fix bug statistics update with aggreagted flow records - Fix sflow bug sfcapd stores wrong (ghost) dump by past samples in same sflow datagram 2013-03-02 v1.6.9 - Fix some bugs in beta 1.6.9 NSEL code - Fix bug statistics update with aggreagted flow records - Fix sflow bug sfcapd stores wrong (ghost) dump by past samples in same sflow datagram 2012-12-31 - Add time received in csv output - ICMP should handled better now - somewhat - Implement ASA NSEL records - Add definitions in nffile and nx for ASA NSEL extensions 2012-11-09 v1.6.8p1 - Add dynamic source directory tree for multiple exporters - Fix exporter bug: 'too many exporters' with large time windows - Fix uninitialised exporter sysid in default sampler record - v9 - Fix v9/ipfix cache initialisation with no templates > 1 in same packet 2012-10-26 v1.6.8 - Add ip list option for 'next ip' in filter syntax - Accept v9 sampler_id in 2bytes - Fix IPFIX mac address bug - did not get collected - Add IPFIX packet/octet TotalCount fields 85/86 - Add received timestamp to sflow collector - Fix long flow duration calculation - 32bit overflow - Fix v9 sampling ID: allow 2 byte ID - Add IPFIX options as rfc5101 section-6.2 - Add exporter records for sflow collector - Fix bug for MAC address printing %idmc and %odmc. - Add received time stamp extension - Add recursive format parser. Allows to extend predefined formats. - Change flow record sorting to heapsort. remove limit 1000 - Merge -m option to -O tstart. -m now depricated. - Add -O tend. Print order according to tend of flows ascending - Apply -O print order for printing flow cache. Applies to -A 2012-07-31 v1.6.7-tc-1 - Special version for TC - Print exporter and sampling records with nfdump -E - Added exporter and sampling records to file. 2012-07-30 v1.6.7 - Prepare for file catalog in current file format. - Fix bug in ReadBlock when reading flow from stdin pipe - Add new more flexible translation engine for v9 - Add nprobe client/server delay fields - Prepare for NSEL merging - Fix memory corruption with double -A flags - Fix bug in nfreader with compat15 mode files
55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
$NetBSD: patch-bin_nfcapd.c,v 1.2 2015/04/03 10:18:53 hiramatsu Exp $
|
|
|
|
use PATH_MAX instead of MAXPATHLEN if available
|
|
|
|
--- bin/nfcapd.c.orig 2012-03-09 18:25:51.000000000 +0000
|
|
+++ bin/nfcapd.c
|
|
@@ -72,6 +72,7 @@
|
|
#include <sys/mman.h>
|
|
#include <string.h>
|
|
#include <dirent.h>
|
|
+#include <limits.h>
|
|
|
|
#ifdef PCAP
|
|
#include "pcap_reader.h"
|
|
@@ -743,7 +744,12 @@ int main(int argc, char **argv) {
|
|
|
|
char *bindhost, *filter, *datadir, pidstr[32], *launch_process;
|
|
char *userid, *groupid, *checkptr, *listenport, *mcastgroup, *extension_tags;
|
|
-char *Ident, *dynsrcdir, pidfile[MAXPATHLEN];
|
|
+char *Ident, *dynsrcdir;
|
|
+#ifdef PATH_MAX
|
|
+char pidfile[PATH_MAX];
|
|
+#else
|
|
+char pidfile[MAXPATHLEN];
|
|
+#endif
|
|
struct stat fstat;
|
|
packet_function_t receive_packet;
|
|
send_peer_t peer;
|
|
@@ -897,18 +903,20 @@ char *pcap_file;
|
|
break;
|
|
case 'P':
|
|
if ( optarg[0] == '/' ) { // absolute path given
|
|
- strncpy(pidfile, optarg, MAXPATHLEN-1);
|
|
+ strncpy(pidfile, optarg, sizeof(pidfile));
|
|
+ pidfile[sizeof(pidfile) - 1] = 0;
|
|
} else { // path relative to current working directory
|
|
+#ifdef PATH_MAX
|
|
+ char tmp[PATH_MAX];
|
|
+#else
|
|
char tmp[MAXPATHLEN];
|
|
- if ( !getcwd(tmp, MAXPATHLEN-1) ) {
|
|
+#endif
|
|
+ if ( !getcwd(tmp, sizeof(tmp)) ) {
|
|
fprintf(stderr, "Failed to get current working directory: %s\n", strerror(errno));
|
|
exit(255);
|
|
}
|
|
- tmp[MAXPATHLEN-1] = 0;
|
|
- snprintf(pidfile, MAXPATHLEN - 1 - strlen(tmp), "%s/%s", tmp, optarg);
|
|
+ snprintf(pidfile, sizeof(pidfile), "%s/%s", tmp, optarg);
|
|
}
|
|
- // pidfile now absolute path
|
|
- pidfile[MAXPATHLEN-1] = 0;
|
|
break;
|
|
case 'R': {
|
|
char *p = strchr(optarg, '/');
|