wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Stefan Haller <stefan.haller@stha.de>
To: wireguard@lists.zx2c4.com
Subject: FreeBSD if_wg POINTTOPOINT and MULTICAST behaviour
Date: Wed, 14 Apr 2021 20:43:37 +0200	[thread overview]
Message-ID: <9afe6dc9-5c53-4c25-b09f-5b4cf6ff8046@stha.de> (raw)

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)

             reply	other threads:[~2021-04-14 20:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 18:43 Stefan Haller [this message]
2021-04-14 20:24 ` FreeBSD if_wg POINTTOPOINT and MULTICAST behaviour 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9afe6dc9-5c53-4c25-b09f-5b4cf6ff8046@stha.de \
    --to=stefan.haller@stha.de \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).