[Bug 218508] Tunneling and aliases using the tun device, reusing a destination address works with IPv4, but not IPv6

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 06 Aug 2021 10:34:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218508

Zhenlei Huang <zlei.huang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zlei.huang@gmail.com

--- Comment #3 from Zhenlei Huang <zlei.huang@gmail.com> ---
(In reply to Christian Sturm from comment #0)
The IPv6 stack does not behave the same as IPv4 stack.

In this case, you can add an IPv6 alias without the destination address to
tun0.

```
ifconfig tun0 inet6 2001:db8:: 2001:db8::1 prefixlen 128
ifconfig tun0 inet6 alias 2001:db8::2 prefixlen 128
```

The long answer:
In principle, a tunnel interface can be unnumbered. For a router, you can
"borrow" the global unique address on loopback interface as the local address.

As for numbered tunnel interface, is the peer should be numbered? No, at least
in principle not required.

We give another thought on the remote address of tunnel interface, if both ends
are numbered, then should either end has only exactly one IP address? No.

Due to historical reason, the destination address of tunnel interface can not
be omitted of the FreeBSD IPv4 stack implementation. But it is not the case of
IPv6 stack.

Still we can teach the FreeBSD kernel to "smartly" process IPv6 aliases with
same destination address.

-- 
You are receiving this mail because:
You are the assignee for the bug.