NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/58016: wg-userspace(8) requires explicit route setup
The following reply was made to PR bin/58016; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/58016: wg-userspace(8) requires explicit route setup
Date: Sun, 10 Mar 2024 04:53:29 +0000
If I change wg-userspace(8) to do
ifmode =3D IFF_BROADCAST|IFF_MULTICAST;
if (ioctl(fd, TUNSIFMODE, &ifmode) =3D=3D -1) {
close(fd);
fd =3D -1;
}
when creating the tun(4) interface, then ifconfig(8) output looks like
this instead:
# ifconfig tun0
tun0: flags=3D0x8043<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
status: active
inet6 fd01::2/64 flags 0
inet6 fe80::9afa:9bff:fe60:a0d2%tun0/64 flags 0 scopeid 0x4
inet 10.1.0.2/24 broadcast 10.1.0.255 flags 0
And both inet and inet6 routes work as expected on 10.1.0.0/24
addresses:
# route -n get -inet 10.1.0.1
route to: 10.1.0.1
destination: 10.1.0.0
mask: 255.255.255.0
local addr: 10.1.0.2
interface: tun0
flags: 0x41<UP,DONE>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu ex=
pire
0 0 0 0 0 0 0 =
0
# route -n get -inet6 fd01::1
route to: fd01::1
destination: fd01::
mask: ffff:ffff:ffff:ffff::
local addr: fd01::2
interface: tun0
flags: 0x141<UP,DONE,CONNECTED>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu ex=
pire
0 0 0 0 0 0 0 =
0
(Still unclear on why, in the default IFF_POINTOPOINT setting of
tun(4), an explicit route is needed only for IPv4 while the system
automagically adds the necessary route for IPv6.)
Home |
Main Index |
Thread Index |
Old Index