FreeBSD/wireguard-tools

Kyle Evans kevans at freebsd.org
Wed Mar 10 03:14:38 UTC 2021


On Tue, Mar 9, 2021 at 3:23 PM Jason A. Donenfeld <Jason at zx2c4.com> wrote:
>
> Hi Kyle,
>
> Thanks for getting in touch. So far as I can tell, Matt Macy never
> finished either the port of wireguard-tools or the port of the actual
> kernel module from OpenBSD. I'm CCng Matt Dunwoodie, who has started
> working through the kernel module finding issues.

Ah, excellent!

> There was that awful error in 25519 (lack of scalar clamping) that somebody
> emailed me about a while ago. I don't know if that was ever fixed but I was quite
> surprised that got committed.

Indeed, that did get fixed.

> I got the impression from trying to work with Matt Macy that there wasn't too much
> interest in collaboration.  Your email is a very welcome change.

I can't speak much for the historical context here, but I do know that
we as a project
would benefit from collaboration if the end result is being able to
tap into the pre-existing
knowledge pool available here.

> I see the path forward for FreeBSD having a functional WireGuard
> implementation as something like this:
>
> 1. We work out kinks in the kernel module crypto and state machine. I
> need to sync with Matt Dunwoodie on his findings there. Maybe we can
> send patches ourselves, but maybe it'd be best to just have a
> screensharing call where we walk through this together, and after the
> call you can code/commit the problems that we identify from
> discussion? A similar undertaking has been on my todo list for a
> veryverylongtimenow for NetBSD, but that implementation is much, much
> further behind, while in contrast I think with FreeBSD we're a lot
> closer to things being where they should, and a lot of it will be a
> simple matter of syncing the OpenBSD code. So if you're willing to
> work with us, I think that's something we can get done together in a
> week or faster.
>
> 2. We fix/simplify the kernel module's IPC interface to just be a
> simple get/set, like every other implementation of WireGuard.
>
> 3. We write support for that IPC protocol as "ipc-freebsd.h" in
> wireguard-tools. Maybe we'll start with Macy's code, but he never
> incorporated the feedback I provided on that, so perhaps you'd like to
> start over. Whatever you please there is fine with me.
>

We discussed this out-of-band, but to re-iterate that for others that might
have tuned into the thread: I'm interested in maintaining the use of nvlists
for import/export to sidestep around some classes of ABI
concerns/considerations because we maintain two or three major branches
of FreeBSD (if you include the -CURRENT) that fixes/additions could be
backported to if we can manage backward compatibility. We're certainly open
to other possible changes here.

> 4. I relicense the tools as MIT. I've previously started on getting
> this done, and the only blocker was the embedded libmnl, which is LGPL
> and out of my control. But I think there are two reasons why this is
> not a real impediment: 1) I've been in touch with the author there,
> and I think he'll MIT it if poke again, and 2) that's only for Linux
> anyway, so you wouldn't need that file *at all* on FreeBSD.
>

This is excellent, thanks. As you guessed, we can just drop bits from
our vendor import that we won't be building, so no worries here as
long the pertinent parts can be cleanly considered MIT.

> Does that seem like a good plan? And if so, are you the right contact
> with whom to work on it? And what's the FreeBSD release schedule like?
> How long do we have to fix this?
>

This seems like a good plan, and I appreciate it. I'm more than happy
to play the ambassador role here, and hack on whatever I can be useful
with. The final build starts on the 26th and there's a strong
preference (or maybe it's even a hard policy) that there be no changes
between the last RC and the final build.

#1 above is, of course, the most critical step to accomplish prior to
the release. We could conceivably punt #2 to entirely post-release;
the ioctl interface isn't documented, so we could slap warnings in the
pertinent headers and ifconfig/ifwg.c to note that it's unstable and
will change between minor releases.

Punting it down the road a little bit entails a concession that stock
wg(8) will not be usable for FreeBSD 13.0, but we can work with decke@
to conjure up a patch against the port with our existing ipc-freebsd.h
with the limited functionality that it currently entails. I don't
think this is the worst concession we can make as long as it means
that we can focus on making the core functionality rock-solid and as
long as the situation is clearly advertised.

The ports model generally encourages problems with the port/pkg to go
through the port maintainer first, so theoretically decke@ would be
initially fielding any bug reports that arise from the suboptimal
situation in the ~yearish that 13.0 will hold tenure rather than you
seeing complaints from it upstream. The only folks building
wireguard-tools directly from upstream should be those wanting to work
against FreeBSD -CURRENT, but we can slap some __FreeBSD_version
checks in ipc-freebsd.h or somewhere to advise of the situation if
someone tries to use it against revisions that are incompatible with
the new UAPI.

Thanks,

Kyle Evans


More information about the WireGuard mailing list