Remove unused hostname resolution in shm plugins and aserver

PCM and control shm plugins and aserver have some codes to resolve the
host address and check whether it's a local host although the given
address is never used.  In addition, the code contains gethostbyname()
that is known to be obsoleted.  So, let's get rid of all these unused
codes.

The host configuration item is still accepted (but just ignored) for
keeping the compatibility.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2015-01-28 16:21:14 +01:00
parent 6ea14c3624
commit dbb7eca655
5 changed files with 6 additions and 175 deletions

View file

@ -106,58 +106,4 @@ int snd_receive_fd(int sock, void *data, size_t len, int *fd)
*fd = *fds;
return ret;
}
int snd_is_local(struct hostent *hent)
{
int s;
int err;
struct ifconf conf;
size_t numreqs = 10;
size_t i;
struct in_addr *haddr = (struct in_addr*) hent->h_addr_list[0];
s = socket(PF_INET, SOCK_STREAM, 0);
if (s < 0) {
SYSERR("socket failed");
return -errno;
}
conf.ifc_len = numreqs * sizeof(struct ifreq);
conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
if (! conf.ifc_buf) {
close(s);
return -ENOMEM;
}
while (1) {
err = ioctl(s, SIOCGIFCONF, &conf);
if (err < 0) {
SYSERR("SIOCGIFCONF failed");
close(s);
return -errno;
}
if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq))
break;
numreqs *= 2;
conf.ifc_len = numreqs * sizeof(struct ifreq);
conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
if (! conf.ifc_buf) {
close(s);
return -ENOMEM;
}
}
numreqs = conf.ifc_len / sizeof(struct ifreq);
for (i = 0; i < numreqs; ++i) {
struct ifreq *req = &conf.ifc_req[i];
struct sockaddr_in *s_in = (struct sockaddr_in *)&req->ifr_addr;
s_in->sin_family = AF_INET;
err = ioctl(s, SIOCGIFADDR, req);
if (err < 0)
continue;
if (haddr->s_addr == s_in->sin_addr.s_addr)
break;
}
close(s);
free(conf.ifc_buf);
return i < numreqs;
}
#endif