Commit Graph

323 Commits

Author SHA1 Message Date
luigi1111 86938725ae
Merge pull request #5841
cae488d p2p: reject incoming connections to self (moneromooo-monero)
2019-09-08 19:48:09 -05:00
luigi1111 15dabf7d18
Merge pull request #5839
e353e3d p2p: sanitize peer lists (moneromooo-monero)
2019-09-08 19:45:09 -05:00
luigi1111 3b28ff2d6d
Merge pull request #5838
2e26536 p2p: move log away from global (moneromooo-monero)
2019-09-08 19:43:46 -05:00
moneromooo-monero cae488dc9b
p2p: reject incoming connections to self 2019-08-22 17:08:29 +00:00
moneromooo-monero e353e3d757
p2p: sanitize peer lists
Also remove the delta time fixup, since we now ignore those
as they're attacker controlled
2019-08-21 15:54:27 +00:00
moneromooo-monero 2e2653602f
p2p: move log away from global
It was here while debugging, and I forgot to move it away
2019-08-21 14:00:43 +00:00
moneromooo-monero fd60d05d5d
daemon: fix print_pl only printing public zone peers 2019-08-19 23:39:51 +00:00
luigi1111 8a0711f2f2
Merge pull request #5674
fcbf7b3 p2p: propagate out peers limit to payload handler (moneromooo-monero)
098aadf p2p: close the right number of connections on setting max in/out peers (moneromooo-monero)
2019-08-15 17:22:39 -05:00
Thomas Winget 155475d971
Add IPv6 support
new cli options (RPC ones also apply to wallet):
  --p2p-bind-ipv6-address (default = "::")
  --p2p-bind-port-ipv6    (default same as ipv4 port for given nettype)
  --rpc-bind-ipv6-address (default = "::1")

  --p2p-use-ipv6          (default false)
  --rpc-use-ipv6          (default false)

  --p2p-require-ipv4      (default true, if ipv4 bind fails and this is
                           true, will not continue even if ipv6 bind
                           successful)
  --rpc-require-ipv4      (default true, description as above)

ipv6 addresses are to be specified as "[xx:xx:xx::xx:xx]:port" except
in the cases of the cli args for bind address.  For those the square
braces can be omitted.
2019-07-31 20:04:57 -04:00
Lee Clagett 2a7d91523b Fixed i2p/tor tx flooding bug (white noise disabled) 2019-07-29 12:27:00 +00:00
luigi1111 61512cf798
Merge pull request #5610
068fa1c p2p: delay IGP probing on startup (moneromooo-monero)
2019-07-24 14:35:11 -05:00
luigi1111 e241a6280d
Merge pull request #5582
fcfcc3a rpc: in/out peers can now return the setting's value (moneromooo-monero)
2019-07-24 14:18:09 -05:00
luigi1111 e579fe4ae0
Merge pull request #5530
6abaaaa remove obsolete save_graph skeleton code (moneromooo-monero)
2019-07-24 14:07:29 -05:00
luigi1111 1880c1a582
Merge pull request #5363
515ac29 p2p: store network address directly in blocked host list (moneromooo-monero)
65c4004 allow blocking whole subnets (moneromooo-monero)
2019-07-24 13:47:41 -05:00
Riccardo Spagni 8eb075e789
Merge pull request #5732
a96c1a46 cryptonote_protocol: drop peers we can't download from when syncing (moneromooo-monero)
ab361df2 p2p: add a few missing connection close calls (moneromooo-monero)
2019-07-17 21:18:20 +02:00
Lee Clagett 3b24b1d082 Added support for "noise" over I1P/Tor to mask Tx transmission. 2019-07-17 14:22:37 +00:00
moneromooo-monero 65c4004963
allow blocking whole subnets 2019-07-16 11:35:53 +00:00
moneromooo-monero 515ac2951d
p2p: store network address directly in blocked host list
rather than their string representation
2019-07-16 11:35:52 +00:00
moneromooo-monero 4ee095c200
p2p: don't connect to more than one IP per class B if we can 2019-07-05 18:25:52 +00:00
moneromooo-monero ab361df2cd
p2p: add a few missing connection close calls 2019-07-04 21:56:10 +00:00
moneromooo-monero 098aadf084
p2p: close the right number of connections on setting max in/out peers 2019-06-19 11:49:36 +00:00
moneromooo-monero fcbf7b3f74
p2p: propagate out peers limit to payload handler 2019-06-19 11:49:36 +00:00
moneromooo-monero 068fa1ca5c
p2p: delay IGP probing on startup
We might have external access without having to do this
2019-06-06 10:33:02 +00:00
moneromooo-monero fcfcc3ac86
rpc: in/out peers can now return the setting's value 2019-05-30 12:13:31 +00:00
moneromooo-monero 6abaaaa994
remove obsolete save_graph skeleton code 2019-05-10 14:17:18 +00:00
moneromooo-monero 28a7d31565
p2p: do not send last_seen timestamp to peers
This can be used for fingerprinting and working out the
network topology.

