… | |
… | |
40 | host = 0; |
40 | host = 0; |
41 | port = prot == PROT_UDPv4 ? htons (conf->udp_port) |
41 | port = prot == PROT_UDPv4 ? htons (conf->udp_port) |
42 | : prot == PROT_TCPv4 ? htons (conf->tcp_port) |
42 | : prot == PROT_TCPv4 ? htons (conf->tcp_port) |
43 | : 0; |
43 | : 0; |
44 | |
44 | |
|
|
45 | if (prot & (PROT_UDPv4 | PROT_TCPv4 | PROT_IPv4) |
45 | if (prot && conf->hostname) |
46 | && conf->hostname) |
46 | { |
47 | { |
47 | struct hostent *he = gethostbyname (conf->hostname); |
48 | struct hostent *he = gethostbyname (conf->hostname); |
48 | |
49 | |
49 | if (he |
50 | if (he |
50 | && he->h_addrtype == AF_INET && he->h_length == 4 && he->h_addr_list[0]) |
51 | && he->h_addrtype == AF_INET && he->h_length == 4 && he->h_addr_list[0]) |
51 | { |
52 | { |
52 | //sa->sin_family = he->h_addrtype; |
53 | //sa->sin_family = he->h_addrtype; |
53 | memcpy (&host, he->h_addr_list[0], 4); |
54 | memcpy (&host, he->h_addr_list[0], 4); |
54 | |
|
|
55 | } |
55 | } |
56 | else |
56 | else |
57 | slog (L_NOTICE, _("unable to resolve host '%s'"), conf->hostname); |
57 | slog (L_NOTICE, _("unable to resolve host '%s'"), conf->hostname); |
58 | } |
58 | } |
59 | } |
59 | } |