mirror of https://github.com/oxen-io/lokinet
fix exit info
This commit is contained in:
parent
3da6551e82
commit
20e398b684
|
@ -33,12 +33,12 @@ namespace llarp
|
|||
if(!bencode_start_dict(buf))
|
||||
return false;
|
||||
|
||||
if(!inet_ntop(AF_INET6, (void*)&address, tmp, sizeof(tmp)))
|
||||
if(!inet_ntop(AF_INET6, address.s6_addr, tmp, sizeof(tmp)))
|
||||
return false;
|
||||
if(!BEncodeWriteDictString("a", std::string(tmp), buf))
|
||||
return false;
|
||||
|
||||
if(!inet_ntop(AF_INET6, (void*)&netmask, tmp, sizeof(tmp)))
|
||||
if(!inet_ntop(AF_INET6, netmask.s6_addr, tmp, sizeof(tmp)))
|
||||
return false;
|
||||
if(!BEncodeWriteDictString("b", std::string(tmp), buf))
|
||||
return false;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace llarp
|
|||
memset(address.s6_addr, 0, 16);
|
||||
address.s6_addr[11] = 0xff;
|
||||
address.s6_addr[10] = 0xff;
|
||||
memcpy(address.s6_addr + 12, &ipv4_exit, 4);
|
||||
memcpy(address.s6_addr + 12, &ipv4_exit.n, 4);
|
||||
memset(netmask.s6_addr, 0xff, 16);
|
||||
}
|
||||
|
||||
|
|
|
@ -1004,11 +1004,10 @@ namespace llarp
|
|||
}
|
||||
|
||||
bool
|
||||
IsBogonRange(__attribute__((unused)) const in6_addr& host,
|
||||
__attribute__((unused)) const in6_addr& netmask)
|
||||
IsBogonRange(const in6_addr&, const in6_addr&)
|
||||
{
|
||||
// TODO: implement me
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -302,7 +302,10 @@ namespace llarp
|
|||
for(const auto &exit : exits)
|
||||
{
|
||||
if(IsBogonRange(exit.address, exit.netmask))
|
||||
{
|
||||
llarp::LogError("bogon exit: ", exit);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!VerifySignature(crypto))
|
||||
{
|
||||
|
|
|
@ -31,10 +31,12 @@ TEST_F(RCTest, TestSignVerify)
|
|||
RC_t rc;
|
||||
SecKey_t encr;
|
||||
SecKey_t sign;
|
||||
|
||||
crypto.encryption_keygen(encr);
|
||||
crypto.identity_keygen(sign);
|
||||
rc.enckey = encr.toPublic();
|
||||
rc.pubkey = sign.toPublic();
|
||||
rc.exits.emplace_back(rc.pubkey, llarp::nuint32_t{50000});
|
||||
ASSERT_TRUE(rc.netID == netid);
|
||||
ASSERT_TRUE(rc.netID == llarp::NetID::DefaultValue());
|
||||
ASSERT_TRUE(rc.Sign(&crypto, sign));
|
||||
|
|
Loading…
Reference in New Issue