s4-ipv6: update callers to load_interface_list()
[metze/samba/wip.git] / source4 / dns_server / dns_server.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    DNS server startup
5
6    Copyright (C) 2010 Kai Blin  <kai@samba.org>
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "includes.h"
23 #include "smbd/service_task.h"
24 #include "smbd/service.h"
25 #include "smbd/service_stream.h"
26 #include "smbd/process_model.h"
27 #include "lib/events/events.h"
28 #include "lib/socket/socket.h"
29 #include "lib/tsocket/tsocket.h"
30 #include "libcli/util/tstream.h"
31 #include "libcli/util/ntstatus.h"
32 #include "system/network.h"
33 #include "lib/stream/packet.h"
34 #include "lib/socket/netif.h"
35 #include "dns_server/dns_server.h"
36 #include "param/param.h"
37 #include "librpc/ndr/libndr.h"
38 #include "librpc/gen_ndr/ndr_dns.h"
39 #include "librpc/gen_ndr/ndr_dnsp.h"
40 #include <ldb.h>
41 #include "dsdb/samdb/samdb.h"
42 #include "dsdb/common/util.h"
43 #include "auth/session.h"
44 #include "lib/util/dlinklist.h"
45
46 NTSTATUS server_service_dns_init(void);
47
48 /* hold information about one dns socket */
49 struct dns_socket {
50         struct dns_server *dns;
51         struct tsocket_address *local_address;
52 };
53
54 struct dns_udp_socket {
55         struct dns_socket *dns_socket;
56         struct tdgram_context *dgram;
57         struct tevent_queue *send_queue;
58 };
59
60 /*
61   state of an open tcp connection
62 */
63 struct dns_tcp_connection {
64         /* stream connection we belong to */
65         struct stream_connection *conn;
66
67         /* the dns_server the connection belongs to */
68         struct dns_socket *dns_socket;
69
70         struct tstream_context *tstream;
71
72         struct tevent_queue *send_queue;
73 };
74
75 static void dns_tcp_terminate_connection(struct dns_tcp_connection *dnsconn, const char *reason)
76 {
77         stream_terminate_connection(dnsconn->conn, reason);
78 }
79
80 static void dns_tcp_recv(struct stream_connection *conn, uint16_t flags)
81 {
82         struct dns_tcp_connection *dnsconn = talloc_get_type(conn->private_data,
83                                                              struct dns_tcp_connection);
84         /* this should never be triggered! */
85         dns_tcp_terminate_connection(dnsconn, "dns_tcp_recv: called");
86 }
87
88 static void dns_tcp_send(struct stream_connection *conn, uint16_t flags)
89 {
90         struct dns_tcp_connection *dnsconn = talloc_get_type(conn->private_data,
91                                                              struct dns_tcp_connection);
92         /* this should never be triggered! */
93         dns_tcp_terminate_connection(dnsconn, "dns_tcp_send: called");
94 }
95
96 static NTSTATUS dns_process(struct dns_server *dns,
97                             TALLOC_CTX *mem_ctx,
98                             DATA_BLOB *in,
99                             DATA_BLOB *out)
100 {
101         enum ndr_err_code ndr_err;
102         WERROR ret;
103         struct dns_name_packet *in_packet;
104         struct dns_name_packet *out_packet;
105         struct dns_res_rec *answers = NULL, *nsrecs = NULL, *additional = NULL;
106         uint16_t num_answers = 0 , num_nsrecs = 0, num_additional = 0;
107
108         if (in->length < 12) {
109                 return NT_STATUS_INVALID_PARAMETER;
110         }
111
112         in_packet = talloc_zero(mem_ctx, struct dns_name_packet);
113         /* TODO: We don't really need an out_packet. */
114         out_packet = talloc_zero(mem_ctx, struct dns_name_packet);
115
116         if (in_packet == NULL) return NT_STATUS_NO_MEMORY;
117         if (out_packet == NULL) return NT_STATUS_NO_MEMORY;
118
119         dump_data(2, in->data, in->length);
120
121         ndr_err = ndr_pull_struct_blob(in, in_packet, in_packet,
122                         (ndr_pull_flags_fn_t)ndr_pull_dns_name_packet);
123         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
124                 TALLOC_FREE(in_packet);
125                 DEBUG(0, ("Failed to parse packet %d!\n", ndr_err));
126                 *out = *in;
127
128                 out->data[2] |= 0x80; /* Toggle DNS_FLAG_REPLY */
129                 out->data[3] |= DNS_RCODE_FORMERR;
130
131                 return NT_STATUS_OK;
132         }
133
134         NDR_PRINT_DEBUG(dns_name_packet, in_packet);
135         *out_packet = *in_packet;
136         out_packet->operation |= DNS_FLAG_REPLY;
137
138         switch (in_packet->operation & DNS_OPCODE) {
139         case DNS_OPCODE_QUERY:
140
141                 ret = dns_server_process_query(dns, out_packet, in_packet,
142                                                &answers, &num_answers,
143                                                &nsrecs,  &num_nsrecs,
144                                                &additional, &num_additional);
145
146                 break;
147         case DNS_OPCODE_REGISTER:
148                 ret = dns_server_process_update(dns, out_packet, in_packet,
149                                                 answers, num_answers,
150                                                 &nsrecs,  &num_nsrecs,
151                                                 &additional, &num_additional);
152                 break;
153         default:
154                 ret = WERR_DNS_ERROR_RCODE_NOT_IMPLEMENTED;
155                 break;
156         }
157
158         if (W_ERROR_IS_OK(ret)) {
159                 out_packet->ancount = num_answers;
160                 out_packet->answers = answers;
161
162                 out_packet->nscount = num_nsrecs;
163                 out_packet->nsrecs  = nsrecs;
164
165                 out_packet->arcount = num_additional;
166                 out_packet->additional = additional;
167         } else {
168                 out_packet->operation |= werr_to_dns_err(ret);
169         }
170
171         NDR_PRINT_DEBUG(dns_name_packet, out_packet);
172         ndr_err = ndr_push_struct_blob(out, out_packet, out_packet,
173                         (ndr_push_flags_fn_t)ndr_push_dns_name_packet);
174         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
175                 TALLOC_FREE(in_packet);
176                 TALLOC_FREE(out_packet);
177                 DEBUG(0, ("Failed to push packet %d!\n", ndr_err));
178                 *out = *in;
179
180                 out->data[2] |= 0x80; /* Toggle DNS_FLAG_REPLY */
181                 out->data[3] |= DNS_RCODE_SERVFAIL;
182
183                 return NT_STATUS_OK;
184         }
185
186         dump_data(2, out->data, out->length);
187         return NT_STATUS_OK;
188 }
189
190 struct dns_tcp_call {
191         struct dns_tcp_connection *dns_conn;
192         DATA_BLOB in;
193         DATA_BLOB out;
194         uint8_t out_hdr[4];
195         struct iovec out_iov[2];
196 };
197
198 static void dns_tcp_call_writev_done(struct tevent_req *subreq);
199
200 static void dns_tcp_call_loop(struct tevent_req *subreq)
201 {
202         struct dns_tcp_connection *dns_conn = tevent_req_callback_data(subreq,
203                                       struct dns_tcp_connection);
204         struct dns_tcp_call *call;
205         NTSTATUS status;
206
207         call = talloc(dns_conn, struct dns_tcp_call);
208         if (call == NULL) {
209                 dns_tcp_terminate_connection(dns_conn, "dns_tcp_call_loop: "
210                                 "no memory for dns_tcp_call");
211                 return;
212         }
213         call->dns_conn = dns_conn;
214
215         status = tstream_read_pdu_blob_recv(subreq,
216                                             call,
217                                             &call->in);
218         TALLOC_FREE(subreq);
219         if (!NT_STATUS_IS_OK(status)) {
220                 const char *reason;
221
222                 reason = talloc_asprintf(call, "dns_tcp_call_loop: "
223                                          "tstream_read_pdu_blob_recv() - %s",
224                                          nt_errstr(status));
225                 if (!reason) {
226                         reason = nt_errstr(status);
227                 }
228
229                 dns_tcp_terminate_connection(dns_conn, reason);
230                 return;
231         }
232
233         DEBUG(10,("Received krb5 TCP packet of length %lu from %s\n",
234                  (long) call->in.length,
235                  tsocket_address_string(dns_conn->conn->remote_address, call)));
236
237         /* skip length header */
238         call->in.data +=4;
239         call->in.length -= 4;
240
241         /* Call dns */
242         status = dns_process(dns_conn->dns_socket->dns, call, &call->in, &call->out);
243         if (!NT_STATUS_IS_OK(status)) {
244                 DEBUG(0, ("dns_process returned %s\n", nt_errstr(status)));
245                 dns_tcp_terminate_connection(dns_conn,
246                                 "dns_tcp_call_loop: process function failed");
247                 return;
248         }
249
250         /* First add the length of the out buffer */
251         RSIVAL(call->out_hdr, 0, call->out.length);
252         call->out_iov[0].iov_base = (char *) call->out_hdr;
253         call->out_iov[0].iov_len = 4;
254
255         call->out_iov[1].iov_base = (char *) call->out.data;
256         call->out_iov[1].iov_len = call->out.length;
257
258         subreq = tstream_writev_queue_send(call,
259                                            dns_conn->conn->event.ctx,
260                                            dns_conn->tstream,
261                                            dns_conn->send_queue,
262                                            call->out_iov, 2);
263         if (subreq == NULL) {
264                 dns_tcp_terminate_connection(dns_conn, "dns_tcp_call_loop: "
265                                 "no memory for tstream_writev_queue_send");
266                 return;
267         }
268         tevent_req_set_callback(subreq, dns_tcp_call_writev_done, call);
269
270         /*
271          * The krb5 tcp pdu's has the length as 4 byte (initial_read_size),
272          * packet_full_request_u32 provides the pdu length then.
273          */
274         subreq = tstream_read_pdu_blob_send(dns_conn,
275                                             dns_conn->conn->event.ctx,
276                                             dns_conn->tstream,
277                                             4, /* initial_read_size */
278                                             packet_full_request_u32,
279                                             dns_conn);
280         if (subreq == NULL) {
281                 dns_tcp_terminate_connection(dns_conn, "dns_tcp_call_loop: "
282                                 "no memory for tstream_read_pdu_blob_send");
283                 return;
284         }
285         tevent_req_set_callback(subreq, dns_tcp_call_loop, dns_conn);
286 }
287
288 static void dns_tcp_call_writev_done(struct tevent_req *subreq)
289 {
290         struct dns_tcp_call *call = tevent_req_callback_data(subreq,
291                         struct dns_tcp_call);
292         int sys_errno;
293         int rc;
294
295         rc = tstream_writev_queue_recv(subreq, &sys_errno);
296         TALLOC_FREE(subreq);
297         if (rc == -1) {
298                 const char *reason;
299
300                 reason = talloc_asprintf(call, "dns_tcp_call_writev_done: "
301                                          "tstream_writev_queue_recv() - %d:%s",
302                                          sys_errno, strerror(sys_errno));
303                 if (!reason) {
304                         reason = "dns_tcp_call_writev_done: tstream_writev_queue_recv() failed";
305                 }
306
307                 dns_tcp_terminate_connection(call->dns_conn, reason);
308                 return;
309         }
310
311         /* We don't care about errors */
312
313         talloc_free(call);
314 }
315
316 /*
317   called when we get a new connection
318 */
319 static void dns_tcp_accept(struct stream_connection *conn)
320 {
321         struct dns_socket *dns_socket;
322         struct dns_tcp_connection *dns_conn;
323         struct tevent_req *subreq;
324         int rc;
325
326         dns_conn = talloc_zero(conn, struct dns_tcp_connection);
327         if (dns_conn == NULL) {
328                 stream_terminate_connection(conn,
329                                 "dns_tcp_accept: out of memory");
330                 return;
331         }
332
333         dns_conn->send_queue = tevent_queue_create(conn, "dns_tcp_accept");
334         if (dns_conn->send_queue == NULL) {
335                 stream_terminate_connection(conn,
336                                 "dns_tcp_accept: out of memory");
337                 return;
338         }
339
340         dns_socket = talloc_get_type(conn->private_data, struct dns_socket);
341
342         TALLOC_FREE(conn->event.fde);
343
344         rc = tstream_bsd_existing_socket(dns_conn,
345                         socket_get_fd(conn->socket),
346                         &dns_conn->tstream);
347         if (rc < 0) {
348                 stream_terminate_connection(conn,
349                                 "dns_tcp_accept: out of memory");
350                 return;
351         }
352
353         dns_conn->conn = conn;
354         dns_conn->dns_socket = dns_socket;
355         conn->private_data = dns_conn;
356
357         /*
358          * The krb5 tcp pdu's has the length as 4 byte (initial_read_size),
359          * packet_full_request_u32 provides the pdu length then.
360          */
361         subreq = tstream_read_pdu_blob_send(dns_conn,
362                                             dns_conn->conn->event.ctx,
363                                             dns_conn->tstream,
364                                             4, /* initial_read_size */
365                                             packet_full_request_u32,
366                                             dns_conn);
367         if (subreq == NULL) {
368                 dns_tcp_terminate_connection(dns_conn, "dns_tcp_accept: "
369                                 "no memory for tstream_read_pdu_blob_send");
370                 return;
371         }
372         tevent_req_set_callback(subreq, dns_tcp_call_loop, dns_conn);
373 }
374
375 static const struct stream_server_ops dns_tcp_stream_ops = {
376         .name                   = "dns_tcp",
377         .accept_connection      = dns_tcp_accept,
378         .recv_handler           = dns_tcp_recv,
379         .send_handler           = dns_tcp_send
380 };
381
382 struct dns_udp_call {
383         struct tsocket_address *src;
384         DATA_BLOB in;
385         DATA_BLOB out;
386 };
387
388 static void dns_udp_call_sendto_done(struct tevent_req *subreq);
389
390 static void dns_udp_call_loop(struct tevent_req *subreq)
391 {
392         struct dns_udp_socket *sock = tevent_req_callback_data(subreq,
393                                       struct dns_udp_socket);
394         struct dns_udp_call *call;
395         uint8_t *buf;
396         ssize_t len;
397         int sys_errno;
398         NTSTATUS status;
399
400         call = talloc(sock, struct dns_udp_call);
401         if (call == NULL) {
402                 talloc_free(call);
403                 goto done;
404         }
405
406         len = tdgram_recvfrom_recv(subreq, &sys_errno,
407                                    call, &buf, &call->src);
408         TALLOC_FREE(subreq);
409         if (len == -1) {
410                 talloc_free(call);
411                 goto done;
412         }
413
414         call->in.data = buf;
415         call->in.length = len;
416
417         DEBUG(10,("Received krb5 UDP packet of length %lu from %s\n",
418                  (long)call->in.length,
419                  tsocket_address_string(call->src, call)));
420
421         /* Call krb5 */
422         status = dns_process(sock->dns_socket->dns, call, &call->in, &call->out);
423         if (!NT_STATUS_IS_OK(status)) {
424                 talloc_free(call);
425                 DEBUG(0, ("dns_process returned %s\n", nt_errstr(status)));
426                 goto done;
427         }
428
429         subreq = tdgram_sendto_queue_send(call,
430                                           sock->dns_socket->dns->task->event_ctx,
431                                           sock->dgram,
432                                           sock->send_queue,
433                                           call->out.data,
434                                           call->out.length,
435                                           call->src);
436         if (subreq == NULL) {
437                 talloc_free(call);
438                 goto done;
439         }
440         tevent_req_set_callback(subreq, dns_udp_call_sendto_done, call);
441
442 done:
443         subreq = tdgram_recvfrom_send(sock,
444                                       sock->dns_socket->dns->task->event_ctx,
445                                       sock->dgram);
446         if (subreq == NULL) {
447                 task_server_terminate(sock->dns_socket->dns->task,
448                                       "no memory for tdgram_recvfrom_send",
449                                       true);
450                 return;
451         }
452         tevent_req_set_callback(subreq, dns_udp_call_loop, sock);
453 }
454
455 static void dns_udp_call_sendto_done(struct tevent_req *subreq)
456 {
457         struct dns_udp_call *call = tevent_req_callback_data(subreq,
458                                        struct dns_udp_call);
459         ssize_t ret;
460         int sys_errno;
461
462         ret = tdgram_sendto_queue_recv(subreq, &sys_errno);
463
464         /* We don't care about errors */
465
466         talloc_free(call);
467 }
468
469 /*
470   start listening on the given address
471 */
472 static NTSTATUS dns_add_socket(struct dns_server *dns,
473                                const struct model_ops *model_ops,
474                                const char *name,
475                                const char *address,
476                                uint16_t port)
477 {
478         struct dns_socket *dns_socket;
479         struct dns_udp_socket *dns_udp_socket;
480         struct tevent_req *udpsubreq;
481         NTSTATUS status;
482         int ret;
483
484         dns_socket = talloc(dns, struct dns_socket);
485         NT_STATUS_HAVE_NO_MEMORY(dns_socket);
486
487         dns_socket->dns = dns;
488
489         ret = tsocket_address_inet_from_strings(dns_socket, "ip",
490                                                 address, port,
491                                                 &dns_socket->local_address);
492         if (ret != 0) {
493                 status = map_nt_error_from_unix(errno);
494                 return status;
495         }
496
497         status = stream_setup_socket(dns->task,
498                                      dns->task->event_ctx,
499                                      dns->task->lp_ctx,
500                                      model_ops,
501                                      &dns_tcp_stream_ops,
502                                      "ip", address, &port,
503                                      lpcfg_socket_options(dns->task->lp_ctx),
504                                      dns_socket);
505         if (!NT_STATUS_IS_OK(status)) {
506                 DEBUG(0,("Failed to bind to %s:%u TCP - %s\n",
507                          address, port, nt_errstr(status)));
508                 talloc_free(dns_socket);
509                 return status;
510         }
511
512         dns_udp_socket = talloc(dns_socket, struct dns_udp_socket);
513         NT_STATUS_HAVE_NO_MEMORY(dns_udp_socket);
514
515         dns_udp_socket->dns_socket = dns_socket;
516
517         ret = tdgram_inet_udp_socket(dns_socket->local_address,
518                                      NULL,
519                                      dns_udp_socket,
520                                      &dns_udp_socket->dgram);
521         if (ret != 0) {
522                 status = map_nt_error_from_unix(errno);
523                 DEBUG(0,("Failed to bind to %s:%u UDP - %s\n",
524                          address, port, nt_errstr(status)));
525                 return status;
526         }
527
528         dns_udp_socket->send_queue = tevent_queue_create(dns_udp_socket,
529                                                          "dns_udp_send_queue");
530         NT_STATUS_HAVE_NO_MEMORY(dns_udp_socket->send_queue);
531
532         udpsubreq = tdgram_recvfrom_send(dns_udp_socket,
533                                          dns->task->event_ctx,
534                                          dns_udp_socket->dgram);
535         NT_STATUS_HAVE_NO_MEMORY(udpsubreq);
536         tevent_req_set_callback(udpsubreq, dns_udp_call_loop, dns_udp_socket);
537
538         return NT_STATUS_OK;
539 }
540
541 /*
542   setup our listening sockets on the configured network interfaces
543 */
544 static NTSTATUS dns_startup_interfaces(struct dns_server *dns, struct loadparm_context *lp_ctx,
545                                        struct interface *ifaces)
546 {
547         const struct model_ops *model_ops;
548         int num_interfaces;
549         TALLOC_CTX *tmp_ctx = talloc_new(dns);
550         NTSTATUS status;
551         int i;
552
553         /* within the dns task we want to be a single process, so
554            ask for the single process model ops and pass these to the
555            stream_setup_socket() call. */
556         model_ops = process_model_startup("single");
557         if (!model_ops) {
558                 DEBUG(0,("Can't find 'single' process model_ops\n"));
559                 return NT_STATUS_INTERNAL_ERROR;
560         }
561
562         num_interfaces = iface_list_count(ifaces);
563
564         for (i=0; i<num_interfaces; i++) {
565                 const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
566
567                 status = dns_add_socket(dns, model_ops, "dns", address, DNS_SERVICE_PORT);
568                 NT_STATUS_NOT_OK_RETURN(status);
569         }
570
571         talloc_free(tmp_ctx);
572
573         return NT_STATUS_OK;
574 }
575
576 static int dns_server_sort_zones(struct ldb_message **m1, struct ldb_message **m2)
577 {
578         const char *n1, *n2;
579         size_t l1, l2;
580
581         n1 = ldb_msg_find_attr_as_string(*m1, "name", NULL);
582         n2 = ldb_msg_find_attr_as_string(*m2, "name", NULL);
583
584         l1 = strlen(n1);
585         l2 = strlen(n2);
586
587         /* If the string lengths are not equal just sort by length */
588         if (l1 != l2) {
589                 /* If m1 is the larger zone name, return it first */
590                 return l2 - l1;
591         }
592
593         /*TODO: We need to compare DNs here, we want the DomainDNSZones first */
594         return 0;
595 }
596
597 static void dns_task_init(struct task_server *task)
598 {
599         struct dns_server *dns;
600         NTSTATUS status;
601         struct interface *ifaces;
602         int ret;
603         struct ldb_result *res;
604         struct ldb_dn *rootdn;
605         static const char * const attrs[] = { "name", NULL};
606         unsigned int i;
607
608         switch (lpcfg_server_role(task->lp_ctx)) {
609         case ROLE_STANDALONE:
610                 task_server_terminate(task, "dns: no DNS required in standalone configuration", false);
611                 return;
612         case ROLE_DOMAIN_MEMBER:
613                 task_server_terminate(task, "dns: no DNS required in member server configuration", false);
614                 return;
615         case ROLE_DOMAIN_CONTROLLER:
616                 /* Yes, we want a DNS */
617                 break;
618         }
619
620         load_interface_list(task, task->lp_ctx, &ifaces);
621
622         if (iface_list_count(ifaces) == 0) {
623                 task_server_terminate(task, "dns: no network interfaces configured", false);
624                 return;
625         }
626
627         task_server_set_title(task, "task[dns]");
628
629         dns = talloc_zero(task, struct dns_server);
630         if (dns == NULL) {
631                 task_server_terminate(task, "dns: out of memory", true);
632                 return;
633         }
634
635         dns->task = task;
636
637         dns->samdb = samdb_connect(dns, dns->task->event_ctx, dns->task->lp_ctx,
638                               system_session(dns->task->lp_ctx), 0);
639         if (!dns->samdb) {
640                 task_server_terminate(task, "dns: samdb_connect failed", true);
641                 return;
642         }
643
644         rootdn = ldb_dn_new(dns, dns->samdb, "");
645         if (rootdn == NULL) {
646                 task_server_terminate(task, "dns: out of memory", true);
647                 return;
648         }
649
650         // TODO: this search does not work against windows
651         ret = dsdb_search(dns->samdb, dns, &res, rootdn, LDB_SCOPE_SUBTREE,
652                           attrs, DSDB_SEARCH_SEARCH_ALL_PARTITIONS, "(objectClass=dnsZone)");
653         if (ret != LDB_SUCCESS) {
654                 task_server_terminate(task,
655                                       "dns: failed to look up root DNS zones",
656                                       true);
657                 return;
658         }
659
660         TYPESAFE_QSORT(res->msgs, res->count, dns_server_sort_zones);
661
662         for (i=0; i < res->count; i++) {
663                 struct dns_server_zone *z;
664
665                 z = talloc_zero(dns, struct dns_server_zone);
666                 if (z == NULL) {
667                 }
668
669                 z->name = ldb_msg_find_attr_as_string(res->msgs[i], "name", NULL);
670                 z->dn = talloc_move(z, &res->msgs[i]->dn);
671
672                 DLIST_ADD_END(dns->zones, z, NULL);
673         }
674
675         status = dns_startup_interfaces(dns, task->lp_ctx, ifaces);
676         if (!NT_STATUS_IS_OK(status)) {
677                 task_server_terminate(task, "dns failed to setup interfaces", true);
678                 return;
679         }
680 }
681
682 NTSTATUS server_service_dns_init(void)
683 {
684         return register_server_service("dns", dns_task_init);
685 }