Skip to content

Commit a5a046b

Browse files
authored
Merge pull request #141 from farsightsec/next
Release 1.2.0
2 parents 007535e + b5aa654 commit a5a046b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2561
-181
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ test-suite.log
5959
tests/test-io
6060
tests/test-misc
6161
tests/test-parse
62+
tests/test-private
63+
tests/*/*.out
64+
tests/*/test.sh

COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Most nmsg code is under the following copyright and license:
22

3-
Copyright (c) 2023 DomainTools LLC
3+
Copyright (c) 2023-2024 DomainTools LLC
44
Copyright (c) 2008-2021 by Farsight Security, Inc.
55

66
Licensed under the Apache License, Version 2.0 (the "License");

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
nmsg (1.2.0)
2+
3+
* Add support for Kafka i/o in JSON and binary forms.
4+
5+
* Add support for prometheus metrics export.
6+
7+
* Replace mutex protected counters and flags with stdatomic operations.
8+
9+
* New command line options: --kafkakey, --readkafka, --writekafka, --promport
10+
11+
* New functions: nmsg_input_open_kafka_endpoint(), nmsg_input_open_kafka_json(),
12+
nmsg_output_open_kafka_endpoint(), nmsg_output_open_kafka_json()
13+
114
nmsg (1.1.2)
215

316
* Now allow nmsgtool --setgroup, --setoperator, and --setsource to

Makefile.am

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ AM_CFLAGS = \
1818
$(libprotobuf_c_CFLAGS) \
1919
$(libwdns_CFLAGS) \
2020
$(libzmq_CFLAGS) \
21-
$(json_c_CFLAGS)
21+
$(librdkafka_CFLAGS) \
22+
$(json_c_CFLAGS) \
23+
$(libmicrohttpd_CFLAGS) \
24+
$(libprom_CFLAGS)
2225
AM_LDFLAGS =
2326

2427
EXTRA_DIST += ChangeLog
@@ -51,6 +54,7 @@ EXTRA_DIST += \
5154
tests/test-layout-fltmod_plugin.c \
5255
tests/test-nmsg_output_set_rate.c \
5356
tests/test-parse.c \
57+
tests/test-private.c \
5458
tests/test-io.c \
5559
tests/test-misc.c \
5660
tests/udp-checksum-tests/test.sh.in \
@@ -121,26 +125,25 @@ nobase_nodist_include_HEADERS = \
121125

122126
lib_LTLIBRARIES = nmsg/libnmsg.la
123127

124-
VERSION_INFO = 9:1:1
128+
VERSION_INFO = 10:0:2
125129