Instead of sending the first N (which are sorted by last
seen time), we sent a random subset of the first N+N/5,
which ensures reasonably recent peers are used, while
preventing repeated calls from deducing new entries are
peers the target node just connected to.

The list is also randomly shuffled so the original set of
timestamps cannot be approximated.
2019-04-24 17:56:12 +00:00
Riccardo Spagni 8d16e92dcb
Merge pull request #5425
58585986 p2p: fix integer overflow in host bans (moneromooo-monero)
2019-04-16 22:38:56 +02:00
moneromooo-monero 5858598604
p2p: fix integer overflow in host bans 2019-04-11 21:59:27 +00:00
stoffu a2195b9b7f
crypto: replace rand<T>()%N idiom with unbiased rand_idx(N) 2019-04-04 22:38:19 +09:00
Riccardo Spagni 6e0242f861
Merge pull request #5334
19f8089f p2p: don't lookup seed nodes when offline (moneromooo-monero)
2019-04-01 17:37:01 +02:00
moneromooo-monero 19f8089fca
p2p: don't lookup seed nodes when offline
This will cause DNS requests, which will block and timeout
if there is really no network connectivity
2019-03-22 15:47:48 +00:00
rbrunner7 85f2f8c933 Fix daemon startup parameter '--limit-rate' processing after parameter defaults 2019-03-20 16:40:59 +01:00
Riccardo Spagni bf0f85221b
Merge pull request #5195
a54e81e5 daemon: add '--no-sync' arg to optionally disable blockchain sync (xiphon)
2019-03-19 10:57:28 +02:00
Riccardo Spagni 848591c4d8
Merge pull request #5190
551104fb daemon: add --public-node mode, RPC port propagation over P2P (xiphon)
2019-03-17 17:56:04 +02:00
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
moneromooo-monero ceb72be329
p2p: avoid busy loop when we have nothing to connect to 2019-03-05 12:00:45 +00:00
xiphon a54e81e572 daemon: add '--no-sync' arg to optionally disable blockchain sync 2019-02-25 03:22:14 +00:00
xiphon 551104fbf1 daemon: add --public-node mode, RPC port propagation over P2P 2019-02-25 02:40:23 +03:00
moneromooo-monero 2456945408
epee: add SSL support
RPC connections now have optional tranparent SSL.

An optional private key and certificate file can be passed,
using the --{rpc,daemon}-ssl-private-key and
--{rpc,daemon}-ssl-certificate options. Those have as
argument a path to a PEM format private private key and
certificate, respectively.
If not given, a temporary self signed certificate will be used.

SSL can be enabled or disabled using --{rpc}-ssl, which
accepts autodetect (default), disabled or enabled.

Access can be restricted to particular certificates using the
--rpc-ssl-allowed-certificates, which takes a list of
paths to PEM encoded certificates. This can allow a wallet to
connect to only the daemon they think they're connected to,
by forcing SSL and listing the paths to the known good
certificates.

To generate long term certificates:

openssl genrsa -out /tmp/KEY 4096
openssl req -new -key /tmp/KEY -out /tmp/REQ
openssl x509 -req -days 999999 -sha256 -in /tmp/REQ -signkey /tmp/KEY -out /tmp/CERT

/tmp/KEY is the private key, and /tmp/CERT is the certificate,
both in PEM format. /tmp/REQ can be removed. Adjust the last
command to set expiration date, etc, as needed. It doesn't
make a whole lot of sense for monero anyway, since most servers
will run with one time temporary self signed certificates anyway.

