[systemd-devel] slow systemd-networkd DHCP client on wlan0 with systemd v217

Charles Devereaux systemd at guylhem.net
Tue Feb 3 11:15:30 PST 2015


My current solution with dhcpcd is a sleep service sending signals to
dhcpcd (give back the lease/reclaim it), something which could be extended
to systemd-networkd, with other signals for other meanings that you may not
want by default, like:
 - removing the configuration it did (which is currently kept when
systemd-networkd is stopped, which could be useful in some scenarios to
avoid asking an additional IP address every time)
 - starting or stopping the DHCP servers services (which once started keep
running)

Even if systemd-networkd does not support a fine grained logic as I
regretted in another message about br0, this would at least support most of
the basic scenarios many people will need.

$ cat /dhcpcd-sleep.service
[Unit]
Description=DHCP client sleep hook
Before=sleep.target
ConditionVirtualization=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/killall -USR1 dhcpcd
ExecStop=/usr/bin/killall -SIGALRM dhcpcd

[Install]
WantedBy=sleep.target



On Tue, Feb 3, 2015 at 11:27 AM, Lennart Poettering <lennart at poettering.net>
wrote:

> On Tue, 03.02.15 18:20, Patrik Flykt (Patrik.Flykt at linux.intel.com) wrote:
>
> > On Tue, 2015-02-03 at 11:46 +0100, Lennart Poettering wrote:
> > > On Mon, 02.02.15 23:12, Charles Devereaux (systemd at guylhem.net) wrote:
> > >
> > > > Another problem with systemd-networkd is that the lease is not
> renewed
> > > > after sleep.
> > > >
> > > > This is a basic feature, a laptop is frequently physicially moved,
> which
> > > > means another DHCP lease should be acquired, but I don't see how to
> > > > do that.
> > >
> > > Hmm, I figure all DHCP leases should be refreshed when we come back
> > > from suspend. Hooking that up should be pretty easy. Added to the TODO
> > > list.
> > >
> > > That said, isn't the link beat lost anyway during suspend, and thus we
> > > should refresh automatically, anyway?
> > >
> > > Either way refreshing on resume can't hurt...
> >
> > Is the resume event detected somehow in systemd?
>
> The kernel unfortunately provides no API for this right now. However,
> if logind is the one suspending the machine, then it sends out a
> PrepareForSleep() signal before doing so. systemd-resolved already
> hooks into that:
>
>
> http://cgit.freedesktop.org/systemd/systemd/tree/src/resolve/resolved-bus.c#n684
>
> Tom mentioned he's already looking into adding similar code to
> networkd to handle this properly.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150203/7ca75b6d/attachment.html>


More information about the systemd-devel mailing list