126130
nmsg_libnmsg_la_LDFLAGS = \
127131
$(AM_LDFLAGS) \
128132
-version-info $(VERSION_INFO) \
129133
-export-symbols-regex "^(nmsg_[a-z].*)"
130-
nmsg_libnmsg_la_LIBADD = \
134+
LIBNMSG_LIB_DEPS = \
131135
$(libpcap_LIBS) \
132136
$(libprotobuf_c_LIBS) \
133137
$(libzmq_LIBS) \
138+
$(librdkafka_LIBS) \
134139
$(json_c_LIBS)
135-
nmsg_libnmsg_la_SOURCES = \
136-
libmy/crc32c.c libmy/crc32c.h libmy/crc32c-slicing.c libmy/crc32c-sse42.c \
137-
libmy/list.h \
138-
libmy/my_time.h \
139-
libmy/my_rate.c libmy/my_rate.h \
140-
libmy/tree.h \
141-
libmy/b64_decode.c libmy/b64_decode.h \
142-
libmy/b64_encode.c libmy/b64_encode.h \
143-
libmy/fast_inet_ntop.c libmy/fast_inet_ntop.h \
140+
nmsg_libnmsg_la_LIBADD = $(LIBNMSG_LIB_DEPS)
141+
LIBNMSG_LIB_MODULES = \
142+
libmy/crc32c.c libmy/crc32c-slicing.c libmy/crc32c-sse42.c \
143+
libmy/my_rate.c \
144+
libmy/b64_decode.c \
145+
libmy/b64_encode.c \
146+
libmy/fast_inet_ntop.c \
144147
nmsg/alias.c \
145148
nmsg/asprintf.c \
146149
nmsg/brate.c \
@@ -161,37 +164,50 @@ nmsg_libnmsg_la_SOURCES = \
161164
nmsg/io.c \
162165
nmsg/ipdg.c \
163166
nmsg/ipreasm.c \
164-
nmsg/ipreasm.h \
165167
nmsg/msgmodset.c \
166168
nmsg/nmsg.c \
167-
nmsg/nmsg_json.h \
168-
nmsg/nmsg_port_net.h \
169169
nmsg/output.c \
170170
nmsg/output_json.c \
171171
nmsg/output_nmsg.c \
172172
nmsg/output_pres.c \
173173
nmsg/payload.c \
174174
nmsg/pcap_input.c \
175-
nmsg/private.h \
176175
nmsg/random.c \
177176
nmsg/rate.c \
178177
nmsg/res.c \
179178
nmsg/sock.c \
180179
nmsg/strbuf.c \
181180
nmsg/timespec.c \
182-
nmsg/version.c nmsg/version.h \
181+
nmsg/version.c \
183182
nmsg/zmqio.c \
183+
nmsg/kafkaio.c \
184184
nmsg/zbuf.c \
185185
nmsg/msgmod/lookup.c \
186186
nmsg/msgmod/message.c \
187187
nmsg/msgmod/msgmod.c \
188188
nmsg/msgmod/transparent.c \
189-
nmsg/msgmod/transparent.h \
190189
nmsg/msgmod/transparent_json.c \
191190
nmsg/msgmod/transparent_message.c \
192191
nmsg/msgmod/transparent_module.c \
193192
nmsg/msgmod/transparent_payload.c \
194193
nmsg/msgmod/transparent_pres.c
194+
nmsg_libnmsg_la_SOURCES = \
195+
libmy/crc32c.h \
196+
libmy/list.h \
197+
libmy/my_time.h \
198+
libmy/my_rate.h \
199+
libmy/tree.h \
200+
libmy/b64_decode.h \
201+
libmy/b64_encode.h \
202+
libmy/fast_inet_ntop.h \
203+
nmsg/ipreasm.h \
204+
nmsg/nmsg_json.h \
205+
nmsg/nmsg_port_net.h \
206+
nmsg/private.h \
207+
nmsg/version.h \
208+
nmsg/kafkaio.h \
209+
nmsg/msgmod/transparent.h \
210+
$(LIBNMSG_LIB_MODULES)
195211
nodist_nmsg_libnmsg_la_SOURCES = \
196212
nmsg/nmsg.pb-c.c \
197213
nmsg/nmsg.pb-c.h
@@ -330,7 +346,10 @@ bin_PROGRAMS += src/nmsgtool
330346
src_nmsgtool_LDADD = \
331347
nmsg/libnmsg.la \
332348
$(libpcap_LIBS) \
333-
$(libzmq_LIBS)
349+
$(libzmq_LIBS) \
350+
$(librdkafka_LIBS) \
351+
$(libmicrohttpd_LIBS) \
352+
$(libprom_LIBS)
334353
src_nmsgtool_SOURCES = \
335354
libmy/argv.c \
336355
libmy/argv.h \
@@ -346,6 +365,10 @@ src_nmsgtool_SOURCES = \
346365
src/rwfile.c \
347366
src/unescape.c
348367

368+
if USE_DT_PROM
369+
src_nmsgtool_SOURCES += src/dt_prom.c \
370+
src/dt_prom.h
371+
endif
349372
#
350373
##
351374
### Tests
@@ -428,10 +451,20 @@ check_PROGRAMS += tests/test-parse
428451
tests_test_parse_LDADD = nmsg/libnmsg.la
429452
tests_test_parse_SOURCES = tests/test-parse.c
430453

454+
TESTS += tests/test-private
455+
check_PROGRAMS += tests/test-private
456+
tests_test_private_LDFLAGS = -rdynamic
457+
PRIVATE_TEST_MODULES = $(LIBNMSG_LIB_MODULES:.c=.o)
458+
tests_test_private_LDADD = \
459+
$(PRIVATE_TEST_MODULES) \
460+
nmsg/nmsg.pb-c.o \
461+
$(LIBNMSG_LIB_DEPS)
462+
tests_test_private_SOURCES = tests/test-private.c
463+
431464
TESTS += tests/test-io
432465
check_PROGRAMS += tests/test-io
433466
tests_test_io_CPPFLAGS = -DSRCDIR="\"$(abs_srcdir)\"" $(AM_CPPFLAGS)
434-
tests_test_io_LDADD = nmsg/libnmsg.la $(libzmq_LIBS)
467+
tests_test_io_LDADD = nmsg/libnmsg.la $(libzmq_LIBS) $(librdkafka_LIBS)
435468
tests_test_io_SOURCES = tests/test-io.c
436469

