net: if: Check IPv6 pointers properly in hop limit setters/getters
We must make sure that IPv6 configuration pointer is valid so that the hop limit can be set for a given interface. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
e7b1d6d8aa
commit
3de1f1b5d0
|
@ -2649,6 +2649,10 @@ uint8_t net_if_ipv6_get_mcast_hop_limit(struct net_if *iface)
|
||||||
|
|
||||||
net_if_lock(iface);
|
net_if_lock(iface);
|
||||||
|
|
||||||
|
if (net_if_config_ipv6_get(iface, NULL) < 0) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iface->config.ip.ipv6) {
|
if (!iface->config.ip.ipv6) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -2670,6 +2674,10 @@ void net_if_ipv6_set_mcast_hop_limit(struct net_if *iface, uint8_t hop_limit)
|
||||||
#if defined(CONFIG_NET_NATIVE_IPV6)
|
#if defined(CONFIG_NET_NATIVE_IPV6)
|
||||||
net_if_lock(iface);
|
net_if_lock(iface);
|
||||||
|
|
||||||
|
if (net_if_config_ipv6_get(iface, NULL) < 0) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iface->config.ip.ipv6) {
|
if (!iface->config.ip.ipv6) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -2690,6 +2698,10 @@ uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface)
|
||||||
|
|
||||||
net_if_lock(iface);
|
net_if_lock(iface);
|
||||||
|
|
||||||
|
if (net_if_config_ipv6_get(iface, NULL) < 0) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iface->config.ip.ipv6) {
|
if (!iface->config.ip.ipv6) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -2711,6 +2723,10 @@ void net_if_ipv6_set_hop_limit(struct net_if *iface, uint8_t hop_limit)
|
||||||
#if defined(CONFIG_NET_NATIVE_IPV6)
|
#if defined(CONFIG_NET_NATIVE_IPV6)
|
||||||
net_if_lock(iface);
|
net_if_lock(iface);
|
||||||
|
|
||||||
|
if (net_if_config_ipv6_get(iface, NULL) < 0) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iface->config.ip.ipv6) {
|
if (!iface->config.ip.ipv6) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue