mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Provide rudimentary support for literal ipv6 addresses when parsing stratum URLs.
This commit is contained in:
parent
61f4e9d604
commit
0b088d8d81
9
util.c
9
util.c
@ -833,7 +833,7 @@ double tdiff(struct timeval *end, struct timeval *start)
|
|||||||
|
|
||||||
bool extract_sockaddr(struct pool *pool, char *url)
|
bool extract_sockaddr(struct pool *pool, char *url)
|
||||||
{
|
{
|
||||||
char *url_begin, *url_end, *port_start = NULL;
|
char *url_begin, *url_end, *ipv6_begin, *ipv6_end, *port_start = NULL;
|
||||||
char url_address[256], port[6];
|
char url_address[256], port[6];
|
||||||
int url_len, port_len = 0;
|
int url_len, port_len = 0;
|
||||||
|
|
||||||
@ -843,6 +843,13 @@ bool extract_sockaddr(struct pool *pool, char *url)
|
|||||||
url_begin = url;
|
url_begin = url;
|
||||||
else
|
else
|
||||||
url_begin += 2;
|
url_begin += 2;
|
||||||
|
|
||||||
|
/* Look for numeric ipv6 entries */
|
||||||
|
ipv6_begin = strstr(url_begin, "[");
|
||||||
|
ipv6_end = strstr(url_begin, "]");
|
||||||
|
if (ipv6_begin && ipv6_end && ipv6_end > ipv6_begin)
|
||||||
|
url_end = strstr(ipv6_end, ":");
|
||||||
|
else
|
||||||
url_end = strstr(url_begin, ":");
|
url_end = strstr(url_begin, ":");
|
||||||
if (url_end) {
|
if (url_end) {
|
||||||
url_len = url_end - url_begin;
|
url_len = url_end - url_begin;
|
||||||
|
Loading…
Reference in New Issue
Block a user