437470
TESTS += tests/test-misc
@@ -473,14 +506,10 @@ examples_nmsg_callback_SOURCES = examples/nmsg_callback.c
473506
examples_print_srcip_LDADD = nmsg/libnmsg.la
474507
examples_print_srcip_SOURCES = examples/print_srcip.c
475508

476-
examples_nmsg_dnsqr2pcap_LDADD = \
477-
nmsg/libnmsg.la \
478-
$(libpcap_LIBS)
509+
examples_nmsg_dnsqr2pcap_LDADD = nmsg/libnmsg.la $(libpcap_LIBS)
479510
examples_nmsg_dnsqr2pcap_SOURCES = examples/nmsg-dnsqr2pcap.c
480511

481-
examples_nmsg_packet2pcap_LDADD = \
482-
nmsg/libnmsg.la \
483-
$(libpcap_LIBS)
512+
examples_nmsg_packet2pcap_LDADD = nmsg/libnmsg.la $(libpcap_LIBS)
484513
examples_nmsg_packet2pcap_SOURCES = examples/nmsg-packet2pcap.c
485514

486515
examples_print_version_LDADD = nmsg/libnmsg.la

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@ nmsg has the following external dependencies:
1919

2020
* [zmq](http://zeromq.org/)
2121

22+
* [rdkafka](https://github.com/confluentinc/librdkafka)
23+
2224
* [json-c](https://github.com/json-c/json-c)
2325

2426
* [zlib](http://www.zlib.net/)
2527

28+
* prometheus integration (optional)
29+
* [libprometheus](https://github.com/digitalocean/prometheus-client-c)
30+
* [libmicrohttpd](https://www.gnu.org/software/libmicrohttpd/)
31+
2632
On Debian systems, the following packages should be installed, if available:
2733

28-
pkg-config libpcap0.8-dev libprotobuf-c-dev protobuf-c-compiler libzmq3-dev libjson-c-dev zlib1g-dev
34+
pkg-config libpcap0.8-dev libprotobuf-c-dev protobuf-c-compiler libzmq3-dev librdkafka-dev libjson-c-dev zlib1g-dev
2935

3036
Note that on Debian systems, binary packages of nmsg and its dependencies are
3137
available from
@@ -35,7 +41,8 @@ Debian-based systems.
3541

3642
On FreeBSD systems, the following ports should be installed, if available:
3743

38-
devel/libzmq
44+
net/libzmq3
45+
net/librdkafka
3946
devel/json-c
4047
devel/pkgconf
4148
devel/protobuf
@@ -54,6 +61,9 @@ script.
5461
Support for `libzmq` can be disabled by passing the `--without-libzmq` parameter
5562
to the `configure` script.
5663

64+
Support for `librdkafka` can be disabled by passing the `--without-librdkafka` parameter
65+
to the `configure` script.
66+
5767
Support for `json-c` can be disabled by passing the `--without-json-c` parameter
5868
to the `configure` script.
5969

configure.ac

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
AC_PREREQ(2.64)
22

33
m4_define(nmsg_major_version, 1)
4-
m4_define(nmsg_minor_version, 1)
5-
m4_define(nmsg_patchlevel_version, 2)
4+
m4_define(nmsg_minor_version, 2)
5+
m4_define(nmsg_patchlevel_version, 0)
66
m4_define(nmsg_version,
77
nmsg_major_version.nmsg_minor_version.nmsg_patchlevel_version)
88
m4_define(nmsg_version_number,
@@ -51,6 +51,7 @@ AC_CONFIG_FILES([tests/nmsg-dns-tests/test.sh],
5151
AC_CONFIG_FILES([tests/nmsg-dnsobs-tests/test.sh],
5252
[chmod +x tests/nmsg-dnsobs-tests/test.sh])
5353

54+
AC_SUBST(shlibpath_var)
5455
AC_CONFIG_FILES([tests/nmsg-dnsqr-tests/test.sh],
5556
[chmod +x tests/nmsg-dnsqr-tests/test.sh])
5657

@@ -149,6 +150,15 @@ AS_IF([test -z "$PROTOC_C"],
149150

150151
PKG_CHECK_MODULES([libwdns], [libwdns >= 0.12.0])
151152

153+
AC_ARG_WITH([librdkafka], AS_HELP_STRING([--without-librdkafka], [Disable kafka support]))
154+
if test "x$with_librdkafka" != "xno"; then
155+
PKG_CHECK_MODULES([librdkafka], [rdkafka >= 1.1.0])
156+
AC_DEFINE([HAVE_LIBRDKAFKA], [1], [Define to 1 if librdkafka support is enabled.])
157+
use_librdkafka="true"
158+
else
159+
use_librdkafka="false"
160+
fi
161+
152162
AC_ARG_WITH([libzmq], AS_HELP_STRING([--without-libzmq], [Disable zmq support]))
153163
if test "x$with_libzmq" != "xno"; then
154164
PKG_CHECK_MODULES([libzmq], [libzmq >= 4.2.0])
@@ -167,6 +177,18 @@ else
167177
use_json_c="false"
168178
fi
169179

180+
AC_ARG_WITH([prometheus], AS_HELP_STRING([--with-prometheus], [Enable prometheus metrics]))
181+
if test "x$with_prometheus" == "xyes"; then
182+
PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd >= 0.9.0])
183+
PKG_CHECK_MODULES([libprom], [libprom >= 0.1.0])
184+
AC_DEFINE([HAVE_PROMETHEUS], [1], [Define to 1 if prometheus metrics are enabled.])
185+
USE_PROMETHEUS="yes"
186+
AM_CONDITIONAL([USE_DT_PROM], [true])
187+
else
188+
USE_PROMETHEUS="no"
189+
AM_CONDITIONAL([USE_DT_PROM], [false])
190+
fi
191+
170192
AC_CHECK_HEADER([zlib.h], [], [ AC_MSG_ERROR([required header file not found]) ])
171193
AC_CHECK_LIB([z], [deflate], [], [ AC_MSG_ERROR([required library not found]) ])
172194

@@ -226,7 +248,9 @@ AC_MSG_RESULT([
226248
227249
bigendian: ${ac_cv_c_bigendian}
228250
libzmq support: ${use_libzmq}
251+
librdkafka support: ${use_librdkafka}
229252
json-c support: ${use_json_c}
253+
prometheus support: ${USE_PROMETHEUS}
230254
231255
building html docs: ${DOC_HTML_MSG}
232256
building manpage docs: ${DOC_MAN_MSG}

debian/changelog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
nmsg (1.2.0-1) debian-fsi; urgency=medium
2+
3+
* Add support for Kafka i/o in JSON and binary forms.
4+
* Add support for prometheus metrics export.
5+
* Replace mutex protected counters and flags with stdatomic operations.
6+
* New command line options: --kafkakey, --readkafka, --writekafka, --promport
7+
* New functions: nmsg_input_open_kafka_endpoint(), nmsg_input_open_kafka_json(),
8+
nmsg_output_open_kafka_endpoint(), nmsg_output_open_kafka_json()
9+
10+
-- Farsight Security Inc <[email protected]> Wed, 26 Jun 2024 13:56:58 -0400
11+
112
nmsg (1.1.2-1) debian-fsi; urgency=medium
213

314
* Now allow nmsgtool --setgroup, --setoperator, and --setsource to

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Build-Depends:
1313
libprotobuf-c-dev (>= 1.0.1~),
1414
libwdns-dev (>= 0.12.0~),
1515
libzmq3-dev (>= 4.2.0~),
16+
librdkafka-dev (>= 1.1.0~),
1617
libjson-c-dev (>= 0.13.0~),
1718
pkg-config,
1819
protobuf-c-compiler (>= 1.0.1~),

debian/copyright

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
22

33
Files: *
4-
Copyright: 2023 DomainTools LLC
4+
Copyright: 2023-2024 DomainTools LLC
55
2008-2021 by Farsight Security, Inc.
66
License: Apache-2.0
77
Licensed under the Apache License, Version 2.0 (the "License"); you

debian/libnmsg8.symbols

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ libnmsg.so.8 libnmsg8 #MINVER#
2828
nmsg_input_open_callback@Base 0.7.0
2929
nmsg_input_open_file@Base 0.5.0
3030
nmsg_input_open_json@Base 0.10.0
31+
nmsg_input_open_kafka_endpoint@Base 1.2.0
32+
nmsg_input_open_kafka_json@Base 1.2.0
3133
nmsg_input_open_null@Base 0.7.0
3234
nmsg_input_open_pcap@Base 0.5.0
3335
nmsg_input_open_pres@Base 0.5.0
@@ -130,6 +132,8 @@ libnmsg.so.8 libnmsg8 #MINVER#
130132
nmsg_output_open_callback@Base 0.5.0
131133
nmsg_output_open_file@Base 0.5.0
132134
nmsg_output_open_json@Base 0.10.0
135+
nmsg_output_open_kafka_endpoint@Base 1.2.0
136+
nmsg_output_open_kafka_json@Base 1.2.0
133137
nmsg_output_open_pres@Base 0.11.1
134138
nmsg_output_open_sock@Base 0.5.0
135139
nmsg_output_open_zmq@Base 0.14.0

0 commit comments

Comments
 (0)