mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
pqissludp::Initiate_Connection() check remote_addr to be IPv4 before use
This commit is contained in:
parent
186617fc2b
commit
0bf02e2bc3
@ -227,6 +227,15 @@ int pqissludp::Initiate_Connection()
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(remote_addr))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: remote_addr is not "
|
||||
<< "valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(remote_addr);
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
//std::cerr << " Connect Period is:" << mConnectPeriod << std::endl;
|
||||
@ -254,32 +263,22 @@ int pqissludp::Initiate_Connection()
|
||||
struct sockaddr_in proxyaddr;
|
||||
struct sockaddr_in remoteaddr;
|
||||
|
||||
bool nonIpV4 = false;
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(remote_addr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: remote_addr is not "
|
||||
<< "valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(remote_addr);
|
||||
}
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(mConnectSrcAddr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: mConnectSrcAddr is "
|
||||
<< "not valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(mConnectSrcAddr);
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
}
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(mConnectProxyAddr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: mConnectProxyAddr "
|
||||
<< "is not valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(mConnectProxyAddr);
|
||||
}
|
||||
if(!nonIpV4)
|
||||
{
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
|
||||
}
|
||||
|
||||
struct sockaddr_in *rap = (struct sockaddr_in *) &remote_addr;
|
||||
@ -302,7 +301,6 @@ int pqissludp::Initiate_Connection()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*** It seems that the UDP Layer sees x 1.2 the traffic of the SSL layer.
|
||||
* We need to compensate somewhere... we drop the maximum traffic to 75% of limit
|
||||
* to allow for extra lost packets etc.
|
||||
|
Loading…
Reference in New Issue
Block a user