for at least an hour without crashing and burning which is a big improvement over the last version.
45 lines
1.9 KiB
Plaintext
45 lines
1.9 KiB
Plaintext
$OpenBSD: patch-src_LuaEngine_cpp,v 1.2 2019/01/07 18:37:22 sthen Exp $
|
|
|
|
Index: src/LuaEngine.cpp
|
|
--- src/LuaEngine.cpp.orig
|
|
+++ src/LuaEngine.cpp
|
|
@@ -2445,7 +2445,7 @@ static int ntop_append_influx_db(lua_State* vm) {
|
|
buflen = concat_table_fields(vm, 3, data + sizeof(data) - buflen, buflen);
|
|
buflen -= snprintf(data + sizeof(data) - buflen, buflen, " ");
|
|
buflen = concat_table_fields(vm, 4, data + sizeof(data) - buflen, buflen);
|
|
- buflen -= snprintf(data + sizeof(data) - buflen, buflen, " %lu000000000\n", tstamp);
|
|
+ buflen -= snprintf(data + sizeof(data) - buflen, buflen, " %llu000000000\n", (long long)tstamp);
|
|
|
|
if(ntop_interface && ntop_interface->getTSExporter()) {
|
|
ntop_interface->getTSExporter()->exportData(data);
|
|
@@ -3642,16 +3642,20 @@ static int ntop_interface_live_capture(lua_State* vm)
|
|
c->live_capture.bpfFilterSet = false;
|
|
|
|
if(bpf && (bpf[0] != '\0')) {
|
|
+#ifndef __OpenBSD__ /* needs non-ancient libpcap */
|
|
if(pcap_compile_nopcap(65535, /* snaplen */
|
|
iface->get_datalink(), /* linktype */
|
|
&c->live_capture.fcode, /* program */
|
|
bpf, /* const char *buf */
|
|
0, /* optimize */
|
|
PCAP_NETMASK_UNKNOWN) == -1)
|
|
+#endif
|
|
ntop->getTrace()->traceEvent(TRACE_WARNING,
|
|
"Unable to set capturefilter %s. Filter ignored.", bpf);
|
|
+#ifndef __OpenBSD__ /* ... */
|
|
else
|
|
c->live_capture.bpfFilterSet = true;
|
|
+#endif
|
|
}
|
|
|
|
if(ntop_interface->registerLiveCapture(c, &capture_id)) {
|
|
@@ -6103,7 +6107,7 @@ static int ntop_generate_csrf_value(lua_State* vm) {
|
|
|
|
#ifdef __OpenBSD__
|
|
snprintf(random_a, sizeof(random_a), "%d", arc4random());
|
|
- snprintf(random_b, sizeof(random_b), "%lu", time(NULL)*arc4random());
|
|
+ snprintf(random_b, sizeof(random_b), "%llu", time(NULL)*arc4random());
|
|
#else
|
|
snprintf(random_a, sizeof(random_a), "%d", rand());
|
|
snprintf(random_b, sizeof(random_b), "%lu", time(NULL)*rand());
|