mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
feature #1793: Proper handling of IPv6 prefixes in the core
This commit is contained in:
parent
d8e92d4926
commit
9a41ccb334
@ -109,7 +109,7 @@ void Leases::Lease::ip6_to_string(const unsigned int eui64[],
|
||||
ip6.s6_addr32[3] = htonl(eui64[0]);
|
||||
|
||||
// global or site unicast address
|
||||
if (prefix[1] != 0 && prefix[0] != 0 )
|
||||
if (prefix[1] != 0 || prefix[0] != 0 )
|
||||
{
|
||||
ip6.s6_addr32[0] = htonl(prefix[1]);
|
||||
ip6.s6_addr32[1] = htonl(prefix[0]);
|
||||
@ -177,7 +177,6 @@ int Leases::Lease::mac_to_number(const string& _mac, unsigned int i_mac[])
|
||||
int Leases::Lease::prefix6_to_number(const string& prefix, unsigned int ip[])
|
||||
{
|
||||
struct in6_addr s6;
|
||||
ostringstream oss;
|
||||
|
||||
if (prefix.empty())
|
||||
{
|
||||
@ -185,9 +184,7 @@ int Leases::Lease::prefix6_to_number(const string& prefix, unsigned int ip[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
oss << prefix << ":0:0:0:1";
|
||||
|
||||
int rc = inet_pton(AF_INET6, oss.str().c_str(), &s6);
|
||||
int rc = inet_pton(AF_INET6, prefix.c_str(), &s6);
|
||||
|
||||
if ( rc != 1 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user