<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 13, 2015 at 12:50 AM, Toke Høiland-Jørgensen <span dir="ltr"><<a href="mailto:toke@toke.dk" target="_blank">toke@toke.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi<br>
<br>
I'm trying to port a set of traffic shaping scripts (sqm-scripts) from<br>
OpenWrt to Arch Linux. I would like to be able to have a systemd unit<br>
be run when an interface is configured (by systemd-networkd). Kinda like<br>
the if-up.d facility in some distros, I guess...<br>
<br>
I figured out that I can depend on the interface *appearing* by using<br>
<br>
BindsTo=sys-subsystem-net-devices-%i.device<br>
After=sys-subsystem-net-devices-%i.device<br>
<br>
...but is there also a way to get a unit to run when an interface is<br>
configured?<br></blockquote><div><br></div><div>Systemd doesn't know when an interface is /finally/ configured (e.g. maybe the configurator added one address but is still about to add more; maybe it added an IPv6 address but is still waiting for DHCPv4; maybe it finished with addresses but is still configuring routes...)</div><div><br></div><div>So you really need this to be part of the configurator itself. As a direct equivalent to if-up.d, NetworkManager has dispatcher.d, but systemd-networkd doesn't yet have anything such.</div><div><br></div><div>However, both NM and networkd have "is-online" tools, for example, <b>systemd-networkd-wait-online.service</b>, which your unit can depend on. Note that by default it waits for *all* interfaces to be configured; if you only need a specific one, you can create your own (instanced/templated) version that would use "--interface=%i". See also `man systemd-networkd-wait-online`.</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>></div></div>
</div></div>