A problematic WireGuard port for FreeBSD and pfSense
Summary
Netgate, the company behind the pfSense firewall, had commissioned a WireGuard port for the FreeBSD kernel, and in 2021 the code had landed in the main branch shortly before the release of FreeBSD 13.0. When the WireGuard developers around Jason Donenfeld examined it, they found buffer overflows, severe crypto errors, unimplemented parts of the protocol and kernel panics. After two weeks of work nothing of the original code remained, and FreeBSD 13.0 was released without WireGuard in the kernel.
What WireGuard is
WireGuard is a modern VPN protocol, similar to IPsec but with very little code and fixed, modern cryptographic algorithms. It has been part of the Linux kernel since Linux 5.6. Netgate wanted to offer it in pfSense and paid for a port into the FreeBSD kernel.
The WireGuard developers’ list of defects was long: sleep calls against race conditions, validation functions that simply always returned “valid”, debug output in the middle of crypto code and Linux emulation via ifdef. Netgate disputed parts of this account.
What the case says about processes
The real problem was not a bad port but that it could get into an operating system’s main branch without thorough review, a few weeks before a release. The post pointed cynically to Linus Torvalds, who is often criticised for strictly rejecting bad patches. A reworked WireGuard implementation later made it into FreeBSD after all.
Ideas
- Code for the kernel and cryptography needs independent review before it is accepted.
- A protocol’s developers should be involved in ports.
- Accepting large changes shortly before releases is particularly risky.
Insights
- Paid development does not guarantee quality without review processes.
- Strict reviews feel inconvenient but protect users from serious errors.
Facts
- WireGuard has been part of the Linux kernel since Linux 5.6.
- FreeBSD 13.0 was released in 2021 without the disputed WireGuard port.
- Netgate is the company behind the pfSense firewall.
References
Critique
- The original’s dismissive wording about the developer of the port and its sharpness target a person; the core problem lay in the review process.
Remarks
- Ars Technica and the FreeBSD mailing list document the course of events in detail.
Recommendations
- Use mature, reviewed implementations for VPNs and update them promptly.
- In your own projects, make code review a fixed step before anything is merged.
Found a mistake or have something to add? Get in touch.
Links to the original source and the Web Archive open in a new tab.