Skip to content

Commit 85665b2

Browse files
kderdanordicjm
authored andcommitted
[nrf fromtree] net: ipv6: scope checking function fix
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)
1 parent 2fbc694 commit 85665b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/zephyr/net/net_ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ static inline bool net_ipv6_is_addr_solicited_node(const struct in6_addr *addr)
11221122
static inline bool net_ipv6_is_addr_mcast_scope(const struct in6_addr *addr,
11231123
int scope)
11241124
{
1125-
return (addr->s6_addr[0] == 0xff) && (addr->s6_addr[1] == scope);
1125+
return (addr->s6_addr[0] == 0xff) && ((addr->s6_addr[1] & 0xF) == scope);
11261126
}
11271127

11281128
/**

0 commit comments

Comments
 (0)