Commit 92ba094c authored by Michael Tremer's avatar Michael Tremer

network: Log a more useful message on invalid prefix

If loc_network_subnets is being called with some invalid input, we just
fail without logging a useful message or setting errno accordingly.

This is being changed with this patch.
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 065b3496
......@@ -315,8 +315,11 @@ LOC_EXPORT int loc_network_subnets(struct loc_network* network,
unsigned int prefix = network->prefix + 1;
// Check if the new prefix is valid
if (!loc_address_valid_prefix(&network->first_address, prefix))
return -1;
if (!loc_address_valid_prefix(&network->first_address, prefix)) {
ERROR(network->ctx, "Invalid prefix: %d\n", prefix);
errno = EINVAL;
return 1;
}
// Create the first half of the network
r = loc_network_new(network->ctx, subnet1, &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