Development discussion of WireGuard
 help / color / mirror / Atom feed
* FreeBSD/wireguard-tools
@ 2021-03-09 21:04 Kyle Evans
  2021-03-09 21:23 ` FreeBSD/wireguard-tools Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: Kyle Evans @ 2021-03-09 21:04 UTC (permalink / raw)
  To: wireguard; +Cc: Bernhard Fröhlich

Hello!

I'll start off with a slight overview of where we're at from a base
system perspective: in November, an if_wg port from OpenBSD to FreeBSD
landed in our development branch, along with updates to ifconfig(8) to
manage it for the time being. We've committed a number of fixes and
improvements since then[0][1], and we will be shipping that in the
upcoming release of FreeBSD 13.0[2].

The only outstanding issue(s) that I'm aware of (please correct me if
I'm mistaken) are the following:

(1) wireguard-tools doesn't currently support FreeBSD/if_wg, but there
is a  branch (mm/freebsd) that generally does. There are further fixes
to this from the fine folks over at Netgate, see [3]. As a FreeBSD
developer, what can I do to help us move forward together?

(2) There's a preference for using wg(8) for configuration, but we
can't currently include it in base due to licensing. We've got plenty
of precedent for dual-licensed material in base, so if that's a route
that works then I'd like to go ahead and start that discussion.

From our standpoint, any of: BSD2, BSD3, MIT, ISC licenses can go in
undisputed, choices outside of that require red, yellow, and sometimes
even purple tape.

These are the points that I'd like to start discussing, at least; we
can punt #2 on a little further down the road, though I would like to
have some plan in place to hopefully be able to include it in base for
FreeBSD 13.1 and the integrated version of wg(8) in ports for testing
much sooner.

I appreciate your time and efforts in providing the excellent
WireGuard ecosystem.

Thanks,

Kyle Evans

[0] https://cgit.freebsd.org/src/log/sys/dev/if_wg
[1] https://cgit.freebsd.org/src/log/sbin/ifconfig
[2] https://www.freebsd.org/releases/13.0R/schedule/
[3] https://github.com/pfsense/wireguard-tools/commits/master

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FreeBSD/wireguard-tools
  2021-03-09 21:04 FreeBSD/wireguard-tools Kyle Evans
@ 2021-03-09 21:23 ` Jason A. Donenfeld
  2021-03-10  3:14   ` FreeBSD/wireguard-tools Kyle Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2021-03-09 21:23 UTC (permalink / raw)
  To: kevans; +Cc: WireGuard mailing list, Bernhard Fröhlich, Matt Dunwoodie

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. 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. 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 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.

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.

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?

Talk soon,
Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FreeBSD/wireguard-tools
  2021-03-09 21:23 ` FreeBSD/wireguard-tools Jason A. Donenfeld
@ 2021-03-10  3:14   ` Kyle Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Kyle Evans @ 2021-03-10  3:14 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: WireGuard mailing list, Bernhard Fröhlich, Matt Dunwoodie

On Tue, Mar 9, 2021 at 3:23 PM Jason A. Donenfeld <Jason@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-10  3:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 21:04 FreeBSD/wireguard-tools Kyle Evans
2021-03-09 21:23 ` FreeBSD/wireguard-tools Jason A. Donenfeld
2021-03-10  3:14   ` FreeBSD/wireguard-tools Kyle Evans

Development discussion of WireGuard

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ http://inbox.vuxu.org/wireguard \
		wireguard@lists.zx2c4.com
	public-inbox-index wireguard

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.wireguard


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git