]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/pick_address: Add IPv6 support to is_addr_in_subnet
authorNitzan Mordechai <nmordech@redhat.com>
Thu, 28 Nov 2024 11:44:00 +0000 (11:44 +0000)
committerYuri Weinstein <yweinste@redhat.com>
Tue, 15 Apr 2025 17:38:22 +0000 (17:38 +0000)
commit8c9d12da9ab3c8e80bab850c4599cf39b830f1b7
tree08f4892e8d6d4e27ad5c97590da9fcad989b153a
parent233bf4505d5ae187372f7b16e0f9b8730a8e6b63
common/pick_address: Add IPv6 support to is_addr_in_subnet

Updated the is_addr_in_subnet function to work with both
IPv4 and IPv6 addresses. Previously, it only supported IPv4,
which caused failures when IPv6 addresses were passed in.

Changes:
 - Use inet_pton to detect IPv4 (AF_INET) or IPv6 (AF_INET6).
 - Added sockaddr_in6 for IPv6 handling while keeping sockaddr_in for IPv4.
 - Adjust the family and ifa_addr dynamically based on the address type.

Fixes: https://tracker.ceph.com/issues/67517
Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
(cherry picked from commit d68857c1e57e93a68d9301b3beff7e652f327a9e)
(cherry picked from commit 23a110bfbaf886aeb14f3a3147f429a9cf86b70c)
src/common/pick_address.cc
src/common/pick_address.h
src/osd/OSDMap.cc
src/test/test_ipaddr.cc