tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [Greg Troxel] Re: Getting "write: address family not supported by protocol family" when using Restic over Tailscale



Martin Husemann <martin%duskware.de@localhost> writes:

> On Sun, Oct 18, 2026 at 07:07:22PM -0400, Greg Troxel wrote:
>>   I think we should change:
>> 
>>     --- if_tun.c.~1.178.~   2025-11-15 18:30:51.076488670 -0500
>>     +++ if_tun.c    2026-10-18 19:02:22.920287647 -0400
>>     @@ -629,7 +629,6 @@ tun_output(struct ifnet *ifp, struct mbu
>>                     IFQ_ENQUEUE(&ifp->if_snd, m0, error);
>>                     if (error) {
>>                             if_statinc(ifp, if_collisions);
>>     -                       error = EAFNOSUPPORT;
>>                             m0 = NULL;
>>                             goto out;
>>                     }
>
> The patched code makes sense for AF_INET6 and AF_INET.

thanks.

> I am not sure the original code makes sense for AF_UNSPEC.

What do you mean by that?  Specifically the line forcing error to
AFNOSUPPORT when the queue is full, or something else?  As I read this,
if the sockaddr as AF_UNSPEC, the bits are just put in the queue.  Which
is "obviously" for doing things that feel more like bpf than regular
packets, and if so you need a plan.

> There is also a EAFNOSUPPORT error case for AF_INET a few lines above
> that does not look good for AF_INET6 (sharing that code path).

I think that is ok.  Basically tun was v4 only, and if you want to send
v6, you need to prepend the address (sockaddr) or an AF word.  An AF
word is the same scheme used in one of the bpf DLTs to say what kind of
packet it is, when the link encoding has a private way to do that, vs
something like ethertype.

As I read the line I think you are objecting to, if the kernel has INET
or INET6, then both PREPADDR and IFHEAD are handled.   Otherwise, a bare
packet is sent, and it's only allowed to be v4, because that's how it
was in the old days.   Sending v6 requires one of PREPADDR and IFHEAD,
and really best practice is to have one of those anwyay.


Home | Main Index | Thread Index | Old Index