1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-08 22:08:02 +00:00
Commit Graph

458 Commits

Author SHA1 Message Date
Noel Maersk
ae7dbca783 stratum: parse_notify(): Don't die on malformed bbversion/prev_hash/nbit/ntime.
Might have introduced a memory leak, don't have time to check. :(

Should the other hex2bin()'s be checked?

Thanks to Mick Ayzenberg <mick.dejavusecurity.com> for finding this.
2014-06-06 00:20:07 +03:00
Noel Maersk
cab6e28b12 stratum: parse_reconnect(): treat pool-sent URL as untrusted.
Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for reminding
that this existed and highlighting the offender.

Also to Luke-jr for actually fixing this in bfgminer. :D
2014-06-06 00:19:59 +03:00
Luke Dashjr
91d29ea972 Stratum: extract_sockaddr: Truncate overlong addresses rather than stack overflow
Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for finding this!
2014-06-06 00:19:51 +03:00
Luke Dashjr
44e770904e Bugfix: initiate_stratum: Ensure extranonce2 size is not negative (which could lead to exploits later as too little memory gets allocated)
Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for finding this!
2014-06-06 00:19:48 +03:00
elbandi
98676763b9 Set the pool idle and switch pool, if need 2014-05-08 00:02:39 +02:00
elbandi
c469ff923a Disconnect from pool, if auth is failed 2014-05-08 00:02:03 +02:00
Elbandi
973dcefa8c Use get_pool_name everywhere 2014-04-24 12:09:56 +02:00
Noel Maersk
7051629232 log: change log level in setup_stratum_socket().
Erroneously stayed at LOG_ERROR after issue #88 (IIRC).
2014-04-07 23:54:43 +03:00
Noel Maersk
cabb02f5d4 log: do not show pool difficulty changes on non-current pool.
Keep log spam down when using a lot of vardiff pools, or if a p2pool is
a fallback.
2014-04-02 23:35:03 +03:00
Noel Maersk
1f7b7ef26e stratum: move log warning under opt_disable_client_reconnect clause. 2014-03-24 15:25:31 +02:00
Martin Danielsen
01b3f70b63 A new --no-client-reconnect command that disables the 'client.reconnect' function.
It looks like there's an exploit that abuses said command, but it is still not clear exactly how.

There's also an additional message when the reconnect happens: "WARNING: POTENTIAL CLIENT.EXPLOIT!", but it requires you to be actively monitoring your log to catch it, and in which case you already get a "Reconnect requested from Pool 0 to 127.0.0.1" message.

Note that disabling 'client.reconnect' might affect some pools that rely on the feature, like pools that you lease your rig to.

Oh and this is dry-coded. :)
2014-03-24 15:12:40 +02:00
troky
49aef7100f Reverting "poolname" to "name". 2014-03-15 19:08:24 +02:00
Noel Maersk
8f014effeb util: add missing include. 2014-03-02 19:15:30 +02:00
Noel Maersk
d58de45c0e pool: use get_pool_name() where appropriate. 2014-02-28 23:22:40 +02:00
Noel Maersk
44aed3570e Merge branch 'build-msvs2010-upd' into build-msvs2010-merge
Test in separate branch before merging into master.

Conflicts (resolved):
	api.c
	util.c
2014-02-22 17:05:07 +02:00
Con Kolivas
aca8a58f2e Only show one decimal place if pool diff is not an integer. 2014-02-16 15:11:59 +02:00
Con Kolivas
f7394ff165 Check for more interrupted conditions in util.c and handle them gracefully. 2014-02-16 14:43:00 +02:00
Con Kolivas
6b246a59f3 Handle interruptions to various select calls in util.c 2014-02-16 14:41:58 +02:00
Con Kolivas
cc2aa215a8 Clear pool work on a stratum reconnect message. 2014-02-16 13:57:20 +02:00
Kano
faf63ec036 Modify thread naming to make them easier to identify 2014-02-16 13:56:14 +02:00
Con Kolivas
003b65b7b1 Change stratum strings under stratum_lock in reconnect and free old strings.
Conflicts resolved:
	util.c
2014-02-16 13:38:51 +02:00
Noel Maersk
91d36d097a log: add LOG_DEBUG message on restarting stratum. 2014-02-14 20:51:16 +02:00
Noel Maersk
ed586c4aa5 misc: indentation. 2014-02-14 20:33:38 +02:00
Noel Maersk
abeeff3d45 log: print getaddrinfo() error description.
More debugging for issue 88.
2014-02-14 19:59:59 +02:00
Noel Maersk
a8dfb3ebef pool: add getaddrinfo() LOG_DEBUG messages.
More for issue 88.
2014-02-13 13:40:47 +02:00
Noel Maersk
115eb1ad2f pool: be verbose on which pool failed. 2014-02-13 12:29:35 +02:00
Noel Maersk
87102ecd07 pool: additional debug logging for stratum pools.
Might help in trying to resove issue 88.
2014-02-12 21:11:59 +02:00
Markus Peloquin
bf8e37ce19 Support building in cygwin.
Revised the compiler platform macros. Building goes like
$ AMDAPPSDKROOT= CPPFLAGS=-I/usr/include/ncurses ./configure
2014-02-07 22:31:40 -08:00
Sanjin Trošelj
87e5f35745 VS2010 build: commit elist.h and relevant changes in sgminer.c and util.c
Cherry-picked by veox.

