diff --git a/caputils/ws80211_utils.c b/caputils/ws80211_utils.c index 265baa6ebe..fbd9349f6e 100644 --- a/caputils/ws80211_utils.c +++ b/caputils/ws80211_utils.c @@ -41,6 +41,8 @@ DIAG_ON_PEDANTIC #include +#include + #ifdef HAVE_NL80211_SPLIT_WIPHY_DUMP static int ws80211_get_protocol_features(int* features); #endif /* HAVE_NL80211_SPLIT_WIPHY_DUMP */ @@ -195,27 +197,6 @@ static struct ws80211_interface * return NULL; } -/* - * And now for a steaming heap of suck. - * - * The nla_for_each_nested() macro defined by at least some versions of the - * Linux kernel's headers doesn't do the casting required when compiling - * with a C++ compiler or with -Wc++-compat, so we get warnings, and those - * warnings are fatal when we compile this file. - * - * So we replace it with our own version, which does the requisite cast. - */ - -/** - * nla_for_each_nested - iterate over nested attributes - * @pos: loop counter, set to current attribute - * @nla: attribute containing the nested attributes - * @rem: initialized to len, holds bytes currently remaining in stream - */ -#undef nla_for_each_nested -#define nla_for_each_nested(pos, nla, rem) \ - nla_for_each_attr(pos, (struct nlattr *)nla_data(nla), nla_len(nla), rem) - #ifdef HAVE_NL80211_SPLIT_WIPHY_DUMP static int get_features_handler(struct nl_msg *msg, void *arg) { diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c index 6cd1ccd35f..b31a216f4f 100644 --- a/extcap/dpauxmon.c +++ b/extcap/dpauxmon.c @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index 0974866756..1980641fcd 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -45,6 +45,7 @@ set(WSUTIL_PUBLIC_HEADERS interface.h jsmn.h mpeg-audio.h + netlink.h nstime.h os_version_info.h pint.h diff --git a/wsutil/netlink.h b/wsutil/netlink.h new file mode 100644 index 0000000000..e9d32968e2 --- /dev/null +++ b/wsutil/netlink.h @@ -0,0 +1,66 @@ +/* netlink.h + * netlink-related definitions shared between libwireshark and other parts + * + * Copyright 2018, Martin Kaiser + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _WS_NETLINK_H +#define _WS_NETLINK_H + +#include "config.h" + +#if defined(HAVE_LIBNL) + +/* + * Pull in the include files where the kernel's nla_for_each_nested is defined. + * This is to make sure that the kernel's definition will not overwrite our + * version if msg.h or attr.h are included again explicitly after this file. + */ +DIAG_OFF_PEDANTIC +#include +DIAG_ON_PEDANTIC +#include + +/* + * And now for a steaming heap of suck. + * + * The nla_for_each_nested() macro defined by at least some versions of the + * Linux kernel's headers doesn't do the casting required when compiling + * with a C++ compiler or with -Wc++-compat, so we get warnings, and those + * warnings are fatal when we compile this file. + * + * So we replace it with our own version, which does the requisite cast. + */ + +/** + * nla_for_each_nested - iterate over nested attributes + * @pos: loop counter, set to current attribute + * @nla: attribute containing the nested attributes + * @rem: initialized to len, holds bytes currently remaining in stream + */ +#undef nla_for_each_nested +#define nla_for_each_nested(pos, nla, rem) \ + nla_for_each_attr(pos, (struct nlattr *)nla_data(nla), nla_len(nla), rem) + +#endif /* HAVE_LIBNL */ + +#endif /* _WS_NETLINK_H */ + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */