Skip to content

Commit eafb097

Browse files
committed
FDS input: replace IN6_IS_ADDR_V4MAPPED macro with own function as it does not exist on BSD
1 parent 4672ba6 commit eafb097

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/plugins/input/fds/Reader.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@
4747
#include "Exception.hpp"
4848
#include "Reader.hpp"
4949

50+
static inline bool in6_is_addr_v4mapped(const uint8_t addr[16])
51+
{
52+
return
53+
addr[0] == 0 &&
54+
addr[1] == 0 &&
55+
addr[2] == 0 &&
56+
addr[3] == 0 &&
57+
addr[4] == 0 &&
58+
addr[5] == 0 &&
59+
addr[6] == 0 &&
60+
addr[7] == 0 &&
61+
addr[8] == 0 &&
62+
addr[9] == 0 &&
63+
addr[10] == 0xFF &&
64+
addr[11] == 0xFF;
65+
}
5066

5167
Reader::Reader(ipx_ctx_t *ctx, const fds_config *cfg, const char *path)
5268
: m_ctx(ctx), m_cfg(cfg)
@@ -97,7 +113,7 @@ Reader::session_from_sid(fds_file_sid_t sid)
97113
memset(&session_net, 0, sizeof(session_net));
98114
session_net.port_src = desc->port_src;
99115
session_net.port_dst = desc->port_dst;
100-
if (IN6_IS_ADDR_V4MAPPED(desc->ip_src) && IN6_IS_ADDR_V4MAPPED(desc->ip_dst)) {
116+
if (in6_is_addr_v4mapped(desc->ip_src) && in6_is_addr_v4mapped(desc->ip_dst)) {
101117
session_net.l3_proto = AF_INET;
102118
session_net.addr_src.ipv4 = *reinterpret_cast<const struct in_addr *>(&desc->ip_src[12]);
103119
session_net.addr_dst.ipv4 = *reinterpret_cast<const struct in_addr *>(&desc->ip_dst[12]);

0 commit comments

Comments
 (0)