aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_dns.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-12 15:41:16 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-12 15:41:16 +0000
commite9b343c6b5776ac9884cb07117bfd08f29cd9e13 (patch)
treee3f3a3f1efa2306392110ec222364fff5e0b08b2 /src/lua/lua_dns.c
parentc4141a343c927e2df8819dbbd9ddffab92901265 (diff)
downloadrspamd-e9b343c6b5776ac9884cb07117bfd08f29cd9e13.tar.gz
rspamd-e9b343c6b5776ac9884cb07117bfd08f29cd9e13.zip
Adopt lua-ip for new inet_addr.
Diffstat (limited to 'src/lua/lua_dns.c')
-rw-r--r--src/lua/lua_dns.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index d06dc46fa..31d17b103 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -91,7 +91,7 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
gint i = 0;
struct rspamd_dns_resolver **presolver;
struct rdns_reply_entry *elt;
- rspamd_inet_addr_t addr;
+ rspamd_inet_addr_t *addr;
lua_rawgeti (cd->L, LUA_REGISTRYINDEX, cd->cbref);
presolver = lua_newuserdata (cd->L, sizeof (gpointer));
@@ -109,19 +109,13 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
{
switch (elt->type) {
case RDNS_REQUEST_A:
- addr.af = AF_INET;
- addr.slen = sizeof (addr.addr.s4);
- memcpy (&addr.addr.s4.sin_addr, &elt->content.a.addr,
- sizeof (addr.addr.s4.sin_addr));
- rspamd_lua_ip_push (cd->L, &addr);
+ addr = rspamd_inet_address_new (AF_INET, &elt->content.a.addr);
+ rspamd_lua_ip_push (cd->L, addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_AAAA:
- addr.af = AF_INET6;
- addr.slen = sizeof (addr.addr.s6);
- memcpy (&addr.addr.s6.sin6_addr, &elt->content.aaa.addr,
- sizeof (addr.addr.s6.sin6_addr));
- rspamd_lua_ip_push (cd->L, &addr);
+ addr = rspamd_inet_address_new (AF_INET6, &elt->content.aaa.addr);
+ rspamd_lua_ip_push (cd->L, addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_PTR: