mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-01 00:31:51 +00:00
--api-allow special case 0/0 means all
This commit is contained in:
parent
136b50d51c
commit
3955fefec0
9
api.c
9
api.c
@ -1234,7 +1234,10 @@ static void tidyup()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Interpret IP[/Prefix][,IP2[/Prefix2][,...]] --api-allow option
|
* Interpret IP[/Prefix][,IP2[/Prefix2][,...]] --api-allow option
|
||||||
*
|
* special case of 0/0 allows /0 (means all IP addresses)
|
||||||
|
*/
|
||||||
|
#define ALLIP4 "0/0"
|
||||||
|
/*
|
||||||
* N.B. IP4 addresses are by Definition 32bit big endian on all platforms
|
* N.B. IP4 addresses are by Definition 32bit big endian on all platforms
|
||||||
*/
|
*/
|
||||||
static void setup_ipaccess()
|
static void setup_ipaccess()
|
||||||
@ -1274,6 +1277,9 @@ static void setup_ipaccess()
|
|||||||
if (comma)
|
if (comma)
|
||||||
*(comma++) = '\0';
|
*(comma++) = '\0';
|
||||||
|
|
||||||
|
if (strcmp(ptr, ALLIP4) == 0)
|
||||||
|
ipaccess[ips].ip = ipaccess[ips].mask = 0;
|
||||||
|
else {
|
||||||
slash = strchr(ptr, '/');
|
slash = strchr(ptr, '/');
|
||||||
if (!slash)
|
if (!slash)
|
||||||
ipaccess[ips].mask = 0xffffffff;
|
ipaccess[ips].mask = 0xffffffff;
|
||||||
@ -1306,6 +1312,7 @@ static void setup_ipaccess()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipaccess[ips].ip &= ipaccess[ips].mask;
|
ipaccess[ips].ip &= ipaccess[ips].mask;
|
||||||
|
}
|
||||||
|
|
||||||
ips++;
|
ips++;
|
||||||
popipo:
|
popipo:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user