#include "version.h"
#include <arpa/inet.h>
-#include <arpa/nameser.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
-#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* a non-null pointer, otherwise reply will be null.
* if successful start the connection, otherwise notify opers
*/
-static void connect_dns_callback(void* vptr, struct hostent* hp)
+static void connect_dns_callback(void* vptr, struct DNSReply* hp)
{
struct ConfItem* aconf = (struct ConfItem*) vptr;
assert(aconf);
aconf->dns_pending = 0;
if (hp) {
- memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr));
+ struct sockaddr_in *sin = (struct sockaddr_in*)&hp->addr;
+ memcpy(&aconf->ipnum, &sin->sin_addr, sizeof(struct in_addr));
MyFree(hp);
connect_server(aconf, 0);
}
/*
* we want a big buffer for server connections
*/
- if (!os_set_sockbufs(cli_fd(cptr), SERVER_TCP_WINDOW)) {
+ if (!os_set_sockbufs(cli_fd(cptr), feature_int(FEAT_SOCKSENDBUF), feature_int(FEAT_SOCKRECVBUF))) {
cli_error(cptr) = errno;
report_error(SETBUFS_ERROR_MSG, cli_name(cptr), errno);
close(cli_fd(cptr));
assert(MyConnect(cptr));
if (cli_dns_reply(cptr)) {
+ MyFree(cli_dns_reply(cptr)->h_name);
MyFree(cli_dns_reply(cptr));
cli_dns_reply(cptr) = 0;
}
assert(0 != ev_socket(ev));
assert(0 != s_data(ev_socket(ev)));
- con = s_data(ev_socket(ev));
+ con = (struct Connection*) s_data(ev_socket(ev));
assert(0 != con_client(con) || ev_type(ev) == ET_DESTROY);
assert(0 != t_data(ev_timer(ev)));
assert(ET_DESTROY == ev_type(ev) || ET_EXPIRE == ev_type(ev));
- con = t_data(ev_timer(ev));
+ con = (struct Connection*) t_data(ev_timer(ev));
assert(0 != con_client(con) || ev_type(ev) == ET_DESTROY);