From 1aa12235625ae765c59d76b48c0ab17942fd44e2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 16 Dec 2010 12:56:02 +0000 Subject: [PATCH] dnsproxy: Rename 'len' field in request_data Let's make it clear it's a sockaddr len. --- plugins/dnsproxy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index 9bc080c..756dd15 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -99,9 +99,9 @@ struct server_data { struct request_data { struct sockaddr_in sin; + socklen_t sa_len; int client_sk; int protocol; - socklen_t len; guint16 srcid; guint16 dstid; guint16 altid; @@ -226,7 +226,7 @@ static gboolean request_timeout(gpointer user_data) sk = g_io_channel_unix_get_fd(udp_listener_channel); err = sendto(sk, req->resp, req->resplen, 0, - (struct sockaddr *) &req->sin, req->len); + (struct sockaddr *) &req->sin, req->sa_len); } else if (req->request && req->numserv == 0) { struct domain_hdr *hdr; @@ -420,7 +420,7 @@ static int forward_dns_reply(unsigned char *reply, int reply_len, int protocol) if (protocol == IPPROTO_UDP) { sk = g_io_channel_unix_get_fd(udp_listener_channel); err = sendto(sk, req->resp, req->resplen, 0, - (struct sockaddr *) &req->sin, req->len); + (struct sockaddr *) &req->sin, req->sa_len); } else { sk = req->client_sk; err = send(sk, req->resp, req->resplen, 0); @@ -1126,9 +1126,9 @@ static gboolean tcp_listener_event(GIOChannel *channel, GIOCondition condition, return TRUE; memcpy(&req->sin, (struct sockaddr_in *)&client_addr, sizeof(req->sin)); + req->sa_len = client_addr_len; req->client_sk = client_sk; req->protocol = IPPROTO_TCP; - req->len = client_addr_len; request_id += 2; if (request_id == 0x0000 || request_id == 0xffff) @@ -1237,9 +1237,9 @@ static gboolean udp_listener_event(GIOChannel *channel, GIOCondition condition, return TRUE; memcpy(&req->sin, &sin, sizeof(sin)); + req->sa_len = size; req->client_sk = 0; req->protocol = IPPROTO_UDP; - req->len = size; request_id += 2; if (request_id == 0x0000 || request_id == 0xffff) -- 2.7.4