Weirdness with same-host IPv6 packets

From: Dustin Marquess <>
Date: Sat, 04 Dec 2021 21:54:44 UTC
I'm seeing a weird issue with -CURRENT that I don't recall seeing
before. It started at least a couple of weeks back and a new build
from yesterday still shows it. UDP packets inside a host using the
host's non-loopback address seems to get dropped. TCP does work,
however there's a delay, almost like the first packet or two also got
dropped. I don't have any firewalling active, and stopping the VNET
jails didn't have any effect.

I've been using the machine's local IPv6 IP in /etc/resolv.conf for a
while. I noticed that logins were taking longer than usual and tracked
it down to unbound not responding. If I change /etc/resolv.conf to use
::1 or the host's IPv4 IP, then it works fine. The host's IPv6 IP does
work from outside the host, however. I thought it was maybe a weird
unbound bug, so I did some testing with netcat.

Current ifconfg (other interfaces removed for brevity):

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0xb
inet netmask 0xff000000
groups: lo

bridge2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
ether 58:9c:fc:10:f4:55
inet netmask 0xffffff00 broadcast
inet netmask 0xffffffff broadcast
inet6 2001:470:bc52:4::101 prefixlen 64
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        ifmaxaddr 0 port 16 priority 128 path cost 2000000
        ifmaxaddr 0 port 12 priority 128 path cost 2000000
nd6 options=1<PERFORMNUD>
groups: bridge

Routing table:

Destination        Gateway            Flags     Netif Expire
default          UGS     bridge2          link#11            UH          lo0     link#19            U       bridge2       link#19            UH          lo0      link#19            UHS         lo0

Destination                       Gateway                       Flags
   Netif Expire
::/96                             ::1                           UGRS        lo0
default                           2001:470:bc52:4::1            UGS     bridge2
::1                               link#11                       UHS         lo0
::ffff:                 ::1                           UGRS        lo0
2001:470:bc52:4::/64              link#19                       U       bridge2
2001:470:bc52:4::101              link#19                       UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%lo0/64                     link#11                       U           lo0
fe80::1%lo0                       link#11                       UHS         lo0
ff02::/16                         ::1                           UGRS        lo0


I started a listener:

$ nc -6 -u -l 5555

And in another window, did:

$ echo testing | nc -6 -u ::1 5555   <-- Works
$ echo testing | nc -6 -u 2001:470:bc52:4::101 5555   <-- Never
receives the packet
[ Previous command from a different host DOES work, however]

Switching to TCP:
$ echo testing | nc -6 ::1 5555  <--- Works
$ echo testing | nc -6 2001:470:bc52:4::101 5555   <-- Works, after a
delay however

Trying IPv4:
$ echo testing | nc -u 5555 <--- Works
$ echo testing | nc -u 5555 <--- Works, no delay

So IPv4 is working fine, which is strange.

Has anybody else seen this and have any insight?