On Tue, Feb 05, 2019 at 01:50:25PM +1000, David Gwynne wrote:


On 4 Feb 2019, at 22:00, Tim Kuijsten <i...@netsend.nl> wrote:

On Mon, Feb 04, 2019 at 12:07:22PM +1000, David Gwynne wrote:
Currently you can change a tun interface from being point to point to
being a broadcast interface. Why?

I'm using broadcast mode in my own wireguard implementation because there can 
be more than one peer on the network:
https://github.com/timkuijsten/uwg/blob/ccd39c6a9bdf36575a3bb3db06c438a2241c1134/ifn.c#L1868

But there's only one process sucking on the /dev entry, so there's just the one 
pipe. Does it make a difference to the routes you can add whether tun is only 
point to point, or is broadcast required? I don't see uwg itself adding routes, 
do you do that outside it?

I don't need to manually add routes. If I bring the interface up without the IFF_POINTOPOINT flag, then as soon as I assign the address and netmask to the interface a route for the subnet is automatically added [1].

About the IFF_BROADCAST flag, I thought not setting IFF_BROADCAST would imply IFF_POINTOPOINT but now I see I read tun(4) the wrong way and it's perfectly fine to run without IFF_POINTOPOINT and without IFF_BROADCAST.

[1] https://github.com/timkuijsten/uwg/blob/master/ifn.c#L294

Reply via email to