1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

(squash later) blocklist cidr endianness

This commit is contained in:
Mingye Wang 2018-10-17 09:41:19 -04:00
parent f61306f65f
commit 94ee776113

View file

@ -319,13 +319,13 @@ static bool parseLine3(char const* line, struct tr_ipv4_range* range) {
return false; return false;
} }
/* do it in the network order */ /* this is host order */
mask <<= 32 - pflen; mask <<= 32 - pflen;
ip_u = ip[0] << 24 | ip[1] << 16 | ip[2] << 8 | ip[3]; ip_u = ip[0] << 24 | ip[1] << 16 | ip[2] << 8 | ip[3];
/* fill the non-prefix bits the way we need it */ /* fill the non-prefix bits the way we need it */
range->begin = ntohl(ip_u & mask); range->begin = ip_u & mask;
range->end = ntohl(ip_u | (~mask)); range->end = ip_u | (~mask);
return true; return true;
} }