Development discussion of WireGuard
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Jim Darby <uberscubajim@gmail.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Timing issue (?) with wg-quick up on Raspberry Pi B+
Date: Mon, 11 Sep 2017 02:52:22 +0200	[thread overview]
Message-ID: <CAHmME9ozNXY6xSSLqGR1M6_fJCquGGLjr0P=4XFOnxHefwbg9Q@mail.gmail.com> (raw)
In-Reply-To: <59B5C95F.50508@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

I figured it out. ifplugd clears all addresses when bringing up an
interface:

void interface_up(int fd, char *iface) {
...
        ((struct sockaddr_in *)(&ifr.ifr_addr))->sin_addr.s_addr =
INADDR_ANY;
        if (ioctl(fd, SIOCSIFADDR, &ifr) < 0) {
...
}

Since wg-quick sets the address before bringing it up, this running in
between is problematic. One workaround in wg-quick would be for me to
reverse the order of setting the IP and bringing it up, but this introduces
other races I'm not very fond of introducing. So, rather, we should address
the larger question: why on earth is ifplugd being started when wg0 is
added?

Sep 10 23:57:51 janus ifplugd(wg0)[14109]: ifplugd 0.28 initializing.
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: Using interface
wg0/00:00:00:00:00:00
Sep 10 23:57:51 janus ifplugd(wg0)[14109]: Using detection mode: IFF_RUNNING

What causes it to be launched here? Digging a bit deeper, it looks like
ifplugd is being launched by a udev rule which calls a Debian file called
ifplugd.agent. It is in here that unholy hotplugging occurs.

I don't actually have a Debian system running to fish around and see, but
my guess is that you have a file /etc/default/ifplugd that has in it
HOTPLUG_INTERFACES=all. If you change this to HOTPLUG_INTERFACES="wlan0
eth0" or something more restrictive, things might work better. Just a guess.

[-- Attachment #2: Type: text/html, Size: 1633 bytes --]

  reply	other threads:[~2017-09-11  0:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10 11:34 Jim Darby
2017-09-10 12:44 ` Jason A. Donenfeld
2017-09-10 13:09   ` Jim Darby
2017-09-10 14:26     ` Jason A. Donenfeld
2017-09-10 15:08       ` Jim Darby
2017-09-10 22:25         ` Jason A. Donenfeld
2017-09-10 22:30           ` Jason A. Donenfeld
2017-09-10 23:23           ` Jim Darby
2017-09-11  0:52             ` Jason A. Donenfeld [this message]
2017-09-11 12:35               ` Jim Darby
2017-09-11 12:37                 ` 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='CAHmME9ozNXY6xSSLqGR1M6_fJCquGGLjr0P=4XFOnxHefwbg9Q@mail.gmail.com' \
    --to=jason@zx2c4.com \
    --cc=uberscubajim@gmail.com \
    --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).