Development discussion of WireGuard
 help / color / mirror / Atom feed
* FreeBSD if_wg POINTTOPOINT and MULTICAST behaviour
@ 2021-04-14 18:43 Stefan Haller
  2021-04-14 20:24 ` Jason A. Donenfeld
  0 siblings, 1 reply; 21+ messages in thread
From: Stefan Haller @ 2021-04-14 18:43 UTC (permalink / raw)
  To: wireguard

Hello everyone!

Today I tried switching to the if_wg kernel module. I observed that the
behaviour of the tunnel interface was changed to drop the POINTTOPOINT
and MULTICAST flags (8801509656e9).

For some reason the bird2 routing daemon is not picking up my interface
if there is only a /32 address configured and I manually add host routes
over the wg interface. This broke my wireguard mesh setup and I wanted
to find out ways to get it back into a working state.

Luckily, a look into the git history showed up change 0adab0e961c6e that
I find really useful (and also quite smart). I can simply say `ifconfig
wg0 link1` to get the POINTTOPOINT behaviour back.

Unfortunately, most routing protocols seem to rely on multicast traffic
(e.g. OSPF, Babel, at least with default settings). bird2 will not pick
up my interface, because the MULTICAST flag is missing.

I tested a simple change that you can also find at the end of this email. The
link1 flag will not only toggle the POINTTOPOINT flag, but additionally also
toggles the MULTICAST flag. I am not really experienced with kernel and network
stack code, but to me it makes sense to mark the interface as multicast capable
in a peer-to-peer setting (if you use this, you will most likely set AllowedIPs
to 0.0.0.0/0, ::/0 anyway). Is such a change sensible?

I tested the change for my specific use case and everything seems to be working
again (without broader changes to the configuration otherwise necessary).

I do not want to imply that the current behaviour is wrong, because I
simply don't know much about the topic. If someone else is using dynamic
routing protocols over p2p wireguard tunnels successfully, I appreciate
pointers into the right direction :)

Kind regards,
Stefan


diff --git a/src/if_wg.c b/src/if_wg.c
index ca54476..414a641 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -2910,9 +2910,9 @@ wg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
        case SIOCSIFFLAGS:

                if ((ifp->if_flags & IFF_LINK0) || !(ifp->if_flags & IFF_LINK1))
-                       ifp->if_flags &= ~IFF_POINTOPOINT;
+                       ifp->if_flags &= ~IFF_POINTOPOINT & ~IFF_MULTICAST;
                else if (ifp->if_flags & IFF_LINK1)
-                       ifp->if_flags |= IFF_POINTOPOINT;
+                       ifp->if_flags |= IFF_POINTOPOINT | IFF_MULTICAST;
                ifp->if_flags &= ~(IFF_LINK0 | IFF_LINK1 | IFF_LINK2);

                if (ifp->if_flags & IFF_UP)

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

end of thread, other threads:[~2021-04-19 21:46 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 18:43 FreeBSD if_wg POINTTOPOINT and MULTICAST behaviour Stefan Haller
2021-04-14 20:24 ` Jason A. Donenfeld
2021-04-14 21:50   ` Stefan Haller
2021-04-14 22:14     ` Toke Høiland-Jørgensen
2021-04-15  4:30       ` Jason A. Donenfeld
2021-04-15  9:42         ` Toke Høiland-Jørgensen
2021-04-15 11:36       ` Stefan Haller
2021-04-15 12:22         ` Toke Høiland-Jørgensen
2021-04-15 17:22         ` Jason A. Donenfeld
2021-04-15 17:53           ` Toke Høiland-Jørgensen
2021-04-16  0:05             ` Jason A. Donenfeld
2021-04-16  8:57               ` Stefan Haller
2021-04-16  9:35                 ` Toke Høiland-Jørgensen
2021-04-19 18:25                   ` Toke Høiland-Jørgensen
2021-04-19 19:41                     ` Stefan Haller
2021-04-19 19:42                       ` Jason A. Donenfeld
2021-04-19 19:49                         ` Stefan Haller
2021-04-19 21:46                           ` Toke Høiland-Jørgensen
2021-04-16 12:14                 ` Muenz, Michael
2021-04-16 15:17                   ` Jason A. Donenfeld
2021-04-16 17:45                     ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).