SSL support is transparent, so all communication is done on the
existing ports, with SSL autodetection. This means you can start
using an SSL daemon now, but you should not enforce SSL yet or
nothing will talk to you.
2019-02-02 20:05:33 +00:00
Lee Clagett 973403bc9f Adding initial support for broadcasting transactions over Tor
- Support for ".onion" in --add-exclusive-node and --add-peer
  - Add --anonymizing-proxy for outbound Tor connections
  - Add --anonymous-inbounds for inbound Tor connections
  - Support for sharing ".onion" addresses over Tor connections
  - Support for broadcasting transactions received over RPC exclusively
    over Tor (else broadcast over public IP when Tor not enabled).
2019-01-28 23:56:33 +00:00
moneromooo-monero b750fb27b0
Pruning
The blockchain prunes seven eighths of prunable tx data.
This saves about two thirds of the blockchain size, while
keeping the node useful as a sync source for an eighth
of the blockchain.

No other data is currently pruned.

There are three ways to prune a blockchain:

- run monerod with --prune-blockchain
- run "prune_blockchain" in the monerod console
- run the monero-blockchain-prune utility

The first two will prune in place. Due to how LMDB works, this
will not reduce the blockchain size on disk. Instead, it will
mark parts of the file as free, so that future data will use
that free space, causing the file to not grow until free space
grows scarce.

The third way will create a second database, a pruned copy of
the original one. Since this is a new file, this one will be
smaller than the original one.

Once the database is pruned, it will stay pruned as it syncs.
That is, there is no need to use --prune-blockchain again, etc.
2019-01-22 20:30:51 +00:00
Riccardo Spagni e59813c3d7
Merge pull request #5029
d1b3990d p2p: don't stop the idle thread when no gray peers are found (moneromooo-monero)
2019-01-16 21:39:19 +02:00
Riccardo Spagni 3e9bb9626a
Merge pull request #5001
a5ffc2d5 Remove boost::lexical_cast for uuid and unused uuid function (Lee Clagett)
2019-01-16 19:27:13 +02:00
Riccardo Spagni 846362842c
Merge pull request #4976
85665003 epee: better network buffer data structure (moneromooo-monero)
2019-01-16 19:04:22 +02:00
moneromooo-monero d1b3990d40
p2p: don't stop the idle thread when no gray peers are found 2018-12-30 19:32:38 +00:00
moneromooo-monero 85665003a7
epee: better network buffer data structure
avoids pointless allocs and memcpy
2018-12-23 16:46:07 +00:00
Lee Clagett a5ffc2d5ad Remove boost::lexical_cast for uuid and unused uuid function 2018-12-23 11:11:30 +00:00
moneromooo-monero 570dd3690e
p2p: use vector instead of list for peer lists 2018-12-07 13:20:34 +00:00
moneromooo-monero 14a5c2068f
p2p: tone down "no incoming connections" warning to info if in peers is 0
Also add an info if not offline, since it weakens the network
2018-11-01 16:43:06 +00:00
Riccardo Spagni ecc690a613
Merge pull request #4612
2d48861d p2p: only deinitialize what's been initialized in offline mode (moneromooo-monero)
2018-10-26 22:38:03 +02:00
moneromooo-monero 2d48861db7
p2p: only deinitialize what's been initialized in offline mode 2018-10-16 09:20:05 +00:00
moneromooo-monero 0fbbb065d4
p2p: a negative result from UPNP_GetValidIGD is an error
as per the source documentation
2018-10-15 22:41:00 +00:00
moneromooo-monero 76d6d832d2
Revert "p2p: connect via the bound ip, if any"
This reverts commit 909398efc7.

