Skip to content

Commit

Permalink
net: if: Check IPv6 pointers properly in hop limit setters/getters
Browse files Browse the repository at this point in the history
We must make sure that IPv6 configuration pointer is valid
so that the hop limit can be set for a given interface.

(cherry picked from commit 3de1f1b)

Original-Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
GitOrigin-RevId: 3de1f1b
Change-Id: I134d21542b55dd82b1e4d8d203d6178bf3762dac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5324199
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Tested-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
  • Loading branch information
jukkar authored and Chromeos LUCI committed Feb 26, 2024
1 parent 9a62eac commit 2a880cb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,10 @@ uint8_t net_if_ipv6_get_mcast_hop_limit(struct net_if *iface)

net_if_lock(iface);

if (net_if_config_ipv6_get(iface, NULL) < 0) {
goto out;
}

if (!iface->config.ip.ipv6) {
goto out;
}
Expand All @@ -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)
net_if_lock(iface);

if (net_if_config_ipv6_get(iface, NULL) < 0) {
goto out;
}

if (!iface->config.ip.ipv6) {
goto out;
}
Expand All @@ -2690,6 +2698,10 @@ uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface)

net_if_lock(iface);

if (net_if_config_ipv6_get(iface, NULL) < 0) {
goto out;
}

if (!iface->config.ip.ipv6) {
goto out;
}
Expand All @@ -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)
net_if_lock(iface);

if (net_if_config_ipv6_get(iface, NULL) < 0) {
goto out;
}

if (!iface->config.ip.ipv6) {
goto out;
}
Expand Down

0 comments on commit 2a880cb

Please sign in to comment.