network: revert previous changes to address_compare_func()
This partially reverts fe841414 and
2a236f9f.
For IPv4, kernel compares the local address, prefix, and prefixlen.
For IPv6, kernel compares only the local address.
Let's follow the kernel's comparison way.
Fixes #17831.