All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: iwd@lists.01.org
Subject: Re: [PATCH] build: add After=network-pre.target to service files
Date: Fri, 22 Jan 2021 15:23:49 +0100	[thread overview]
Message-ID: <977EC844-07CA-4C62-9D07-ED47C97A52E8@holtmann.org> (raw)
In-Reply-To: <eea8d062-2ffb-a1d9-8bbc-5b9b7eafca5b@bang-olufsen.dk>

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

Hi Alvin,

>>> systemd specifies a special passive target unit 'network-pre.target'
>>> which may be pulled in by services that want to run before any network
>>> interface is brought up or configured. Correspondingly, network
>>> management services such as iwd and ead should specify
>>> After=network-pre.target to ensure a proper ordering with respect to
>>> this special target.
>>> 
>>> For more information, see systemd.special(7) and [1].
>>> 
>>> [1] https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.freedesktop.org%2Fwiki%2FSoftware%2Fsystemd%2FNetworkTarget%2F&amp;data=04%7C01%7CALSI%40bang-olufsen.dk%7Ca9129a1177e04d6a153008d8bedee80e%7C210d08b883f7470abc96381193ca14a1%7C0%7C0%7C637469211873327131%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=K3cEG17BYuVdWg9JlwqCIpmOkGYa1esk8gdFbGewuME%3D&amp;reserved=0
>> 
>> so what does this really do in practice. Both daemons are fully hotplug aware and it makes no difference when they are started.
> 
> I can give two examples.
> 
> The first is practical and we encountered it in our embedded system. The 
> second is hypothetical, but perhaps a little more convincing.
> 
> 1. We have a oneshot service which must run to perform some platform 
> specific configuration of our wireless network interface before it is 
> ready to be used. One such thing is does is set the MAC address 
> according to some data in an EEPROM. While restructuring the service 
> file for this oneshot service I removed the line:
> 
> 	Before=iwd.service systemd-networkd.service
> 
> and replaced it with:
> 
> 	Before=network-pre.target
> 
> ... as is suggested in systemd's documentation. This seemed good to me 
> because it is more generic.
> 
> I then noticed that during boot, iwd would run before this service and 
> connect to an AP. The AP was then kicking us off during the MAC address 
> change. This is how I noticed that iwd was not respecting the 
> network-pre.target order.
> 
> FYI we are using a driver (brcmfmac) which doesn't allow 
> creating/destroying the primary interface.
> 
> 2. Since iwd (and ead? never used it) can also do IP network 
> configuration, it's possible that it runs and does this stuff before 
> certain firewall rules are applied. This is the rationale given in the 
> systemd documentation.

fair points. Please put them into the commit message so that when we ever git blame this change, we know why it made sense.

Just to note, I always hate that if you have to delay a service from starting up as early as possible and get the hardware ready to be used. Nobody worried about these things until we made it so blazing fast that WiFi will be ready and connected before you need it. They way how it should have been from the start.

Regards

Marcel

  parent reply	other threads:[~2021-01-22 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 13:56 [PATCH] build: add After=network-pre.target to service files Alvin =?unknown-8bit?q?=C5=A0ipraga?=
2021-01-22 14:06 ` Marcel Holtmann
2021-01-22 14:17   ` Alvin =?unknown-8bit?q?=C5=A0ipraga?=
2021-01-22 14:21     ` Alvin =?unknown-8bit?q?=C5=A0ipraga?=
2021-01-22 14:23     ` Marcel Holtmann [this message]
2021-01-22 14:30       ` Alvin =?unknown-8bit?q?=C5=A0ipraga?=
2021-01-22 14:43         ` Paul Menzel
2021-01-22 15:10           ` Alvin =?unknown-8bit?q?=C5=A0ipraga?=

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=977EC844-07CA-4C62-9D07-ED47C97A52E8@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=iwd@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.