[DragonFlyBSD - Bug #3294] drill(1) with IPv6 NS fails with UDP but works with TCP

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue Oct 26 17:07:09 PDT 2021


Issue #3294 has been updated by y0n3t4n1.


On DragonFlyBSD, the UDP packet sent from sendto has no flowlabel (0x00000) even if @net.inet6.ip6.auto_flowlabel@ is left set (the default).

On DragonFlyBSD, tcpdump shows the empty flowlabel (the 3 octets following the first 0x60)
<pre><code>08:58:15.240037 IP6 (hlim 64, next-header UDP (17) payload length: 16) ::1.2082 > ::1.3456: [udp sum ok] udp/vt 8 69 / 21 [|vat]
        0x0000:  6000 0000 0010 1140 0000 0000 0000 0000  `...... at ........
        0x0010:  0000 0000 0000 0001 0000 0000 0000 0000  ................
        0x0020:  0000 0000 0000 0001 0822 0d80 0010 c00c  ........."......
        0x0030:  5445 5354 4041 4243                      TEST at ABC
</code></pre>

while on another system (namely, WSL)
<pre><code>23:51:23.201149 IP6 (flowlabel 0x33ba2, hlim 64, next-header UDP (17) payload length: 16) ::1.40700 > ::1.3456: [bad udp cksum 0x0023 -> 0x2932!] udp/vt 8 69 / 21 [|vat]
        0x0000:  6003 3ba2 0010 1140 0000 0000 0000 0000  `.;.... at ........
        0x0010:  0000 0000 0000 0001 0000 0000 0000 0000  ................
        0x0020:  0000 0000 0000 0001 9efc 0d80 0010 0023  ...............#
        0x0030:  5445 5354 4041 4243                      TEST at ABC
</code></pre>


sendto.c:
<pre><code class="c">
#include <sys/socket.h>
#include <sys/types.h>
#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int
main(int ac, char **av)
{
        struct addrinfo hint, *ai = NULL;
        int s = -1;

        if (ac < 1 + 3)
                errx(1, "usage: %s host port msg", av[0]);
        const char *msg = av[3];
        size_t msglen = strlen(msg);
        memset(&hint, 0, sizeof hint);
        hint.ai_family = AF_UNSPEC;
        hint.ai_socktype = SOCK_DGRAM;
        hint.ai_flags = AI_PASSIVE;
        hint.ai_protocol = 0;
        hint.ai_canonname = NULL;
        hint.ai_addr = NULL;
        hint.ai_next = NULL;
        if (getaddrinfo(av[1], av[2], &hint, &ai) != 0)
                err(errno, "getaddrinfo");
        if ((s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == -1)
                err(errno, "socket");
        ssize_t sent = sendto(s, msg, msglen, 0, ai->ai_addr, ai->ai_addrlen);
        if (sent == -1)
                err(errno, "sendto");
        close(s);
        freeaddrinfo(ai);
        return 0;
}
</code></pre>
To build:
<pre><code class="shell">
make sendto CFLAGS='-W -Wall' && ./sendto ::1 3456 TEST at ABC
</code></pre>
To observe (on Linux system, change lo0 to lo):
<pre><code class="shell">
sudo tcpdump -Xnvs 1500 -i lo0 udp 3456
</code></pre>


----------------------------------------
Bug #3294: drill(1) with IPv6 NS fails with UDP but works with TCP
http://bugs.dragonflybsd.org/issues/3294#change-14182

* Author: liweitianux
* Status: New
* Priority: Normal
* Target version: 6.2
* Start date: 2021-08-13
----------------------------------------
YONETANI Tomokazu reported this issue on users@ mailing list: https://lists.dragonflybsd.org/pipermail/users/2021-August/404805.html

<pre>
$ drill  @2001:4860:4860::8888 aaaa leaf.dragonflybsd.org | egrep -v
'^(\;|$)'
Error: error sending query: Could not send or receive, because of network
error
</pre>

unless using TCP query:

<pre>
$ drill -t @2001:4860:4860::8888 aaaa leaf.dragonflybsd.org | egrep -v
'^(\;|$)'
leaf.dragonflybsd.org. 3599 IN AAAA 2001:470:1:43b:1::68
</pre>

Similar DNS queries on other boxes running different OSes don't have the same problem, and tcpdump output shows the response from the DNS server, so I doubt it's an network issue.

<pre>
$ uname -a
DragonFly c60 6.0-RELEASE DragonFly v6.0.0.33.gc7b638-RELEASE #0: Wed Aug 4
20:25:25 JST 2021 root at c60:/usr/obj/build/usr/src/sys/X86_64_GENERIC x86_64
</pre>

----

I also confirmed this issue on leaf, which running master as of Aug 4.



-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list