Bug 218508 - Tunneling and aliases using the tun device, reusing a destination address works with IPv4, but not IPv6
Summary: Tunneling and aliases using the tun device, reusing a destination address wor...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
Depends on:
Reported: 2017-04-09 08:29 UTC by Christian Sturm
Modified: 2020-08-10 18:50 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Christian Sturm 2017-04-09 08:29:27 UTC
I can create a tun device by using:

ifconfig tun0 create
ifconfig tun 
ifconfig tun alias
ifconfig up

This works great and allows me to use the and have it tunneled over the second (aliased) tunnel when I set up the correct route using /sbin/route add -net -iface tun0.

I have this setup, using IPv6 only working as it is supposed to. To explain what I am am actually achieving with this: In the background I am using BGP over a one-to-one VPN software using the tunnel interface.

Doing the same thing on IPv6, however doesn't work when I add an alias, using the same destination address twice:

ifconfig tun0 inet6 fdaa:abc:abc:abc::1 fe80::111:0 prefixlen /128
ifconfig tun0 inet6 alias fe80::111:1 fe80::111:0 prefixlen /128
ifconfig: ioctl (SIOCAIFADDR): File exists

Using another destination address this works however. Since this works on IPv4 I'd expect it to work here as well.
Comment 1 dmilith 2020-07-30 13:40:19 UTC
I have same bug on 12.1… "file exists":

socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0)        = 3 (0x3)
ioctl(3,SIOCGIFINDEX,0x7fffffff9f20)             = 0 (0x0)
close(3)                                         = 0 (0x0)
__sysctl(0x7fffffff9f40,0x6,0x0,0x7fffffff9f38,0x0,0x0) = 0 (0x0)
__sysctl(0x7fffffff9f40,0x6,0x80161e000,0x7fffffff9f38,0x0,0x0) = 0 (0x0)
socket(PF_INET6,SOCK_DGRAM,0)                    = 3 (0x3)
ioctl(3,SIOCDIFADDR_IN6,0x1054278)               ERR#49 'Can't assign requested address'
ioctl(3,SIOCAIFADDR_IN6,0x1054278)               ERR#17 'File exists'
ifconfig: write(2,"ifconfig: ",10)                       = 10 (0xa)
ioctl (SIOCAIFADDR)write(2,"ioctl (SIOCAIFADDR)",19)             = 19 (0x13)
: write(2,": ",2)                                        = 2 (0x2)
File exists
write(2,"File exists\n",12)                      = 12 (0xc)
process exit, rval = 1