/*
* Copyright (C) 2000, 2001 Nominum, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (C) 2004 - 2015 Nominum, Inc.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice and this permission notice
* appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/sockaddr.h>
#include <bind9/getaddresses.h>
#include "log.h"
#include "net.h"
#include "opt.h"
int
{
return AF_UNSPEC;
return AF_INET;
#ifdef AF_INET6
return AF_INET6;
#endif
else {
exit(1);
}
}
void
{
int count, i;
if (port == 0) {
exit(1);
}
count = 0;
if (result == ISC_R_SUCCESS) {
for (i = 0; i < count; i++) {
{
return;
}
}
}
exit(1);
}
void
{
} else {
exit(1);
}
}
int
{
int family;
int sock;
int port;
int ret;
int flags;
perf_log_fatal("server and local addresses have "
"different families");
if (sock == -1)
#if defined(AF_INET6) && defined(IPV6_V6ONLY)
perf_log_warning("setsockopt(IPV6_V6ONLY) failed");
}
}
#endif
if (port >= 0xFFFF)
}
if (bufsize > 0) {
bufsize *= 1024;
if (ret < 0)
perf_log_warning("setsockbuf(SO_RCVBUF) failed");
if (ret < 0)
perf_log_warning("setsockbuf(SO_SNDBUF) failed");
}
if (flags < 0)
perf_log_fatal("fcntl(F_GETFL)");
if (ret < 0)
perf_log_fatal("fcntl(F_SETFL)");
return sock;
}