X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=udp_recv.c;h=45d24eae2cd40e9ee4b53106b92ccb85c779dc85;hp=5520c6fb65b29f9d12575b211cb990dd53e7d8d3;hb=bda95f9508b456dcea89d300f6d4104e30ab9f3e;hpb=ffb2eaa90429f6d5c3d369509efcdf91c5463dad diff --git a/udp_recv.c b/udp_recv.c index 5520c6fb..45d24eae 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -1,12 +1,11 @@ /* - * Copyright (C) 2005-2010 Andre Noll + * Copyright (C) 2005-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file udp_recv.c Paraslash's udp receiver */ #include -#include #include #include @@ -142,9 +141,11 @@ static int mcast_receiver_setup(int fd, const char *iface) if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) goto err; + assert(ss.ss_family == AF_INET || ss.ss_family == AF_INET6); if (iface != NULL && id == 0) - PARA_WARNING_LOG("could not resolve interface %s, using default", iface); + PARA_WARNING_LOG("could not resolve interface %s, using default\n", + iface); switch (ss.ss_family) { case AF_INET: @@ -159,12 +160,13 @@ static int mcast_receiver_setup(int fd, const char *iface) m4.imr_interface.s_addr = INADDR_ANY; if (id != 0) - PARA_ERROR_LOG("Setting IPv4 receiver mcast interface not supported."); + PARA_ERROR_LOG("Setting IPv4 receiver mcast interface not supported\n"); #endif - m4.imr_multiaddr = ((struct sockaddr_in *)&ss)->sin_addr; + m4.imr_multiaddr = ((struct sockaddr_in *)&ss)->sin_addr; - if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &m4, sizeof(m4)) < 0) + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + &m4, sizeof(m4)) < 0) break; } return 0; @@ -179,9 +181,6 @@ static int mcast_receiver_setup(int fd, const char *iface) break; } return 0; - default: - PARA_ERROR_LOG("address family %d not supported", ss.ss_family); - return -E_ADDRESS_LOOKUP; } err: return -ERRNO_TO_PARA_ERROR(errno);