Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6586

dnsmasq does not forward all of the received queries although it does in previous versions.

    • None
    • Moderate
    • rhel-sst-cs-net-perf-services
    • ssg_core_services
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:
      dnsmasq does not forward all of the received queries although it does in previous versions.

      When dnsmasq received the same queries in a short period of time, some of the queries were not forwarded to outside nameservers.
      In the reproducer below, if we execute the dig command five times then 30 queries are sent to dnsmasq as per /etc/resolv.conf.
      According to dnsmasq.log and the result of strace, dnsmasq received 30 queries as expected.
      But dnsmasq missed to forward 4 queries as per tcpdump and strace.

      Version-Release number of selected component (if applicable):

      • dnsmasq-2.79-24.el8_7.1.x86_64 (The latest of RHEL8)
      • dnsmasq-2.79-24.el8.x86_64
      • dnsmasq-2.79-24.el8.aarch64

      How reproducible:
      Setup dnsmasq with below configuration and execute multiple dig commands.

      Steps to Reproduce:
      1. Start dnsmasq with below settings

        # cat /etc/dnsmasq.conf
        ~~~
        domain-needed
        bogus-priv
        interface=lo
        bind-interfaces
        listen-address=127.0.0.1
        cache-size=1000
        resolv-file=/etc/resolv.dnsmasq
        no-poll
        ## Can append below two parameters to log host queries
        log-queries
        log-facility=/var/log/dnsmasq.log
        ~~~

        # cat /etc/resolv.conf
        ~~~
        # Generated by NetworkManager
        nameserver 127.0.0.1
        search ap-northeast-1.compute.internal
        options timeout:2 attempts:5
        ~~~

      Note that the nameserver 192.168.122.39 is non-existent DNS server.
      Hence dig commands in the next step are expected to be timed out.

        # cat /etc/resolv.dnsmasq
        ~~~
        nameserver 192.168.122.39
        ~~~

        # systemctl start dnsmasq

      2. Execute the dig command 5 times continuously in a short period of time.

        ~~~
        [root@rhel7u9-3 ~]# dig google.com &
        [2] 22689
        [root@rhel7u9-3 ~]# dig google.com &
        [3] 22693
        [root@rhel7u9-3 ~]# dig google.com &
        [4] 22697
        [root@rhel7u9-3 ~]# dig google.com &
        [5] 22701
        [root@rhel7u9-3 ~]# dig google.com &
        [6] 22705
        ~~~

      Actual results:

        1. Note
          We set tcpdump and attach strace to dnsmasq before step2 for investigation purpose.
            # tcpdump -nn port 53
            # strace -ttTvfyyx -s 2048 -o /tmp/dnsmasq.strace -p <PID> &
          It is not required to reproduce the issue.
          ##

      dnsmasq received 30 queries but forwarded only 26 queries.

      As per tcpdump:
      ~~~
      [root@rhel8u4 ~]# tcpdump -nn port 53
      dropped privs to tcpdump
      tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
      listening on enp1s0, link-type EN10MB (Ethernet), capture size 262144 bytes
      02:05:34.053295 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:36.055429 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:36.693097 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:37.251990 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:37.809456 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:38.052601 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:38.355890 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:38.693503 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:39.252428 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:39.809996 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:40.053837 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:40.357148 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:40.693653 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:41.251730 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:41.810211 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:42.054093 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:42.356754 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:42.693896 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:43.251842 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:43.810632 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:44.054270 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:44.357849 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:44.693101 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:45.253189 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:45.810437 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      02:05:46.358110 IP 192.168.122.244.31032 > 192.168.122.39.53: 5020+ [1au] A? google.com. (51)
      ^C
      26 packets captured
      26 packets received by filter
      0 packets dropped by kernel
      ~~~

      As per strace:
      ~~~
      [root@rhel8u4 ~]# grep recvmsg /tmp/dnsmasq.strace | wc -l
      30
      [root@rhel8u4 ~]#
      [root@rhel8u4 ~]# grep sendto /tmp/dnsmasq.strace | wc -l
      26
      [root@rhel8u4 ~]#
      ~~~

      Expected results:
      dnsmasq should forward all of received queries(30 queries should be forward in above case).

      Additional info:
      We checked several versions of dnsmasq in RHEL8 and RHEL7 with the exact same configuration and testing procedure and confirmed them below.
      Details can be seen in the support case 03454752.

      RHEL8
      dnsmasq-2.79-13.el8_3.1 : Reproduced
      dnsmasq-2.79-13.el8     : Not reproduced (which means dnsmasq forwarded all of 30 queries)
      dnsmasq-2.79-4.el8      : Not reproduced (the oldest version of RHEL8)

      RHEL7
      dnsmasq-2.76-17.el7_9.3 : Not reproduced (the latest of RHEL7)
      dnsmasq-2.76-16.el7_9.1 : Reproduced

      Best Regards,
      Ryo Nakamura.

              pemensik@redhat.com Petr Mensik
              rhn-support-rynakamu Ryo Nakamura
              Petr Mensik Petr Mensik
              rhel-cs-infra-services-qe rhel-cs-infra-services-qe rhel-cs-infra-services-qe rhel-cs-infra-services-qe
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: