]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common: fix segfault in public IPv6 addr picking 14323/head
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 22 Mar 2017 15:13:50 +0000 (16:13 +0100)
committerShinobu Kinjo <shinobu@redhat.com>
Tue, 4 Apr 2017 16:11:19 +0000 (01:11 +0900)
commitc2cc96e6c19c77d0ea13e8a015d0dfa66ba1b304
treecf9aaba619963560eab388c51133bb1641696280
parentce8edcfed6cd908779efd229202eab1232d16f1c
common: fix segfault in public IPv6 addr picking

sockaddr is only 16 bytes big, so declaring net as sockaddr
and then casting to sockaddr_in6 in case of IPv6 cannot
work.

using sockaddr_storage works for both IPv4 and IPv6, and is
used in other code parts as well.

note that the tests did not find this issue as they declared
the bigger structs and casted the references to (sockaddr *)

Fixes: http://tracker.ceph.com/issues/19371
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
(cherry picked from commit ae2ee3d3835fe25b35eeb1a841ee5234cd69eb65)
src/common/ipaddr.cc
src/common/pick_address.cc
src/include/ipaddr.h
src/test/test_ipaddr.cc