~vcs-imports/busybox/trunk

« back to all changes in this revision

Viewing changes to networking/dnsd.c

  • Committer: Denys Vlasenko
  • Date: 2020-12-29 15:53:11 UTC
  • Revision ID: git-v1:77a51a2709de1b646ab493f0bf771d896de6efc2
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * the first porting of oao' scdns to busybox also.
18
18
 */
19
19
//config:config DNSD
20
 
//config:       bool "dnsd (10 kb)"
 
20
//config:       bool "dnsd (9.8 kb)"
21
21
//config:       default y
22
22
//config:       help
23
23
//config:       Small and static DNS server daemon.
379
379
 */
380
380
static int process_packet(struct dns_entry *conf_data,
381
381
                uint32_t conf_ttl,
382
 
                uint8_t *buf,
383
 
                unsigned buflen)
 
382
                uint8_t *buf)
384
383
{
385
384
        struct dns_head *head;
386
385
        struct type_and_class *unaligned_type_class;
403
402
                bb_simple_error_msg("response packet, ignored");
404
403
                return 0; /* don't reply */
405
404
        }
 
405
        /* QR = 1 "response", RCODE = 4 "Not Implemented" */
 
406
        outr_flags = htons(0x8000 | 4);
 
407
        err_msg = NULL;
406
408
 
407
409
        /* start of query string */
408
410
        query_string = (void *)(head + 1);
414
416
        /* where to append answer block */
415
417
        answb = (void *)(unaligned_type_class + 1);
416
418
 
417
 
        if (buflen < answb - buf) {
418
 
                bb_simple_error_msg("packet too short");
419
 
                return 0; /* don't reply */
420
 
        }
421
 
 
422
 
        /* QR = 1 "response", RCODE = 4 "Not Implemented" */
423
 
        outr_flags = htons(0x8000 | 4);
424
 
        err_msg = NULL;
425
 
 
426
419
        /* OPCODE != 0 "standard query"? */
427
420
        if ((head->flags & htons(0x7800)) != 0) {
428
421
                err_msg = "opcode != 0";
566
559
                if (OPT_verbose)
567
560
                        bb_simple_info_msg("got UDP packet");
568
561
                buf[r] = '\0'; /* paranoia */
569
 
                r = process_packet(conf_data, conf_ttl, buf, r);
 
562
                r = process_packet(conf_data, conf_ttl, buf);
570
563
                if (r <= 0)
571
564
                        continue;
572
565
                send_to_from(udps, buf, r, 0, &from->u.sa, &to->u.sa, lsa->len);