diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-04-30 16:42:29 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-04-30 16:42:29 +0200 |
commit | ba7c93085b419d1453dfb722b570245c4a725c83 (patch) | |
tree | 03d94fe8a02bd209737433f4b3ad9c47f4e21fcf /src | |
parent | 233f169f507e31472b23a64269878557d6f0f9fe (diff) | |
download | dns-ba7c93085b419d1453dfb722b570245c4a725c83.tar.gz |
now returns static A record
Diffstat (limited to 'src')
-rw-r--r-- | src/dns.h | 2 | ||||
-rw-r--r-- | src/server.c | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -124,7 +124,7 @@ struct dns_question { }; struct dns_answer { - char* qname; //in qname format + const char* qname; //in qname format int qname_len; uint16_t type; diff --git a/src/server.c b/src/server.c index 3ec6603..1dc65a0 100644 --- a/src/server.c +++ b/src/server.c @@ -95,19 +95,19 @@ int handle_connection ( int _socket, if(msg.question_count > 0) { char out[128]; qname_to_fqdn( (char*) msg.question[0].qname, 100, out, 128); - printf("%s %i\n", out, msg.question[0].qtype); + LOGPRINTF(_LOG_DEBUG, "Request for %s QTYPE %i", out, msg.question[0].qtype); } //Always return NXDOMAIN - struct dns_question quest = & msg.question[0]; + struct dns_question* quest = & msg.question[0]; - struct dns_header head = {msg.header.id,1,OP_Q,0,0,0,0,0,dns_responsecode.NOERR,0,0,0,0}; - struct dns_answer answ = {quest->qname, quest->qname_len, } + struct dns_header head = {msg.header.id,1,OP_Q,0,0,0,0,0,RCODE_NOERR,0,1,0,0}; + struct dns_answer answ = {quest->qname, quest->qname_len, RR_A, CL_IN, 69, 4, "aaa" }; char ret[512]; int hlen = dns_construct_header ( ret, 512, &head ); - int alen = dns_construct_answer ( ret + hlen, 512-hlen, &answer ); + int alen = dns_construct_answer ( ret + hlen, 512-hlen, &answ ); sendto (_socket, ret, hlen + alen, 0, (struct sockaddr*) sockaddr_client, sockaddr_client_len); dns_destroy_struct ( &msg ); |