mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 00:29:20 +02:00
Set correct sockaddr length when sending
Fix EINVAL error on NetBSD
This commit is contained in:
parent
b715be5cf3
commit
eec0a868d9
|
@ -63,6 +63,7 @@ static int running;
|
||||||
static const char *password;
|
static const char *password;
|
||||||
|
|
||||||
static struct sockaddr_storage nameserv;
|
static struct sockaddr_storage nameserv;
|
||||||
|
static int nameserv_len;
|
||||||
static struct sockaddr_in raw_serv;
|
static struct sockaddr_in raw_serv;
|
||||||
static const char *topdomain;
|
static const char *topdomain;
|
||||||
|
|
||||||
|
@ -153,6 +154,7 @@ void
|
||||||
client_set_nameserver(struct sockaddr_storage *addr, int addrlen)
|
client_set_nameserver(struct sockaddr_storage *addr, int addrlen)
|
||||||
{
|
{
|
||||||
memcpy(&nameserv, addr, addrlen);
|
memcpy(&nameserv, addr, addrlen);
|
||||||
|
nameserv_len = addrlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -270,7 +272,7 @@ send_query(int fd, char *hostname)
|
||||||
fprintf(stderr, " Sendquery: id %5d name[0] '%c'\n", q.id, hostname[0]);
|
fprintf(stderr, " Sendquery: id %5d name[0] '%c'\n", q.id, hostname[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sendto(fd, packet, len, 0, (struct sockaddr*)&nameserv, sizeof(nameserv));
|
sendto(fd, packet, len, 0, (struct sockaddr*)&nameserv, nameserv_len);
|
||||||
|
|
||||||
/* There are DNS relays that time out quickly but don't send anything
|
/* There are DNS relays that time out quickly but don't send anything
|
||||||
back on timeout.
|
back on timeout.
|
||||||
|
|
Loading…
Reference in New Issue