net: icmpv4: Return ENETUNREACH when IPv4 is unavailable

net_icmpv4_send_echo_request currently returns EINVAL (invalid
argument) when IPv4 is unavailable.

Since the availability of IPv4 has nothing to do with the arguments
provided to this function and the meaning of EINVAL in this case is
ambiguous, return the ENETUNREACH (network is unreachable) error
number instead.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2020-02-18 15:33:44 +09:00 committed by Maureen Helm
commit 2c733d5195

View file

@ -513,7 +513,7 @@ int net_icmpv4_send_echo_request(struct net_if *iface,
}
if (!iface->config.ip.ipv4) {
return -EINVAL;
return -ENETUNREACH;
}
/* Take the first address of the network interface */