Skip to content
Commit 68241fb1 authored by Robert Lubos's avatar Robert Lubos Committed by Benjamin Cabé
Browse files

net: ipv4: Filter the subnet part of the IPv4 addr when choosing src



Bit-wise comparing of the entire IPv4 addresses doesn't make much sense
as when selecting the source address for communication, what really
matters is the subnet part.

Doing so may actually lead to unexpected results, i. e. two addresses
within the same subnet should be considered equally good for
communication within the subnet, yet comparing the unique part of
the address (beyond the netmask) may lead to different results.
This is a problem for the mechanism of preferring the default interface
for LL communication if two interfaces have LL addresses with the
default subnet mask.

Fix this by filtering out the subnet from the IPv4 address before
passing it to net_if_ipv4_get_best_match() function.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent 0ee17d9a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment