X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=net.c;h=503e4de955c54fe9ef2f99150b62fe9172503852;hp=2ec3f03e546b3b1f3c038b7eea2e9cf8cf8a3438;hb=ba63b662dc6bd44a759837b67c34e0aa2b398b8e;hpb=79d6515d49cdb0a91ff7c4a599f2d63cb5678032 diff --git a/net.c b/net.c index 2ec3f03e..503e4de9 100644 --- a/net.c +++ b/net.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2013 Andre Noll + * Copyright (C) 2005-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -672,19 +672,19 @@ char *remote_name(int sockfd) /** * Extract IPv4 or IPv6-mapped-IPv4 address from sockaddr_storage. - * \param ss Container of IPv4/6 address - * \return Extracted IPv4 address (different from 0) or 0 if unsuccessful. * - * \sa RFC 3493 + * \param ss Container of IPv4/6 address. + * \param ia Extracted IPv4 address (different from 0) or 0 if unsuccessful. + * + * \sa RFC 3493. */ -struct in_addr extract_v4_addr(const struct sockaddr_storage *ss) +void extract_v4_addr(const struct sockaddr_storage *ss, struct in_addr *ia) { - struct in_addr ia = {.s_addr = 0}; const struct sockaddr *sa = normalize_ip_address(ss); + memset(ia, 0, sizeof(*ia)); if (sa->sa_family == AF_INET) - ia = ((struct sockaddr_in *)sa)->sin_addr; - return ia; + *ia = ((struct sockaddr_in *)sa)->sin_addr; } /**