On Fri, Apr 20, 2018 at 04:52:24PM -0400, Dan Streetman wrote:

> Scripts in the if-pre-up.d and if-up.d dirs call ifquery directly, or call it 
> indirectly
> through other scripts.  However ifquery tries to lock each interface and 
> exits with
> error if it's called from ifup or ifdown.  Since ifquery doesn't change 
> anything,
> there is no reason interface locks need to be taken; ifquery can be safely run
> recurseively from ifup/ifdown.

You're right, it should be possible to run ifquery recursively. But it
should still ensure the interface is locked before querying it, to
ensure consistency.

> In Ubuntu, the attached patch was applied to achieve the following:

The patch avoids locking at all when no_act == true. Consider this:

iface foo inet ...
        pre-up ifquery --state bar

iface bar inet ...

Now if I call ifup foo and ifup bar at the same time, then the ifquery
might theoretically read a half-written /run/network/ifstate.bar.
Granted, the change of this is extremely small, and one could also
question whether it makes sense to run ifquery in this way at all, since
even if it did read a consistent /run/network/ifstate.bar, it could
either read the state as being up or down depending on whether ifup bar
finished before or after ifquery. But it's not hard to do it correctly,
so I'll make it so it only avoids locking if it detects recursion.

> Thanks for considering the patch.

Thanks for sending the patch :)

-- 
Met vriendelijke groet / with kind regards,
      Guus Sliepen <g...@debian.org>

Attachment: signature.asc
Description: PGP signature

Reply via email to