diff options
author | Martin Pool <mbp@samba.org> | 2001-12-05 13:25:29 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2001-12-05 13:25:29 +0000 |
commit | d91c8c50d22f086a48c1cb4c275b0669278ef714 (patch) | |
tree | 1e465dd77d35dc606b62aac7ee096f7bf6fff5c7 /socket.c | |
parent | e20a4f84d6f42b2a95471e424c27f940b958bc9f (diff) | |
download | rsync-d91c8c50d22f086a48c1cb4c275b0669278ef714.tar.gz |
RFC2553 just says that sockaddr_storage has to have initial fields
isomorphic to sa_family etc from a struct sockaddr, not what they're
called. On some platforms they seem not to be called ss_family.
Rather than guess, we will try casting to a sockaddr and looking
through that -- I think this is what the RFC intends.
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -578,6 +578,12 @@ char *client_addr(int fd) } +static sa_family_t get_sockaddr_family(const struct sockaddr_storage *ss) +{ + return ((struct sockaddr *) ss)->sa_family; +} + + /** * Return the DNS name of the client **/ @@ -606,7 +612,7 @@ char *client_name(int fd) } #ifdef INET6 - if (ss.ss_family == AF_INET6 && + if (get_sockaddr_family(&ss) == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&ss)->sin6_addr)) { struct sockaddr_in6 sin6; struct sockaddr_in *sin; @@ -650,7 +656,7 @@ char *client_name(int fd) /* XXX sin6_flowinfo and other fields */ for (res = res0; res; res = res->ai_next) { - if (res->ai_family != ss.ss_family) + if (res->ai_family != get_sockaddr_family(&ss)) continue; if (res->ai_addrlen != length) continue; |