Introduce Wireguard support to bird

Toke Høiland-Jørgensen toke at
Mon Jul 8 13:36:41 CEST 2019

Janne Heß <janne at> writes:

> On 6/8/19 12:18 AM, Toke Høiland-Jørgensen wrote:
>> Janne Heß <janne at> writes:
>>> Hey everyone,
>>> as advertised, I have completed the Wireguard support.
>>> You might see that I am not really a C expert, but I hope the code is good enough.
>>> If you need me to change anything or have additional questions, just
>>> let me know.
>> Hi Janne
>> Awesome that you have taken the time to implement this!
>> I'll let the Bird maintainers comment on the approach of embedding the
>> wireguard netlink library; but I have two other concerns:
>> - As far as I can tell there's nothing preventing Bird from removing
>>    AllowedIPs that it did not itself install from an interface, right?
>> - The algorithm is basically O(P*M*N) for inserting N routes on an
>>    interface with P peers that each have M existing AllowedIPs. That is
>>    not going to scale very far :/
>> -Toke
> Hi Toke,
> thanks for your review.
> Your first observation is correct. Due to differences in semantics, this 
> cannot be implemented in the same way it is implemented in the KRT 
> protocol because AllowedIPs don't have a notion of the proto field.

Yeah, not sure what a good way to handle that might be. You could add
this capability to the upstream wireguard? 

> Addressing your second point, the WireGuard netlink interface and 
> library only offer and understand the peers and allowed IPs as a linked 
> list.
> As we only get each route seperately, we cannot process multiple routes 
> in one run. We're open to suggestions and patches.

Well, there are a couple of options, I guess:

- Fix the wireguard netlink interface to work better with
  insertion/deletion semantics.

- Cache the kernel response in a data structure that allows more
  efficient lookups.

Before doing any of this, you may want to wait for feedback on whether
this approach to adding the support is the right way to go. Personally,
I tend to think that the "right" way to add the support is by
introducing a new 'wireguard' protocol type to Bird. But that's up to
Ondrej et al, of course :)


More information about the WireGuard mailing list