use llarp::Addr to store local private ip

pull/19/head
Ryan Tharp 6 years ago
parent c40d5f4c4d
commit f032a83e37

@ -11,8 +11,7 @@
// neither, it's a result set row
struct dns_pointer
{
// FIXME change to llarp::Addr
struct sockaddr *hostResult;
llarp::Addr hostResult;
llarp::service::Address b32addr;
// we could store the timeout at which we expect it to be available
// or a list of pending requests for it
@ -22,7 +21,6 @@ struct ip_range
{
uint8_t octet2;
uint8_t octet3;
// FIXME: we're not consecutive
uint8_t left;
std::unordered_map< uint8_t, dns_pointer * > used;
};

@ -47,8 +47,8 @@ dns_iptracker_setup(llarp::Addr tunGatewayIp)
range->left = 252;
// 4th octet, probably 1, set it
struct dns_pointer *result = new dns_pointer;
result->hostResult = new sockaddr;
tunGatewayIp.CopyInto(result->hostResult);
result->hostResult = tunGatewayIp;
// tunGatewayIp.CopyInto(result->hostResult);
// result->b32addr = ; // FIXME: should be our HS addr
range->used[ip[3]] = result; // claim tun IP
@ -86,8 +86,9 @@ dns_iptracker_allocate_range(std::unique_ptr< ip_range > &range, uint8_t first)
llarp::Addr ip(first, range->octet2, range->octet3,
range->left + 2); // why plus 2? to start at .2
llarp::LogDebug("Allocated ", ip);
result->hostResult = new sockaddr;
ip.CopyInto(result->hostResult);
// result->hostResult = new sockaddr;
// ip.CopyInto(result->hostResult);
result->hostResult = ip;
// make an address and place into this sockaddr
range->used[range->left + 2] = result;

Loading…
Cancel
Save