Skip to content

Commit

Permalink
fix IPv6 mask and subnet computation
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Rousse authored and Guillaume Rousse committed Apr 6, 2012
1 parent d497024 commit 8a613a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/FusionInventory/Agent/Task/Inventory/Input/Win32/Networks.pm
Expand Up @@ -78,8 +78,8 @@ sub _getInterfaces {

if ($object->{IPAddress}) {
foreach my $address (@{$object->{IPAddress}}) {
my $mask = shift @{$object->{IPSubnet}};
push @{$configuration->{addresses}}, [ $address, $mask ];
my $prefix = shift @{$object->{IPSubnet}};
push @{$configuration->{addresses}}, [ $address, $prefix ];
}
}

Expand Down Expand Up @@ -116,15 +116,15 @@ sub _getInterfaces {
$interface->{IPADDRESS} = $address->[0];
$interface->{IPMASK} = $address->[1];
$interface->{IPSUBNET} = getSubnetAddress(
$address->[0],
$address->[1]
$interface->{IPADDRESS},
$interface->{IPMASK}
);
} else {
$interface->{IPADDRESS6} = $address->[0];
$interface->{IPMASK6} = $address->[1];
$interface->{IPMASK6} = getNetworkMaskIPv6($address->[1]);
$interface->{IPSUBNET6} = getSubnetAddressIPv6(
$address->[0],
$address->[1]
$interface->{IPADDRESS6},
$interface->{IPMASK6}
);
}

Expand Down
4 changes: 2 additions & 2 deletions t/inventory/windows/networks.t
Expand Up @@ -38,14 +38,14 @@ my %tests = (
},
{
dns => '192.168.0.254',
IPMASK6 => '64',
IPMASK6 => 'ffff:ffff:ffff:ffff::',
IPGATEWAY => '192.168.0.254',
MACADDR => 'F4:6D:04:97:2D:3E',
STATUS => 'Up',
IPADDRESS6 => 'fe80::311a:2127:dded:6618',
IPDHCP => '192.168.0.254',
MTU => undef,
IPSUBNET6 => undef,
IPSUBNET6 => 'fe80::',
DESCRIPTION => 'Realtek PCIe GBE Family Controller',
VIRTUALDEV => 0,
SPEED => 100000000,
Expand Down

0 comments on commit 8a613a5

Please sign in to comment.