rem: for (si=udp_listen; si; si=si->next) { switch(from.s.sa_family) { case AF_INET: if (si->address.af!=AF_INET) continue; if (memcmp(&si->address.u, &from.sin.sin_addr, si->address.len)==0) goto found;  break; #if defined(USE_IPV6) case AF_INET6: if (si->address.af!=AF_INET6) continue; if (memcmp(&si->address.u, &from.sin6.sin6_addr, len)==0) goto found; continue; #endif default:	LOG(L_ERR, "ERROR: get_out_socket: " "unknown family: %d\n", from.s.sa_family); goto error; } }
add: su2ip_addr(&ip, &from); si=find_si(&ip, 0, proto); if (si==0) goto error; close(temp_sock); DBG("DEBUG: get_out_socket: socket determined: %p\n", si ); return si;
context: struct socket_info* get_out_socket(union sockaddr_union* to, int proto){	int temp_sock;	socklen_t len;	union sockaddr_union from; 	struct socket_info* si;	if (proto!=PROTO_UDP) {		LOG(L_CRIT, "BUG: get_out_socket can only be called for UDP\n");		return 0;	}		temp_sock=socket(to->s.sa_family, SOCK_DGRAM, 0 );	if (temp_sock==-1) {		LOG(L_ERR, "ERROR: get_out_socket: socket() failed: %s\n",				strerror(errno));		return 0;	}	if (connect(temp_sock, &to->s, sockaddru_len(*to))==-1) {		LOG(L_ERR, "ERROR: get_out_socket: connect failed: %s\n",				strerror(errno));		goto error;	}	len=sizeof(from);	if (getsockname(temp_sock, &from.s, &len)==-1) {		LOG(L_ERR, "ERROR: get_out_socket: getsockname failed: %s\n",				strerror(errno));		goto error;	}	for (si=udp_listen; si; si=si->next) {		switch(from.s.sa_family) {			case AF_INET:							if (si->address.af!=AF_INET)								continue;						if (memcmp(&si->address.u,								&from.sin.sin_addr, 								si->address.len)==0)							goto found; /*  success */						break;#if defined(USE_IPV6)			case AF_INET6:							if (si->address.af!=AF_INET6)								continue;						if (memcmp(&si->address.u,								&from.sin6.sin6_addr, len)==0)							goto found;						continue;#endif			default:	LOG(L_ERR, "ERROR: get_out_socket: "									"unknown family: %d\n",									from.s.sa_family);						goto error;		}	}error:	LOG(L_ERR, "ERROR: get_out_socket: no socket found\n");	close(temp_sock);	return 0;found:	close(temp_sock);	DBG("DEBUG: get_out_socket: socket determined: %p\n", si );	return si;}