1
0
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:
Con Kolivas 2012-11-18 18:08:14 +11:00
parent 61f4e9d604
commit 0b088d8d81

9
util.c
View File

@ -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;