Commit 47b55e70 authored by Michael Tremer's avatar Michael Tremer

network: loc_network_subnets: Use correct prefix

The prefix is being stored as a total number of bits now since it is
easier for any bitwise maths later. This is however causing an incorrect
prefix being computed when splitting a network into two subnets for
IPv4.

To get the correct prefix, loc_network_prefix must be called.

Introduced in 1fd09d0bReported-by: default avatarValter Jansons <valter.jansons@gmail.com>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 725718e1
......@@ -312,7 +312,7 @@ LOC_EXPORT int loc_network_subnets(struct loc_network* network,
*subnet2 = NULL;
// New prefix length
unsigned int prefix = network->prefix + 1;
unsigned int prefix = loc_network_prefix(network) + 1;
// Check if the new prefix is valid
if (!loc_address_valid_prefix(&network->first_address, prefix)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment