Skip to content

Commit

Permalink
net: if: Add ASSERT in net_if_ipv4/6_select_src_addr
Browse files Browse the repository at this point in the history
Add an assert for the destination address provided to find the best
source address.

(cherry picked from commit cb4fb76)

Original-Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
GitOrigin-RevId: cb4fb76
Change-Id: Ib7b22f0c6ed734c838fa27474f4931514a63c80a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4894342
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Al Semjonovs <asemjonovs@google.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Al Semjonovs <asemjonovs@google.com>
  • Loading branch information
pdgendt authored and Chromeos LUCI committed Sep 26, 2023
1 parent be7026e commit 1602698
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,8 @@ const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *dst_iface,
const struct in6_addr *src = NULL;
uint8_t best_match = 0U;

NET_ASSERT(dst);

if (!net_ipv6_is_ll_addr(dst) && !net_ipv6_is_addr_mcast_link(dst)) {
/* If caller has supplied interface, then use that */
if (dst_iface) {
Expand Down Expand Up @@ -3405,6 +3407,8 @@ const struct in_addr *net_if_ipv4_select_src_addr(struct net_if *dst_iface,
const struct in_addr *src = NULL;
uint8_t best_match = 0U;

NET_ASSERT(dst);

if (!net_ipv4_is_ll_addr(dst)) {

/* If caller has supplied interface, then use that */
Expand Down

0 comments on commit 1602698

Please sign in to comment.