It looks like it's causing trouble with tor on some setups
2018-10-13 10:20:04 +00:00
luigi1111 b586ae1310
Merge pull request #4089
909398e p2p: connect via the bound ip, if any (moneromooo-monero)
2018-08-15 17:06:17 -05:00
luigi1111 025187e6c9
Merge pull request #3854
149da42 db_lmdb: enable batch transactions by default (stoffu)
34cb6b4 add --regtest and --fixed-difficulty for regression testing (vicsn)
9e1403e update get_info RPC and bump RPC version (vicsn)
207b66e first new functional tests (vicsn)
2018-07-19 13:35:25 -05:00
moneromooo-monero 909398efc7
p2p: connect via the bound ip, if any 2018-07-02 18:06:04 +01:00
victorsintnicolaas 34cb6b4b70 add --regtest and --fixed-difficulty for regression testing
on_generateblocks RPC call combines functionality from the on_getblocktemplate and on_submitblock RPC calls to allow rapid block creation. Difficulty is set permanently to 1 for regtest.
Makes use of FAKECHAIN network type, but takes hard fork heights from mainchain
Default reserve_size in generate_blocks RPC call is now 1. If it is 0, the following error occurs 'Failed to calculate offset for'.
Queries hard fork heights info of other network types
2018-06-29 10:06:11 +02:00
luigi1111 3ad4ecd4ff
Merge pull request #3982
08b85a8 cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X (stoffu)
0cf80ba net_node: resolve host for node addresses given via command line flags (stoffu)
2018-06-27 15:38:23 -05:00
luigi1111 cb130c7590
Merge pull request #3861
de1ffe0 p2p: warn when no incoming connections are seen for a while (moneromooo-monero)
2018-06-19 12:56:31 -05:00
stoffu 0cf80baea4
net_node: resolve host for node addresses given via command line flags 2018-06-11 20:17:13 +09:00
stoffu 08b85a8e00
cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X 2018-06-11 20:17:02 +09:00
moneromooo-monero de1ffe07b1
p2p: warn when no incoming connections are seen for a while 2018-05-26 14:37:07 +01:00
moneromooo-monero 1590183965
p2p: fix fallback seed node usage
Those were added to the seed nodes list even when they had already
been added. Moreover, the current index was not reset after they
were added, typically causing previous seeds to be used, and some
of those fallback seeds to not be tried.
2018-04-29 14:58:42 +01:00
anonimal 6b85398031
Build: update CMake and p2p for in-tree miniupnp
(cherry picked from commit a7366b5feeffaeb65b217b2d6f138e0ab1c90192)
2018-04-21 09:43:23 +00:00
anonimal 859db52fda
CMake: update new location of in-tree miniupnpc
(cherry picked from commit b16a282f97d8f6c967e8a0b1ecfd75110f095182)
2018-04-19 10:56:09 +00:00
stoffu 5f6647934b
p2p: correct port number for seed nodes 2018-03-22 14:56:35 +09:00
moneromooo-monero 523371c042
p2p: fix network ID being uninitialised when using exclusive peers 2018-03-13 11:20:49 +00:00
stoffu af773211cb
Stagenet 2018-03-05 11:55:05 +09:00
whythat 1d28c0d8a9 p2p: restore m_testnet assignment lost during rebase 2018-02-18 17:09:39 +02:00
whythat 05a12ccc2d options: remove testnet-* options 2018-02-16 22:32:01 +02:00
Riccardo Spagni ef91d6e61e
Merge pull request #3196
eda9fb5b p2p: fix testnet/mainnet port mixup (moneromooo-monero)
2018-02-16 14:31:16 +01:00
Riccardo Spagni f4a6bc79d9
Merge pull request #3226
e4646379 keccak: fix mdlen bounds sanity checking (moneromooo-monero)
2e3e90ac pass large parameters by const ref, not value (moneromooo-monero)
61defd89 blockchain: sanity check number of precomputed hash of hash blocks (moneromooo-monero)
9af6b2d1 ringct: fix infinite loop in unused h2b function (moneromooo-monero)
8cea8d0c simplewallet: double check a new multisig wallet is multisig (moneromooo-monero)
9b98a6ac threadpool: catch exceptions in dtor, to avoid terminate (moneromooo-monero)
24803ed9 blockchain_export: fix buffer overflow in exporter (moneromooo-monero)
f3f7da62 perf_timer: rewrite to make it clear there is no division by zero (moneromooo-monero)
c6ea3df0 performance_tests: remove add_arg call stray extra param (moneromooo-monero)
fa6b4566 fuzz_tests: fix an uninitialized var in setup (moneromooo-monero)
03887f11 keccak: fix sanity check bounds test (moneromooo-monero)
ad11db91 blockchain_db: initialize m_open in base class ctor (moneromooo-monero)
bece67f9 miner: restore std::cout precision after modification (moneromooo-monero)
1aabd14c db_lmdb: check hard fork info drop succeeded (moneromooo-monero)
2018-02-16 14:26:58 +01:00
Riccardo Spagni a54247b993
Merge pull request #3221
2e584dcb p2p: do not try to connect to peers in offline mode (moneromooo-monero)
2018-02-16 14:23:22 +01:00
moneromooo-monero 2e3e90acbe
pass large parameters by const ref, not value
Coverity 136394 136397 136409 136526 136529 136533 175302
2018-02-02 19:36:09 +00:00
moneromooo-monero 2e584dcb1f
p2p: do not try to connect to peers in offline mode 2018-02-01 20:18:30 +00:00
Erik de Castro Lopo 32c0f908cd Allow the number of incoming connections to be limited
It was already possible to limit outgoing connections. One might want
to do this on home network connections with high bandwidth but low
usage caps.
2018-01-29 11:14:02 +11:00
Erik de Castro Lopo d609a2c164 Rename delete_connections to delete_out_connections
This rename is needed so that delete_in_connections can be added.
2018-01-29 07:06:08 +11:00
Erik de Castro Lopo b927c0fc7a Rename connections_count to max_out_connection_count
This is needed so that a max_in_connection_count can be added.
2018-01-29 07:06:08 +11:00
moneromooo-monero eda9fb5b98
p2p: fix testnet/mainnet port mixup 2018-01-28 09:44:04 +00:00
Riccardo Spagni a4ae78a335
Merge pull request #3145
fd1dfac5 p2p: don't lookup seed IPs if using an exclusive peer (moneromooo-monero)
b50182ae p2p: don't connect to seeds if using an exclusive peer (moneromooo-monero)
2018-01-27 17:25:47 -08:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
moneromooo-monero ab58b150ef
p2p: fix picking peers off an empty gray list 2018-01-18 17:11:37 +00:00
moneromooo-monero fd1dfac5d2
p2p: don't lookup seed IPs if using an exclusive peer 2018-01-17 12:15:12 +00:00
moneromooo-monero b50182aee7
p2p: don't connect to seeds if using an exclusive peer 2018-01-17 11:17:21 +00:00
Riccardo Spagni c611cca462
Merge pull request #2928
d28c388f p2p: stop net server before closing starting connections (moneromooo-monero)
2017-12-25 21:19:58 +02:00
moneromooo-monero fe568db83d
p2p: use size_t for arbitrary counters instead of uint8_t 2017-12-18 15:15:10 +00:00
moneromooo-monero 4abf25f3c9
cryptonote_core does not depend on p2p anymore
As a followon side effect, this makes a lot of inline code
included only in particular cpp files (and instanciated
when necessary.
2017-12-16 23:28:38 +00:00
Riccardo Spagni 8da24c2a57
Merge pull request #2878
abebe392 rpc: add offline state in info rpc (moneromooo-monero)
7696e849 core: make --offline also disable DNS lookups (moneromooo-monero)
2017-12-16 23:27:00 +02:00
moneromooo-monero d28c388f88
p2p: stop net server before closing starting connections
This fixes a hang on exit due to race where a connection adds
itself to the server after the starting connections are closed,
but before the net server marks itself as stopped.
2017-12-15 10:31:12 +00:00
moneromooo-monero 7696e84952
core: make --offline also disable DNS lookups 2017-11-30 15:35:52 +00:00
rbrunner7 cf5f623616 Corrections in rate limiting / trottle code, especially in 'out' direction
Deleted 3 out of 4 calls to method connection_basic::sleep_before_packet
that were erroneous / superfluous, which enabled the elimination of a
"fudge" factor of 2.1 in connection_basic::set_rate_up_limit;
also ended the multiplying of limit values and numbers of bytes
transferred by 1024 before handing them over to the global throttle
objects
2017-11-28 21:18:01 +01:00
moneromooo-monero 082db75f28
move cryptonote command line options to cryptonote_core
Those have no reason to be in a generic module
2017-11-14 17:06:19 +00:00
moneromooo-monero 7dbf76d0da
Fix an object lifetime bug in net load tests
The commands handler must not be destroyed before the config
object, or we'll be accessing freed memory.

An earlier attempt at using boost::shared_ptr to control object
lifetime turned out to be very invasive, though would be a
better solution in theory.
2017-10-09 16:46:42 +01:00
Lee Clagett 8b00687735 Upgrades to epee::net_utils::network_address
- internal nullptr checks
  - prevent modifications to network_address (shallow copy issues)
  - automagically works with any type containing interface functions
  - removed fnv1a hashing
  - ipv4_network_address now flattened with no base class
2017-10-05 11:57:09 -04:00
Riccardo Spagni 174f2fb4da
Merge pull request #2428
054054c9 p2p: disable gray list housekeeping when an exclusive node is given (moneromooo-monero)
2017-09-25 16:46:26 +02:00
Riccardo Spagni 07312a7d6e
Merge pull request #2302
ef005f5e p2p: add a couple early outs when the stop signal is received (moneromooo-monero)
80d361c7 abstract_tcp_server2: improve tracking/cancelling of early connections (moneromooo-monero)
2017-09-21 10:11:33 +02:00
moneromooo-monero 054054c92f
p2p: disable gray list housekeeping when an exclusive node is given
Exclusive nodes may be used for privacy reasons, and thus we don't
want to connect to other nodes, even for checking connectivity.

See https://github.com/monero-project/monero/issues/2346
2017-09-10 13:11:42 +01:00
MaxXor e3680b6936 Rename m_listenning_port to m_listening_port 2017-09-01 09:50:22 +02:00
MaxXor a1ea475fff Delete UPnP port mapping on exit 2017-08-29 23:28:23 +02:00
moneromooo-monero 5524bc3151
print peer id in 0 padded hex for consistency 2017-08-23 13:37:56 +01:00
moneromooo-monero 70b8c6d77a
cryptonote_protocol: misc fixes to the new sync algorithm
Fix sync wedge corner case:
It could happen if a connection went into standby mode, while
it was the one which had requested the next span, and that span
was still waiting for the data, and that peer is not on the
main chain. Other peers can then start asking for that data
again and again, but never get it as only that forked peer does.

And various other fixes
2017-08-21 21:57:19 +01:00
moneromooo-monero ef005f5e72
p2p: add a couple early outs when the stop signal is received
This avoids quicker exit
2017-08-16 15:44:52 +01:00
Riccardo Spagni 4bfb58328d
Merge pull request #2282
7fdc178a p2p: fix random peer index being too large (moneromooo-monero)
2017-08-15 20:54:38 +02:00
Riccardo Spagni 74522c7e84
Merge pull request #2236
cb2d5110 Tweak net logs so we get more info on why networking can't start (moneromooo-monero)
2017-08-15 20:52:44 +02:00
moneromooo-monero cb2d5110ff
Tweak net logs so we get more info on why networking can't start
This should prevent "silent" failures to start
2017-08-15 19:49:25 +01:00
moneromooo-monero 7fdc178abb
p2p: fix random peer index being too large 2017-08-11 14:29:55 +01:00
moneromooo-monero 7591c528d0
p2p: fallback on seed nodes if we can't make a connection
This avoids failing to connect to the network in case all
known peers are unavailable (which can happen if the peer
list is small).
2017-08-09 22:55:25 +01:00
moneromooo-monero e49f6d439d
net_node: fix m_in_timedsync initialization
This fixes nodes not being able to connect to nodes which use
recent code. While there, init peer_id too.
2017-08-08 17:23:02 +01:00
Riccardo Spagni 6db8a60a18
Merge pull request #2149
158c3ecf core: thread most of handle_incoming_tx (moneromooo-monero)
f57ee382 cryptonote_protocol: retry stale spans early (moneromooo-monero)
90df52e1 cryptonote_protocol: light cleanup (moneromooo-monero)
84e23156 cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages (moneromooo-monero)
5be43fcd cryptonote_protocol_handler: sync speedup (moneromooo-monero)
2017-08-07 15:24:58 +02:00
Riccardo Spagni 43c6e452fa
Merge pull request #2219
04ebfbfe p2p: close connections when exiting (moneromooo-monero)
9a10148c p2p: fix thread leak (moneromooo-monero)
2017-08-07 15:11:20 +02:00
moneromooo-monero 5be43fcdba
cryptonote_protocol_handler: sync speedup
A block queue is now placed between block download and
block processing. Blocks are now requested only from one
peer (unless starved).

Includes a new sync_info coommand.
2017-08-07 09:33:04 +01:00
moneromooo-monero 04ebfbfefa
p2p: close connections when exiting
This ensures they don't leak if they were in the middle of an
async operation.
2017-07-29 10:04:36 +01:00
moneromooo-monero 9a10148c01
p2p: fix thread leak 2017-07-28 22:23:05 +01:00
moneromooo-monero 06aea2cf0a
move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h
This avoids having to include p2p_protocol_defs.h in util.h,
as util.h is used a lot, and p2p_protocol_defs.h includes
a lot of other things that most users don't need.
2017-07-27 15:46:47 +01:00
moneromooo-monero 8f96cfc20a
Remove typeid use in network_address
Since I had to add an ID to the derived classes anyway,
this can be used instead. This removes an apparently
pointless warning from CLANG too.
2017-06-28 09:11:24 +01:00
Riccardo Spagni f31b89012d
Merge pull request #2073
07c4276c Don't issue a new timedsync while one is already in progress (Howard Chu)
cf3a376c Don't timeout a slow operation that's making progress (Howard Chu)
340830de Fix PR#2039 (Howard Chu)
2017-06-24 12:41:09 +02:00
Howard Chu 07c4276cbe
Don't issue a new timedsync while one is already in progress
A timedsync is issued every minute on a connection, but the input
tineout is 2 minutes. This means a new sync request could be issued
while a slow sync request was already in progress. The additional
request will further clog the network on a slow connection, and
cause a premature timeout.
2017-06-15 16:54:03 +01:00
moneromooo-monero 072102cfd2
abstracted nework addresses
All code which was using ip and port now uses a new IPv4 object,
subclass of a new network_address class. This will allow easy
addition of I2P addresses later (and also IPv6, etc).
Both old style and new style peer lists are now sent in the P2P
protocol, which is inefficient but allows peers using both
codebases to talk to each other. This will be removed in the
future. No other subclasses than IPv4 exist yet.
2017-05-27 11:35:54 +01:00
Riccardo Spagni ed09652a17
Merge pull request #1701
8277e67f Add anchor connections (Miguel Herranz)
2017-05-05 11:26:11 +02:00
moneromooo-monero c1c9eeaaf7
p2p: use the fallback seed IPs when not enough seeds are found
In case the DNS seed(s) is/are down, which would otherwise
cause the fallback seeds to never be used. Also if the seeds
resolve to too few IPs.
2017-03-18 11:40:28 +00:00
Miguel Herranz 1a7e18bfdf Make gray peer selection uniform
Prevents the system from always picking the gray peers with the most
recent last_seen.
2017-02-28 17:39:39 +01:00
Riccardo Spagni 72deb4846d
updated fallback nodes 2017-02-21 22:40:26 +02:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero e74b3ab5f7
core: add p2p bind port options from net_node
They're now used by core to determine the data directory to use
for the txpool directory.

This fixes an assert in the core tests, which don't use the RPC
server, which normally initializes the P2P code.
2017-02-21 09:35:23 +00:00
Miguel Herranz 8277e67f11 Add anchor connections
Based on https://eprint.iacr.org/2015/263.pdf 4. Anchor connections.

Peer list serialisation version bumped to 5.
2017-02-10 23:28:54 +01:00
Riccardo Spagni fcb299b4ae
Merge pull request #1641
ca94d0a4 Separate data per P2P port (Miguel Herranz)
2017-02-02 22:41:28 +02:00
Miguel Herranz ca94d0a43c Separate data per P2P port
poolstate.bin and p2pstate.bin are stored in .bitmonero/ if the default
P2P port is being used.

If another port is used both files are stored in
.bitmonero/PORTNUMBER/.
2017-01-28 14:16:06 +01:00
Miguel Herranz 629e3101ab Replace BOOST_FOREACH with C++11 ranged for 2017-01-22 21:38:10 +01:00
Riccardo Spagni add98edfc3
Merge pull request #1609
4cdf0a35 p2p: always recreate a new peer id on startup (moneromooo-monero)
2017-01-22 11:47:43 -05:00
Riccardo Spagni f798a2ab85
Merge pull request #1606
f8b97aef p2p: show ban/unban logs by default again (moneromooo-monero)
2017-01-22 11:43:11 -05:00
moneromooo-monero 4cdf0a35c9
p2p: always recreate a new peer id on startup
This prevents easy fingerprinting when you change IPs, and
will be a must when kovri gets used.
2017-01-22 11:37:55 +00:00
moneromooo-monero f8b97aef34
p2p: show ban/unban logs by default again 2017-01-21 21:19:21 +00:00
Miguel Herranz 1c4d65c011 Rename method to get_random_gray_peer 2017-01-21 13:04:49 +01:00
Miguel Herranz 03a54ee0c9 Fix logging that broke after rebasing 2017-01-21 11:22:04 +01:00
Miguel Herranz 6bdd3a59b5 Use set_peer_just_seen to keep last_seen updated 2017-01-21 10:11:32 +01:00
Miguel Herranz 82dbeedd1b Add gray peer list housekeeping system
A random peer from the gray peer list is selected and a connection is
made to check if the peer is alive.

If the connection and handshake are successful the peer is promoted to
the white peer list, in case of failure the peer is evicted from the
gray peer list.

The connection is closed after the check in either case.
2017-01-21 10:09:38 +01:00
Riccardo Spagni d10425025a
Merge pull request #1572
0e0e6c5f Reduce to one connection per IP (Miguel Herranz)
3f269e98 Limit incoming connections from the same IP (Miguel Herranz)
2017-01-20 20:54:04 -05:00
Miguel Herranz 0e0e6c5f39 Reduce to one connection per IP 2017-01-16 18:16:32 +01:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Miguel Herranz 3f269e988c Limit incoming connections from the same IP 2017-01-15 12:11:27 +01:00
kenshi84 2ac8007544 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp 2016-12-20 13:04:19 +09:00
Riccardo Spagni f2ea2afb77
Merge pull request #1398
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04 22:28:22 +02:00
Riccardo Spagni 8086379680
Merge pull request #1397
3f7d6fb5 Fix delayed exit when syncing (moneromooo-monero)
2016-12-04 22:27:41 +02:00
Riccardo Spagni 4a0be41dfe
Merge pull request #1396
7c0dd5e4 net_node: drop connections from banned IPs after looping through connections (moneromooo-monero)
2016-12-04 22:26:12 +02:00
Pierre Boyer f4772bae81 Fix a few minor typos 2016-12-04 14:13:54 +01:00
moneromooo-monero 3f7d6fb57d
Fix delayed exit when syncing 2016-12-04 12:27:45 +00:00
moneromooo-monero 7c0dd5e46c
net_node: drop connections from banned IPs after looping through connections
This keeps the connections lock just for the time of looping
and adding connectoins to a list, and the dropping happens
after it. This should avoid lengthy delays waiting for the
connections lock.
2016-12-03 11:20:48 +00:00
moneromooo-monero 4adde0423b
p2p: possibly fix crash in relay_blocks 2016-12-01 23:52:16 +00:00
moneromooo-monero 17b6bd6d35
Fix DNS failures in offline mode preventing daemon startup 2016-11-23 23:14:49 +00:00
Dion Ahmetaj d61bd8187e add lightweight block propagation ("fluffy blocks")
Added a new command to the P2P protocol definitions to allow querying for support flags.

Implemented handling of new support flags command in net_node. Changed for_each callback template to include support flags. Updated print_connections command to show peer support flags.

Added p2p constant for signaling fluffy block support.

Added get_pool_transaction function to cryptnote_core.

Added new commands to cryptonote protocol for relaying fluffy blocks.

Implemented handling of fluffy block command in cryptonote protocol.

Enabled fluffy block support in node initial configuration.

Implemented get_testnet function in cryptonote_core.

Made it so that fluffy blocks only run on testnet.
2016-11-09 14:24:27 -05:00