Introduces a segfault. Expect a HEAD reset.
2014-01-28 02:42:56 +02:00
Sanjin Trošelj
5078db8b01 VS2010 build: Prepare util.c
Cherry-picked by veox.
2014-01-28 01:04:04 +02:00
Martin Danielsen
d7e469bd76 Stratum servers can now be named.
The names will be used throughout the display in the program, when not set "Pool 1" will
simply be used instead. The names are not exposed through API yet, it's on my TODO list.

Use "poolname" like this:

	{
		"poolname" : "Example pool",
		"url" : "stratum+tcp://example.com:8080",
		"user" : "y",
		"pass" : "x"
	},

Conflicts:
	sgminer.c
	util.c
2014-01-18 21:05:26 +02:00
Noel Maersk
50066cf3c7 misc: Replace all remaining instances of 'cgminer' with 'sgminer'.
sed again.
2014-01-15 16:36:48 +02:00
Con Kolivas
9628207066 Provide a helper function that can reset cgsems to zero. 2014-01-15 14:28:24 +02:00
Con Kolivas
7d2cee3066 Drop json stratum auth failed message log level to verbose. 2014-01-15 13:35:19 +02:00
Maksym Borodin
8fa5ddfd2c util.c: Decreasing reference count on allocated JSON obects to prevent memory leak 2014-01-14 18:35:56 +02:00
Noel Maersk
e4680ab627 core: allow changing TCP keepalive packet idle time using tcp-keepalive command-line option or config-file option.
This may be useful in certain scenarios. However, server load from keepalive
is increased 6-fold if code is hard-changed from 30 to 5. So, provide it as
an option instead, and use the previous value as a default (30).

Explanation from

015c064396

Kevin's middlecoin fix, CURL TCP keepalive constants lowered:

CURLOPT_TCP_KEEPIDLE from 45 to 5 and CURLOPT_TCP_KEEPINTVL from 30 to
5. Before it'd trigger a keepalive packet after 45 seconds of connection
idle time and then again every 30 seconds. Now it triggers a keepalive
packet after 5 seconds of connection idle time and then again every 5
seconds.

It makes the client more resilient against coin switching pools or just
pools with connection issues in general. It will however add a tiny bit
pressure to the pool server; but a TCP keepalive probe is only about
60-80 bytes, so I don't think it is an issue.
2014-01-12 19:45:31 +02:00
Con Kolivas
5d7c99f389 Revert "Return ETIMEDOUT regardless if we fail in cgsem_mswait since we may be waiting on it on shutdown and the return response is harmless."
This reverts commit 3dcae53e38.
2013-11-06 00:24:16 +11:00
Con Kolivas
3dcae53e38 Return ETIMEDOUT regardless if we fail in cgsem_mswait since we may be waiting on it on shutdown and the return response is harmless. 2013-11-05 21:56:01 +11:00
Con Kolivas
759bd39f17 Avoid the extra generation of a byte flipped hash2 in struct work and directly use the LE work hash. 2013-11-02 11:07:44 +11:00
Con Kolivas
eaaf34a19d Use a non blocking connect with a 1 second select timeout when initiating stratum to allow us to iterate over all IPs returned by getaddrinfo in round robin DNS pools. 2013-10-31 15:07:26 +11:00
Vitalii Demianets
f75fdbbbbe Improve performance of work generation by optimizing hex2bin and bin2hex
sprintf is a very expensive function, do direct translation instead.
2013-10-29 21:56:08 +11:00
Con Kolivas
b424612cce Use a sanity check on timeout on windows. 2013-10-27 13:35:47 +11:00
Con Kolivas
d342bcbe81 Provide a mechanism for informing drivers of updated work templates for stratum and gbt mining. 2013-10-25 11:57:27 +11:00
Con Kolivas
8dcbc86b97 Use windows' own higher resolution time and handlers allowing us to have higher precision absolute timeouts. 2013-10-23 10:19:04 +11:00
Con Kolivas
563cad189e Fix lldiv error in windows cgminer_t calculation. 2013-10-23 09:13:50 +11:00
Con Kolivas
3956382450 Send pthread_cancel to failed completion_timeout that has timed out. 2013-10-18 22:04:21 +11:00
ckolivas
7838af1dc1 Remove unused variables. 2013-10-18 10:51:44 +11:00
ckolivas
0430165f7b Fix cgcompletion return code and free on successful completion. 2013-10-18 10:26:31 +11:00
ckolivas
f826e35765 Provide a cg_completion_timeout helper function for unreliable functions that takes arbitrary functions and parameters and reliably returns. 2013-10-18 10:14:51 +11:00
Con Kolivas
c9c39ac14d Give correct return code in cgsem_mswait 2013-10-14 11:44:13 +11:00