net: Fix -Wmissing-braces
This commit is contained in:
5 files changed
+22
-7
No files matched your search
@@ -38,6 +38,18 @@
|
|||||||
typedef u_short sa_family_t;
|
typedef u_short sa_family_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Brace style in the IN6ADDR_*_INIT macros differs across platforms.
|
||||||
|
#if defined(__illumos__)
|
||||||
|
#define COMPAT_IN6ADDR_ANY_INIT {{IN6ADDR_ANY_INIT}}
|
||||||
|
#else
|
||||||
|
#define COMPAT_IN6ADDR_ANY_INIT IN6ADDR_ANY_INIT
|
||||||
|
#endif
|
||||||
|
#if defined(__illumos__) || defined(_MSC_VER)
|
||||||
|
#define COMPAT_IN6ADDR_LOOPBACK_INIT {{IN6ADDR_LOOPBACK_INIT}}
|
||||||
|
#else
|
||||||
|
#define COMPAT_IN6ADDR_LOOPBACK_INIT IN6ADDR_LOOPBACK_INIT
|
||||||
|
#endif
|
||||||
|
|
||||||
// We map Linux / BSD error functions and codes, to the equivalent
|
// We map Linux / BSD error functions and codes, to the equivalent
|
||||||
// Windows definitions, and use the WSA* names throughout our code.
|
// Windows definitions, and use the WSA* names throughout our code.
|
||||||
// Note that glibc defines EWOULDBLOCK as EAGAIN (see errno.h).
|
// Note that glibc defines EWOULDBLOCK as EAGAIN (see errno.h).
|
||||||
|
|||||||
+1
-1
@@ -3306,7 +3306,7 @@ bool CConnman::InitBinds(const Options& options)
|
|||||||
// Don't consider errors to bind on IPv6 "::" fatal because the host OS
|
// Don't consider errors to bind on IPv6 "::" fatal because the host OS
|
||||||
// may not have IPv6 support and the user did not explicitly ask us to
|
// may not have IPv6 support and the user did not explicitly ask us to
|
||||||
// bind on that.
|
// bind on that.
|
||||||
const CService ipv6_any{in6_addr(IN6ADDR_ANY_INIT), GetListenPort()}; // ::
|
const CService ipv6_any{in6_addr(COMPAT_IN6ADDR_ANY_INIT), GetListenPort()}; // ::
|
||||||
Bind(ipv6_any, BF_NONE, NetPermissionFlags::None);
|
Bind(ipv6_any, BF_NONE, NetPermissionFlags::None);
|
||||||
|
|
||||||
struct in_addr inaddr_any;
|
struct in_addr inaddr_any;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
|
#include <compat/compat.h>
|
||||||
#include <i2p.h>
|
#include <i2p.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
@@ -34,7 +35,7 @@ FUZZ_TARGET(i2p, .init = initialize_i2p)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fs::path private_key_path = gArgs.GetDataDirNet() / "fuzzed_i2p_private_key";
|
const fs::path private_key_path = gArgs.GetDataDirNet() / "fuzzed_i2p_private_key";
|
||||||
const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), 7656};
|
const CService addr{in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT), 7656};
|
||||||
const Proxy sam_proxy{addr, /*tor_stream_isolation=*/false};
|
const Proxy sam_proxy{addr, /*tor_stream_isolation=*/false};
|
||||||
auto interrupt{ConsumeThreadInterrupt(fuzzed_data_provider)};
|
auto interrupt{ConsumeThreadInterrupt(fuzzed_data_provider)};
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
|
#include <compat/compat.h>
|
||||||
#include <i2p.h>
|
#include <i2p.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
@@ -113,7 +114,7 @@ BOOST_AUTO_TEST_CASE(listen_ok_accept_fail)
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto interrupt{std::make_shared<CThreadInterrupt>()};
|
auto interrupt{std::make_shared<CThreadInterrupt>()};
|
||||||
const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
|
const CService addr{in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
|
||||||
const Proxy sam_proxy(addr, /*tor_stream_isolation=*/false);
|
const Proxy sam_proxy(addr, /*tor_stream_isolation=*/false);
|
||||||
i2p::sam::Session session(gArgs.GetDataDirNet() / "test_i2p_private_key",
|
i2p::sam::Session session(gArgs.GetDataDirNet() / "test_i2p_private_key",
|
||||||
sam_proxy,
|
sam_proxy,
|
||||||
@@ -156,7 +157,7 @@ BOOST_AUTO_TEST_CASE(damaged_private_key)
|
|||||||
BOOST_REQUIRE(WriteBinaryFile(i2p_private_key_file, file_contents));
|
BOOST_REQUIRE(WriteBinaryFile(i2p_private_key_file, file_contents));
|
||||||
|
|
||||||
auto interrupt{std::make_shared<CThreadInterrupt>()};
|
auto interrupt{std::make_shared<CThreadInterrupt>()};
|
||||||
const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
|
const CService addr{in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
|
||||||
const Proxy sam_proxy{addr, /*tor_stream_isolation=*/false};
|
const Proxy sam_proxy{addr, /*tor_stream_isolation=*/false};
|
||||||
i2p::sam::Session session(i2p_private_key_file, sam_proxy, interrupt);
|
i2p::sam::Session session(i2p_private_key_file, sam_proxy, interrupt);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <compat/compat.h>
|
||||||
#include <net_permissions.h>
|
#include <net_permissions.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
@@ -502,17 +503,17 @@ BOOST_AUTO_TEST_CASE(netbase_dont_resolve_strings_with_embedded_nul_characters)
|
|||||||
|
|
||||||
static const std::vector<CAddress> fixture_addresses({
|
static const std::vector<CAddress> fixture_addresses({
|
||||||
CAddress{
|
CAddress{
|
||||||
CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0 /* port */),
|
CService(CNetAddr(in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT)), 0 /* port */),
|
||||||
NODE_NONE,
|
NODE_NONE,
|
||||||
NodeSeconds{0x4966bc61s}, /* Fri Jan 9 02:54:25 UTC 2009 */
|
NodeSeconds{0x4966bc61s}, /* Fri Jan 9 02:54:25 UTC 2009 */
|
||||||
},
|
},
|
||||||
CAddress{
|
CAddress{
|
||||||
CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1 /* port */),
|
CService(CNetAddr(in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT)), 0x00f1 /* port */),
|
||||||
NODE_NETWORK,
|
NODE_NETWORK,
|
||||||
NodeSeconds{0x83766279s}, /* Tue Nov 22 11:22:33 UTC 2039 */
|
NodeSeconds{0x83766279s}, /* Tue Nov 22 11:22:33 UTC 2039 */
|
||||||
},
|
},
|
||||||
CAddress{
|
CAddress{
|
||||||
CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2 /* port */),
|
CService(CNetAddr(in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT)), 0xf1f2 /* port */),
|
||||||
static_cast<ServiceFlags>(NODE_WITNESS | NODE_COMPACT_FILTERS | NODE_NETWORK_LIMITED),
|
static_cast<ServiceFlags>(NODE_WITNESS | NODE_COMPACT_FILTERS | NODE_NETWORK_LIMITED),
|
||||||
NodeSeconds{0xffffffffs}, /* Sun Feb 7 06:28:15 UTC 2106 */
|
NodeSeconds{0xffffffffs}, /* Sun Feb 7 06:28:15 UTC 2106 */
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user