static int
get_addr_generic(sa_family_t af, unsigned int flags, const char *hostname,
void *network, unsigned int *netbits,
- int resolve_retry_seconds, volatile int *signal_received,
+ int resolve_retry_seconds, struct signal_info *sig_info,
int msglevel)
{
char *endp, *sep, *var_host = NULL;
}
ret = openvpn_getaddrinfo(flags & ~GETADDR_HOST_ORDER, var_host, NULL,
- resolve_retry_seconds, signal_received, af, &ai);
+ resolve_retry_seconds, sig_info, af, &ai);
if ((ret == 0) && network)
{
struct in6_addr *ip6;
const char *hostname,
int resolve_retry_seconds,
bool *succeeded,
- volatile int *signal_received)
+ struct signal_info *sig_info)
{
in_addr_t addr;
int status;
status = get_addr_generic(AF_INET, flags, hostname, &addr, NULL,
- resolve_retry_seconds, signal_received,
+ resolve_retry_seconds, sig_info,
M_WARN);
if (status==0)
{
const char *hostname,
const char *servname,
int resolve_retry_seconds,
- volatile int *signal_received,
+ struct signal_info *sig_info,
int ai_family,
struct addrinfo **res)
{
struct addrinfo hints;
int status;
- int sigrec = 0;
+ struct signal_info sigrec = {0};
int msglevel = (flags & GETADDR_FATAL) ? M_FATAL : D_RESOLVE_ERRORS;
struct gc_arena gc = gc_new();
const char *print_hostname;
}
if ((flags & (GETADDR_FATAL_ON_SIGNAL|GETADDR_WARN_ON_SIGNAL))
- && !signal_received)
+ && !sig_info)
{
- signal_received = &sigrec;
+ sig_info = &sigrec;
}
/* try numeric ipv6 addr first */
flags, hints.ai_family, hints.ai_socktype);
status = getaddrinfo(hostname, servname, &hints, res);
- if (signal_received)
+ if (sig_info)
{
- get_signal(signal_received);
- if (*signal_received) /* were we interrupted by a signal? */
+ get_signal(&sig_info->signal_received);
+ if (sig_info->signal_received) /* were we interrupted by a signal? */
{
- if (*signal_received == SIGUSR1) /* ignore SIGUSR1 */
+ /* why are we overwriting SIGUSR1 ? */
+ if (sig_info->signal_received == SIGUSR1) /* ignore SIGUSR1 */
{
msg(level,
"RESOLVE: Ignored SIGUSR1 signal received during "
"DNS resolution attempt");
- *signal_received = 0;
+ signal_reset(sig_info);
}
else
{
}
done:
- if (signal_received && *signal_received)
+ if (sig_info && sig_info->signal_received)
{
int level = 0;
if (flags & GETADDR_FATAL_ON_SIGNAL)
if (status)
{
status = openvpn_getaddrinfo(flags, sock->remote_host, sock->remote_port,
- retry, signal_received, sock->info.af, &ai);
+ retry, sig_info, sock->info.af, &ai);
}
if (status == 0)