aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/depends/Makefile2
-rw-r--r--contrib/depends/funcs.mk8
-rw-r--r--contrib/depends/packages/eudev.mk4
-rw-r--r--contrib/depends/packages/expat.mk6
-rw-r--r--contrib/depends/packages/hidapi.mk11
-rw-r--r--contrib/depends/packages/icu4c.mk5
-rw-r--r--contrib/depends/packages/ldns.mk6
-rw-r--r--contrib/depends/packages/libiconv.mk4
-rw-r--r--contrib/depends/packages/ncurses.mk58
-rw-r--r--contrib/depends/packages/openssl.mk4
-rw-r--r--contrib/depends/packages/packages.mk10
-rw-r--r--contrib/depends/packages/protobuf.mk4
-rw-r--r--contrib/depends/packages/readline.mk12
-rw-r--r--contrib/depends/packages/sodium-darwin.mk5
-rw-r--r--contrib/depends/packages/sodium.mk5
-rw-r--r--contrib/depends/packages/unwind.mk2
-rw-r--r--contrib/depends/packages/zeromq.mk4
-rw-r--r--contrib/depends/toolchain.cmake.in3
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.h2
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl21
-rw-r--r--contrib/epee/include/net/connection_basic.hpp2
-rw-r--r--contrib/epee/include/net/net_helper.h10
-rw-r--r--contrib/epee/include/net/net_utils_base.h56
-rw-r--r--contrib/epee/include/storages/portable_storage_from_bin.h1
-rw-r--r--contrib/epee/src/buffer.cpp3
-rw-r--r--contrib/epee/src/connection_basic.cpp3
-rw-r--r--contrib/epee/src/net_utils_base.cpp18
-rw-r--r--contrib/epee/src/wipeable_string.cpp17
-rw-r--r--contrib/gitian/gitian-linux.yml3
-rw-r--r--contrib/gitian/gitian-osx.yml3
-rw-r--r--contrib/gitian/gitian-win.yml3
-rw-r--r--contrib/rlwrap/monerocommands_bitmonerod.txt2
32 files changed, 237 insertions, 60 deletions
diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile
index 6ab602ac0..ec0e4cfae 100644
--- a/contrib/depends/Makefile
+++ b/contrib/depends/Makefile
@@ -217,4 +217,6 @@ download-win:
@$(MAKE) -s HOST=x86_64-w64-mingw32 download-one
download: download-osx download-linux download-win
+ $(foreach package,$(all_packages),$(eval $(call ext_add_stages,$(package))))
+
.PHONY: install cached download-one download-osx download-linux download-win download check-packages check-sources
diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk
index 15e404e42..469144361 100644
--- a/contrib/depends/funcs.mk
+++ b/contrib/depends/funcs.mk
@@ -213,6 +213,14 @@ $(1): | $($(1)_cached_checksum)
endef
+stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum
+
+define ext_add_stages
+$(foreach stage,$(stages),
+ $(1)_$(stage): $($(1)_$(stage))
+ .PHONY: $(1)_$(stage))
+endef
+
# These functions create the build targets for each package. They must be
# broken down into small steps so that each part is done for all packages
# before moving on to the next step. Otherwise, a package's info
diff --git a/contrib/depends/packages/eudev.mk b/contrib/depends/packages/eudev.mk
index e754c0f20..a7795b777 100644
--- a/contrib/depends/packages/eudev.mk
+++ b/contrib/depends/packages/eudev.mk
@@ -23,3 +23,7 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
diff --git a/contrib/depends/packages/expat.mk b/contrib/depends/packages/expat.mk
index bd2cea1b6..ef81636a2 100644
--- a/contrib/depends/packages/expat.mk
+++ b/contrib/depends/packages/expat.mk
@@ -6,6 +6,7 @@ $(package)_sha256_hash=03ad85db965f8ab2d27328abcf0bc5571af6ec0a414874b2066ee3fdd
define $(package)_set_vars
$(package)_config_opts=--enable-static
+$(package)_config_opts=--disable-shared
$(package)_config_opts+=--prefix=$(host_prefix)
endef
@@ -20,3 +21,8 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
+
diff --git a/contrib/depends/packages/hidapi.mk b/contrib/depends/packages/hidapi.mk
index 1c43e525a..a27df04fa 100644
--- a/contrib/depends/packages/hidapi.mk
+++ b/contrib/depends/packages/hidapi.mk
@@ -1,8 +1,8 @@
package=hidapi
-$(package)_version=0.8.0-rc1
-$(package)_download_path=https://github.com/signal11/hidapi/archive
+$(package)_version=0.9.0
+$(package)_download_path=https://github.com/libusb/hidapi/archive
$(package)_file_name=$(package)-$($(package)_version).tar.gz
-$(package)_sha256_hash=3c147200bf48a04c1e927cd81589c5ddceff61e6dac137a605f6ac9793f4af61
+$(package)_sha256_hash=630ee1834bdd5c5761ab079fd04f463a89585df8fcae51a7bfe4229b1e02a652
$(package)_linux_dependencies=libusb eudev
define $(package)_set_vars
@@ -28,3 +28,8 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
+
diff --git a/contrib/depends/packages/icu4c.mk b/contrib/depends/packages/icu4c.mk
index 2b3845488..dc089bbbe 100644
--- a/contrib/depends/packages/icu4c.mk
+++ b/contrib/depends/packages/icu4c.mk
@@ -21,11 +21,6 @@ define $(package)_config_cmds
$(MAKE) $($(package)_build_opts)
endef
-#define $(package)_build_cmds
-# cd source &&\
- $(MAKE) $($((package)_build_opts) `nproc`
-#endef
-
define $(package)_stage_cmds
cd buildb &&\
$(MAKE) $($(package)_build_opts) DESTDIR=$($(package)_staging_dir) install lib/*
diff --git a/contrib/depends/packages/ldns.mk b/contrib/depends/packages/ldns.mk
index 0b7c3806a..ea4902170 100644
--- a/contrib/depends/packages/ldns.mk
+++ b/contrib/depends/packages/ldns.mk
@@ -6,8 +6,8 @@ $(package)_sha256_hash=8b88e059452118e8949a2752a55ce59bc71fa5bc414103e17f5b6b06f
$(package)_dependencies=openssl
define $(package)_set_vars
- $(package)_config_opts=--disable-shared --enable-static --disable-dane-ta-usage --with-drill
- $(package)_config_opts=--with-ssl=$(host_prefix)
+ $(package)_config_opts=--disable-shared --enable-static --with-drill
+ $(package)_config_opts+=--with-ssl=$(host_prefix)
$(package)_config_opts_release=--disable-debug-mode
$(package)_config_opts_linux=--with-pic
endef
@@ -25,4 +25,6 @@ define $(package)_stage_cmds
endef
define $(package)_postprocess_cmds
+ rm lib/*.la
endef
+
diff --git a/contrib/depends/packages/libiconv.mk b/contrib/depends/packages/libiconv.mk
index dbcb28141..d4995c1b7 100644
--- a/contrib/depends/packages/libiconv.mk
+++ b/contrib/depends/packages/libiconv.mk
@@ -28,3 +28,7 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
diff --git a/contrib/depends/packages/ncurses.mk b/contrib/depends/packages/ncurses.mk
new file mode 100644
index 000000000..4e06c00d9
--- /dev/null
+++ b/contrib/depends/packages/ncurses.mk
@@ -0,0 +1,58 @@
+package=ncurses
+$(package)_version=6.1
+$(package)_download_path=https://ftp.gnu.org/gnu/ncurses
+$(package)_file_name=$(package)-$($(package)_version).tar.gz
+$(package)_sha256_hash=aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17
+
+define $(package)_set_vars
+ $(package)_build_opts=CC="$($(package)_cc)"
+ $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
+ $(package)_config_env_darwin=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)"
+ $(package)_config_opts=--prefix=$(host_prefix)
+ $(package)_config_opts+=--disable-shared
+ $(package)_config_opts+=--with-build-cc=gcc
+ $(package)_config_opts+=--without-debug
+ $(package)_config_opts+=--without-ada
+ $(package)_config_opts+=--without-cxx-binding
+ $(package)_config_opts+=--without-cxx
+ $(package)_config_opts+=--without-ticlib
+ $(package)_config_opts+=--without-tic
+ $(package)_config_opts+=--without-progs
+ $(package)_config_opts+=--without-tests
+ $(package)_config_opts+=--without-tack
+ $(package)_config_opts+=--without-manpages
+ $(package)_config_opts+=--disable-tic-depends
+ $(package)_config_opts+=--disable-big-strings
+ $(package)_config_opts+=--disable-ext-colors
+ $(package)_config_opts+=--enable-pc-files
+ $(package)_config_opts+=--host=$(HOST)
+ $(pacakge)_config_opts+=--without-shared
+ $(pacakge)_config_opts+=--without-pthread
+ $(pacakge)_config_opts+=--disable-rpath
+ $(pacakge)_config_opts+=--disable-colorfgbg
+ $(pacakge)_config_opts+=--disable-ext-colors
+ $(pacakge)_config_opts+=--disable-ext-mouse
+ $(pacakge)_config_opts+=--disable-symlinks
+ $(pacakge)_config_opts+=--enable-warnings
+ $(pacakge)_config_opts+=--enable-assertions
+ $(pacakge)_config_opts+=--disable-home-terminfo
+ $(pacakge)_config_opts+=--enable-database
+ $(pacakge)_config_opts+=--enable-sp-funcs
+ $(pacakge)_config_opts+=--enable-term-driver
+ $(pacakge)_config_opts+=--enable-interop
+ $(pacakge)_config_opts+=--enable-widec
+ $(package)_build_opts=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC"
+endef
+
+define $(package)_config_cmds
+ ./configure $($(package)_config_opts)
+endef
+
+define $(package)_build_cmds
+ $(MAKE) $($(package)_build_opts) V=1
+endef
+
+define $(package)_stage_cmds
+ $(MAKE) install DESTDIR=$($(package)_staging_dir)
+endef
+
diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk
index e920b4409..e39dc1d04 100644
--- a/contrib/depends/packages/openssl.mk
+++ b/contrib/depends/packages/openssl.mk
@@ -1,8 +1,8 @@
package=openssl
-$(package)_version=1.0.2q
+$(package)_version=1.0.2r
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
-$(package)_sha256_hash=5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684
+$(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk
index a38819337..562f4f7d6 100644
--- a/contrib/depends/packages/packages.mk
+++ b/contrib/depends/packages/packages.mk
@@ -1,20 +1,16 @@
-packages:=boost openssl zeromq cppzmq expat ldns cppzmq readline libiconv hidapi protobuf libusb
+packages:=boost openssl zeromq cppzmq expat ldns libiconv hidapi protobuf libusb
native_packages := native_ccache native_protobuf
darwin_native_packages = native_biplist native_ds_store native_mac_alias
-darwin_packages = sodium-darwin
+darwin_packages = sodium-darwin ncurses readline
-linux_packages = eudev
+linux_packages = eudev ncurses readline unwind sodium
qt_packages = qt
ifeq ($(build_tests),ON)
packages += gtest
endif
-ifeq ($(host_os),linux)
-packages += unwind
-packages += sodium
-endif
ifeq ($(host_os),mingw32)
packages += icu4c
packages += sodium
diff --git a/contrib/depends/packages/protobuf.mk b/contrib/depends/packages/protobuf.mk
index 54d3fd924..81fa78a3f 100644
--- a/contrib/depends/packages/protobuf.mk
+++ b/contrib/depends/packages/protobuf.mk
@@ -25,5 +25,7 @@ define $(package)_stage_cmds
endef
define $(package)_postprocess_cmds
- rm lib/libprotoc.a
+ rm lib/libprotoc.a &&\
+ rm lib/*.la
endef
+
diff --git a/contrib/depends/packages/readline.mk b/contrib/depends/packages/readline.mk
index afefc7f07..0e2100749 100644
--- a/contrib/depends/packages/readline.mk
+++ b/contrib/depends/packages/readline.mk
@@ -3,19 +3,19 @@ $(package)_version=8.0
$(package)_download_path=https://ftp.gnu.org/gnu/readline
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461
+$(package)_dependencies=ncurses
define $(package)_set_vars
- $(package)_build_opts=CC="$($(package)_cc)"
- $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_opts=--prefix=$(host_prefix)
- $(package)_config_opts+=--disable-shared --enable-multibye --without-purify --without-curses
+ $(package)_config_opts+=--exec-prefix=$(host_prefix)
+ $(package)_config_opts+=--host=$(HOST)
+ $(package)_config_opts+=--disable-shared --with-curses
$(package)_config_opts_release=--disable-debug-mode
+ $(package)_config_opts_darwin+=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)"
$(package)_build_opts=CFLAGS="$($(package)_cflags) $($(package)_cppflags) -fPIC"
endef
define $(package)_config_cmds
- export bash_cv_have_mbstate_t=yes &&\
- export bash_cv_wcwidth_broken=yes &&\
./configure $($(package)_config_opts)
endef
@@ -24,6 +24,6 @@ define $(package)_build_cmds
endef
define $(package)_stage_cmds
- $(MAKE) DESTDIR=$($(package)_staging_dir) install
+ $(MAKE) install DESTDIR=$($(package)_staging_dir) prefix=$(host_prefix) exec-prefix=$(host_prefix)
endef
diff --git a/contrib/depends/packages/sodium-darwin.mk b/contrib/depends/packages/sodium-darwin.mk
index 8b6ee3f1d..9f11a9426 100644
--- a/contrib/depends/packages/sodium-darwin.mk
+++ b/contrib/depends/packages/sodium-darwin.mk
@@ -23,3 +23,8 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
+
diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk
index 06aa8f874..b71f4383e 100644
--- a/contrib/depends/packages/sodium.mk
+++ b/contrib/depends/packages/sodium.mk
@@ -23,3 +23,8 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
+
+define $(package)_postprocess_cmds
+ rm lib/*.la
+endef
+
diff --git a/contrib/depends/packages/unwind.mk b/contrib/depends/packages/unwind.mk
index 543f868a5..fddbd0561 100644
--- a/contrib/depends/packages/unwind.mk
+++ b/contrib/depends/packages/unwind.mk
@@ -19,4 +19,6 @@ define $(package)_stage_cmds
endef
define $(package)_postprocess_cmds
+ rm lib/*.la
endef
+
diff --git a/contrib/depends/packages/zeromq.mk b/contrib/depends/packages/zeromq.mk
index 01146c26f..f17dbeebe 100644
--- a/contrib/depends/packages/zeromq.mk
+++ b/contrib/depends/packages/zeromq.mk
@@ -30,5 +30,7 @@ define $(package)_stage_cmds
endef
define $(package)_postprocess_cmds
- rm -rf bin share
+ rm -rf bin share &&\
+ rm lib/*.la
endef
+
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index 6b5434751..ee0407a5e 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -8,6 +8,7 @@ OPTION(BUILD_TESTS "Build tests." OFF)
SET(STATIC ON)
SET(UNBOUND_STATIC ON)
+SET(ARCH "default")
SET(BUILD_TESTS @build_tests@)
SET(TREZOR_DEBUG @build_tests@)
@@ -20,6 +21,8 @@ SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
SET(Readline_ROOT_DIR @prefix@)
+SET(Readline_INCLUDE_DIR @prefix@/include)
+SET(Termcap_LIBRARY @prefix@/lib/libncurses.a)
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
diff --git a/contrib/epee/include/net/abstract_tcp_server2.h b/contrib/epee/include/net/abstract_tcp_server2.h
index 374a28a2e..c1aa0fe5f 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.h
+++ b/contrib/epee/include/net/abstract_tcp_server2.h
@@ -70,7 +70,7 @@ namespace net_utils
struct i_connection_filter
{
- virtual bool is_remote_host_allowed(const epee::net_utils::network_address &address)=0;
+ virtual bool is_remote_host_allowed(const epee::net_utils::network_address &address, time_t *t = NULL)=0;
protected:
virtual ~i_connection_filter(){}
};
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 821594355..0721366aa 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -54,6 +54,9 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
+#define AGGRESSIVE_TIMEOUT_THRESHOLD 120 // sockets
+#define NEW_CONNECTION_TIMEOUT_LOCAL 1200000 // 2 minutes
+#define NEW_CONNECTION_TIMEOUT_REMOTE 10000 // 10 seconds
#define DEFAULT_TIMEOUT_MS_LOCAL 1800000 // 30 minutes
#define DEFAULT_TIMEOUT_MS_REMOTE 300000 // 5 minutes
#define TIMEOUT_EXTRA_MS_PER_BYTE 0.2
@@ -189,7 +192,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_protocol_handler.after_init_connection();
- reset_timer(get_default_timeout(), false);
+ reset_timer(boost::posix_time::milliseconds(m_local ? NEW_CONNECTION_TIMEOUT_LOCAL : NEW_CONNECTION_TIMEOUT_REMOTE), false);
// first read on the raw socket to detect SSL for the server
buffer_ssl_init_fill = 0;
@@ -324,12 +327,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
if (!e)
{
+ double current_speed_down;
{
CRITICAL_REGION_LOCAL(m_throttle_speed_in_mutex);
m_throttle_speed_in.handle_trafic_exact(bytes_transferred);
- context.m_current_speed_down = m_throttle_speed_in.get_current_speed();
- context.m_max_speed_down = std::max(context.m_max_speed_down, context.m_current_speed_down);
+ current_speed_down = m_throttle_speed_in.get_current_speed();
}
+ context.m_current_speed_down = current_speed_down;
+ context.m_max_speed_down = std::max(context.m_max_speed_down, current_speed_down);
{
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::network_throttle_manager::m_lock_get_global_throttle_in );
@@ -599,12 +604,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return false;
if(m_was_shutdown)
return false;
+ double current_speed_up;
{
CRITICAL_REGION_LOCAL(m_throttle_speed_out_mutex);
m_throttle_speed_out.handle_trafic_exact(cb);
- context.m_current_speed_up = m_throttle_speed_out.get_current_speed();
- context.m_max_speed_up = std::max(context.m_max_speed_up, context.m_current_speed_up);
+ current_speed_up = m_throttle_speed_out.get_current_speed();
}
+ context.m_current_speed_up = current_speed_up;
+ context.m_max_speed_up = std::max(context.m_max_speed_up, current_speed_up);
//_info("[sock " << socket().native_handle() << "] SEND " << cb);
context.m_last_send = time(NULL);
@@ -691,7 +698,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
unsigned count;
try { count = host_count(m_host); } catch (...) { count = 0; }
- const unsigned shift = std::min(std::max(count, 1u) - 1, 8u);
+ const unsigned shift = get_state().sock_count > AGGRESSIVE_TIMEOUT_THRESHOLD ? std::min(std::max(count, 1u) - 1, 8u) : 0;
boost::posix_time::milliseconds timeout(0);
if (m_local)
timeout = boost::posix_time::milliseconds(DEFAULT_TIMEOUT_MS_LOCAL >> shift);
@@ -730,8 +737,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
template<class t_protocol_handler>
void connection<t_protocol_handler>::reset_timer(boost::posix_time::milliseconds ms, bool add)
{
- if (m_connection_type != e_connection_type_RPC)
- return;
MTRACE("Setting " << ms << " expiry");
auto self = safe_shared_from_this();
if(!self)
diff --git a/contrib/epee/include/net/connection_basic.hpp b/contrib/epee/include/net/connection_basic.hpp
index d3f5f4f24..2acc6cdda 100644
--- a/contrib/epee/include/net/connection_basic.hpp
+++ b/contrib/epee/include/net/connection_basic.hpp
@@ -186,8 +186,6 @@ class connection_basic { // not-templated base class for rapid developmet of som
void sleep_before_packet(size_t packet_size, int phase, int q_len); // execute a sleep ; phase is not really used now(?)
static void save_limit_to_file(int limit); ///< for dr-monero
static double get_sleep_time(size_t cb);
-
- static void set_save_graph(bool save_graph);
};
} // nameserver
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h
index 6387c4c34..e315555fc 100644
--- a/contrib/epee/include/net/net_helper.h
+++ b/contrib/epee/include/net/net_helper.h
@@ -193,7 +193,6 @@ namespace net_utils
return CONNECT_FAILURE;
}
}
- m_ssl_options.support = ssl_support_t::e_ssl_support_enabled;
}
return CONNECT_SUCCESS;
}else
@@ -223,7 +222,6 @@ namespace net_utils
return false;
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{
- m_ssl_options.support = epee::net_utils::ssl_support_t::e_ssl_support_enabled;
if (try_connect_result == CONNECT_NO_SSL)
{
MERROR("SSL handshake failed on an autodetect connection, reconnecting without SSL");
@@ -396,7 +394,7 @@ namespace net_utils
if (!m_connected || !m_ssl_socket->next_layer().is_open())
return false;
if (ssl)
- *ssl = m_ssl_options.support == ssl_support_t::e_ssl_support_enabled;
+ *ssl = m_ssl_options.support != ssl_support_t::e_ssl_support_disabled;
return true;
}
@@ -651,7 +649,7 @@ namespace net_utils
bool write(const void* data, size_t sz, boost::system::error_code& ec)
{
bool success;
- if(m_ssl_options.support == ssl_support_t::e_ssl_support_enabled)
+ if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
success = boost::asio::write(*m_ssl_socket, boost::asio::buffer(data, sz), ec);
else
success = boost::asio::write(m_ssl_socket->next_layer(), boost::asio::buffer(data, sz), ec);
@@ -660,7 +658,7 @@ namespace net_utils
void async_write(const void* data, size_t sz, boost::system::error_code& ec)
{
- if(m_ssl_options.support == ssl_support_t::e_ssl_support_enabled)
+ if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
boost::asio::async_write(*m_ssl_socket, boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
else
boost::asio::async_write(m_ssl_socket->next_layer(), boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
@@ -668,7 +666,7 @@ namespace net_utils
void async_read(char* buff, size_t sz, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj& hndlr)
{
- if(m_ssl_options.support != ssl_support_t::e_ssl_support_enabled)
+ if(m_ssl_options.support == ssl_support_t::e_ssl_support_disabled)
boost::asio::async_read(m_ssl_socket->next_layer(), boost::asio::buffer(buff, sz), transfer_at_least, hndlr);
else
boost::asio::async_read(*m_ssl_socket, boost::asio::buffer(buff, sz), transfer_at_least, hndlr);
diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h
index 50536f63b..fce01311c 100644
--- a/contrib/epee/include/net/net_utils_base.h
+++ b/contrib/epee/include/net/net_utils_base.h
@@ -41,7 +41,7 @@
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MAKE_IP
-#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
+#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(((uint32_t)a4)<<24))
#endif
#if BOOST_VERSION >= 107000
@@ -107,6 +107,53 @@ namespace net_utils
inline bool operator>=(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return !lhs.less(rhs); }
+ class ipv4_network_subnet
+ {
+ uint32_t m_ip;
+ uint8_t m_mask;
+
+ public:
+ constexpr ipv4_network_subnet() noexcept
+ : ipv4_network_subnet(0, 0)
+ {}
+
+ constexpr ipv4_network_subnet(uint32_t ip, uint8_t mask) noexcept
+ : m_ip(ip), m_mask(mask) {}
+
+ bool equal(const ipv4_network_subnet& other) const noexcept;
+ bool less(const ipv4_network_subnet& other) const noexcept;
+ constexpr bool is_same_host(const ipv4_network_subnet& other) const noexcept
+ { return subnet() == other.subnet(); }
+ bool matches(const ipv4_network_address &address) const;
+
+ constexpr uint32_t subnet() const noexcept { return m_ip & ~(0xffffffffull << m_mask); }
+ std::string str() const;
+ std::string host_str() const;
+ bool is_loopback() const;
+ bool is_local() const;
+ static constexpr address_type get_type_id() noexcept { return address_type::invalid; }
+ static constexpr zone get_zone() noexcept { return zone::public_; }
+ static constexpr bool is_blockable() noexcept { return true; }
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(m_ip)
+ KV_SERIALIZE(m_mask)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ inline bool operator==(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return lhs.equal(rhs); }
+ inline bool operator!=(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return !lhs.equal(rhs); }
+ inline bool operator<(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return lhs.less(rhs); }
+ inline bool operator<=(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return !rhs.less(lhs); }
+ inline bool operator>(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return rhs.less(lhs); }
+ inline bool operator>=(const ipv4_network_subnet& lhs, const ipv4_network_subnet& rhs) noexcept
+ { return !lhs.less(rhs); }
+
class network_address
{
struct interface
@@ -250,7 +297,7 @@ namespace net_utils
const network_address m_remote_address;
const bool m_is_income;
const time_t m_started;
- const time_t m_ssl;
+ const bool m_ssl;
time_t m_last_recv;
time_t m_last_send;
uint64_t m_recv_cnt;
@@ -294,6 +341,11 @@ namespace net_utils
m_max_speed_up(0)
{}
+ connection_context_base(const connection_context_base& a): connection_context_base()
+ {
+ set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);
+ }
+
connection_context_base& operator=(const connection_context_base& a)
{
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);
diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h
index 2884f8c5e..e0a32b3ca 100644
--- a/contrib/epee/include/storages/portable_storage_from_bin.h
+++ b/contrib/epee/include/storages/portable_storage_from_bin.h
@@ -136,6 +136,7 @@ namespace epee
//for pod types
array_entry_t<type_name> sa;
size_t size = read_varint();
+ CHECK_AND_ASSERT_THROW_MES(size <= m_count, "Size sanity check failed");
sa.reserve(size);
//TODO: add some optimization here later
while(size--)
diff --git a/contrib/epee/src/buffer.cpp b/contrib/epee/src/buffer.cpp
index d637b905e..10ea6de56 100644
--- a/contrib/epee/src/buffer.cpp
+++ b/contrib/epee/src/buffer.cpp
@@ -64,7 +64,8 @@ void buffer::append(const void *data, size_t sz)
size_t reserve = (((size() + sz) * 3 / 2) + 4095) & ~4095;
new_storage.reserve(reserve);
new_storage.resize(size());
- memcpy(new_storage.data(), storage.data() + offset, storage.size() - offset);
+ if (size() > 0)
+ memcpy(new_storage.data(), storage.data() + offset, storage.size() - offset);
offset = 0;
std::swap(storage, new_storage);
}
diff --git a/contrib/epee/src/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp
index 19f2c7b02..82d9e3b53 100644
--- a/contrib/epee/src/connection_basic.cpp
+++ b/contrib/epee/src/connection_basic.cpp
@@ -284,9 +284,6 @@ double connection_basic::get_sleep_time(size_t cb) {
return t;
}
-void connection_basic::set_save_graph(bool save_graph) {
-}
-
} // namespace
} // namespace
diff --git a/contrib/epee/src/net_utils_base.cpp b/contrib/epee/src/net_utils_base.cpp
index 9b781027e..b7f07a23b 100644
--- a/contrib/epee/src/net_utils_base.cpp
+++ b/contrib/epee/src/net_utils_base.cpp
@@ -22,6 +22,24 @@ namespace epee { namespace net_utils
bool ipv4_network_address::is_local() const { return net_utils::is_ip_local(ip()); }
+ bool ipv4_network_subnet::equal(const ipv4_network_subnet& other) const noexcept
+ { return is_same_host(other) && m_mask == other.m_mask; }
+
+ bool ipv4_network_subnet::less(const ipv4_network_subnet& other) const noexcept
+ { return subnet() < other.subnet() ? true : (other.subnet() < subnet() ? false : (m_mask < other.m_mask)); }
+
+ std::string ipv4_network_subnet::str() const
+ { return string_tools::get_ip_string_from_int32(subnet()) + "/" + std::to_string(m_mask); }
+
+ std::string ipv4_network_subnet::host_str() const { return string_tools::get_ip_string_from_int32(subnet()) + "/" + std::to_string(m_mask); }
+ bool ipv4_network_subnet::is_loopback() const { return net_utils::is_ip_loopback(subnet()); }
+ bool ipv4_network_subnet::is_local() const { return net_utils::is_ip_local(subnet()); }
+ bool ipv4_network_subnet::matches(const ipv4_network_address &address) const
+ {
+ return (address.ip() & ~(0xffffffffull << m_mask)) == subnet();
+ }
+
+
bool network_address::equal(const network_address& other) const
{
// clang typeid workaround
diff --git a/contrib/epee/src/wipeable_string.cpp b/contrib/epee/src/wipeable_string.cpp
index 3a6ee5dac..4209b71bf 100644
--- a/contrib/epee/src/wipeable_string.cpp
+++ b/contrib/epee/src/wipeable_string.cpp
@@ -62,13 +62,15 @@ wipeable_string::wipeable_string(wipeable_string &&other)
wipeable_string::wipeable_string(const std::string &other)
{
grow(other.size());
- memcpy(buffer.data(), other.c_str(), size());
+ if (size() > 0)
+ memcpy(buffer.data(), other.c_str(), size());
}
wipeable_string::wipeable_string(std::string &&other)
{
grow(other.size());
- memcpy(buffer.data(), other.c_str(), size());
+ if (size() > 0)
+ memcpy(buffer.data(), other.c_str(), size());
if (!other.empty())
{
memwipe(&other[0], other.size()); // we're kinda left with this again aren't we
@@ -79,7 +81,8 @@ wipeable_string::wipeable_string(std::string &&other)
wipeable_string::wipeable_string(const char *s)
{
grow(strlen(s));
- memcpy(buffer.data(), s, size());
+ if (size() > 0)
+ memcpy(buffer.data(), s, size());
}
wipeable_string::wipeable_string(const char *s, size_t len)
@@ -112,14 +115,18 @@ void wipeable_string::grow(size_t sz, size_t reserved)
}
size_t old_sz = buffer.size();
std::unique_ptr<char[]> tmp{new char[old_sz]};
- memcpy(tmp.get(), buffer.data(), old_sz * sizeof(char));
if (old_sz > 0)
+ {
+ memcpy(tmp.get(), buffer.data(), old_sz * sizeof(char));
memwipe(buffer.data(), old_sz * sizeof(char));
+ }
buffer.reserve(reserved);
buffer.resize(sz);
- memcpy(buffer.data(), tmp.get(), old_sz * sizeof(char));
if (old_sz > 0)
+ {
+ memcpy(buffer.data(), tmp.get(), old_sz * sizeof(char));
memwipe(tmp.get(), old_sz * sizeof(char));
+ }
}
void wipeable_string::push_back(char c)
diff --git a/contrib/gitian/gitian-linux.yml b/contrib/gitian/gitian-linux.yml
index 67f174fec..6e3ad108e 100644
--- a/contrib/gitian/gitian-linux.yml
+++ b/contrib/gitian/gitian-linux.yml
@@ -129,6 +129,7 @@ script: |
chmod +x ${WRAP_DIR}/${prog}
done
+ git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
# Build dependencies for each host
@@ -153,7 +154,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON
- make
+ make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}.tar.gz
diff --git a/contrib/gitian/gitian-osx.yml b/contrib/gitian/gitian-osx.yml
index 7de302353..1cdb85273 100644
--- a/contrib/gitian/gitian-osx.yml
+++ b/contrib/gitian/gitian-osx.yml
@@ -77,6 +77,7 @@ script: |
create_per-host_faketime_wrappers "2000-01-01 12:00:00"
export PATH=${WRAP_DIR}:${PATH}
+ git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
@@ -100,7 +101,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
- make
+ make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}.tar.gz
diff --git a/contrib/gitian/gitian-win.yml b/contrib/gitian/gitian-win.yml
index 1eb558300..d15383905 100644
--- a/contrib/gitian/gitian-win.yml
+++ b/contrib/gitian/gitian-win.yml
@@ -100,6 +100,7 @@ script: |
create_per-host_linker_wrapper "2000-01-01 12:00:00"
export PATH=${WRAP_DIR}:${PATH}
+ git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
# Build dependencies for each host
@@ -125,7 +126,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
- make
+ make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip
diff --git a/contrib/rlwrap/monerocommands_bitmonerod.txt b/contrib/rlwrap/monerocommands_bitmonerod.txt
index c4f77b37d..e06e4f4f1 100644
--- a/contrib/rlwrap/monerocommands_bitmonerod.txt
+++ b/contrib/rlwrap/monerocommands_bitmonerod.txt
@@ -27,10 +27,8 @@ save
set_log
show_hr
start_mining
-start_save_graph
status
stop_daemon
stop_mining
-stop_save_graph
sync_info
unban