Skip to content

Commit

Permalink
[nrf fromtree] net: ipv6: scope checking function fix
Browse files Browse the repository at this point in the history
Change the implementation of net_ipv6_is_addr_mcast_scope() inline
function that let us check if a given IPv6 address has a specified
scope. Previously, it was comparing the whole byte including flags
of a multicast address. It meant, that while checking for a specific
scope a one was also checking the flags. Even in Zephyr's net stack
there are checks for a IPv6 link local scope that are failing for
addresses that are not marked as "well known" (when least significant
bit of the flags is set).

Signed-off-by: Konrad Derda <[email protected]>
(cherry picked from commit 6788de11878a55d3dd37a4a331a80863e34cb0d5)
  • Loading branch information
kderda authored and nordicjm committed Jul 25, 2024
1 parent 2fbc694 commit 85665b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/zephyr/net/net_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ static inline bool net_ipv6_is_addr_solicited_node(const struct in6_addr *addr)
static inline bool net_ipv6_is_addr_mcast_scope(const struct in6_addr *addr,
int scope)
{
return (addr->s6_addr[0] == 0xff) && (addr->s6_addr[1] == scope);
return (addr->s6_addr[0] == 0xff) && ((addr->s6_addr[1] & 0xF) == scope);
}

/**
Expand Down

0 comments on commit 85665b2

Please sign in to comment.