mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #471: Fix IP6 prefix generation
This commit is contained in:
parent
c96eb249d2
commit
188fe16d52
@ -177,7 +177,7 @@ 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(prefix);
|
||||
ostringstream oss;
|
||||
|
||||
if (prefix.empty())
|
||||
{
|
||||
@ -185,7 +185,7 @@ int Leases::Lease::prefix6_to_number(const string& prefix, unsigned int ip[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
oss << ":0:0:0:1";
|
||||
oss << prefix << ":0:0:0:1";
|
||||
|
||||
int rc = inet_pton(AF_INET6, oss.str().c_str(), &s6);
|
||||
|
||||
@ -194,8 +194,8 @@ int Leases::Lease::prefix6_to_number(const string& prefix, unsigned int ip[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
ip[1] = s6.s6_addr32[0];
|
||||
ip[0] = s6.s6_addr32[1];
|
||||
ip[1] = ntohl(s6.s6_addr32[0]);
|
||||
ip[0] = ntohl(s6.s6_addr32[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user