Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #199450

Re: processing order for configuration files in /etc/network/interfaces.d

From Reco <recoverym4n@gmail.com>
Newsgroups linux.debian.user
Subject Re: processing order for configuration files in /etc/network/interfaces.d
Date 2018-08-27 19:40 +0200
Message-ID <wrtEC-ZE-25@gated-at.bofh.it> (permalink)
References (5 earlier) <wrr06-7Pn-17@gated-at.bofh.it> <wrrW9-8nE-1@gated-at.bofh.it> <wrsfv-hF-13@gated-at.bofh.it> <wrsyR-o9-3@gated-at.bofh.it> <wrsSd-uo-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


	Hi.

On Mon, Aug 27, 2018 at 11:46:37AM -0500, David Wright wrote:
> On Mon 27 Aug 2018 at 19:24:01 (+0300), Reco wrote:
> > 	Hi.
> > 
> > On Mon, Aug 27, 2018 at 12:01:23PM -0400, Greg Wooledge wrote:
> > > On Mon, Aug 27, 2018 at 06:41:25PM +0300, Reco wrote:
> > > > Last sentence says to me that wordexp output should be always sorted.
> > > 
> > > This only tells us that it *reads* the config files in glob-sorted order.
> > > And peeking into the actual source code of ifupdown, yes, it appears to
> > > do this.  (File config.c starting at line 436, in the stretch source.)
> > > It even uses wordexp() as advertised.
> > > 
> > > What's less clear to me at this moment is what happens *after* the
> > > interface configuration file(s) have been read into memory.
> > > 
> > > Moving over to main.c, it looks like it reads the interfaces (line 639),
> > > and that function was called from line 1190.  After line 1190, it loops
> > > over the "target_iface" array, and processes them in the order they appear
> > > in that array.
> > > 
> > > So... next question is how they get packed into that array.
> > > 
> > > Returning to the select_interfaces function, it looks like the ordering
> > > is created by a call to find_allowup.
> > > 
> > > And... this is where I stopped reading, because it got confusing.  Maybe
> > > someone else can take a stab at deciphering that part.
> > 
> > select_interfaces() is called on "ifup -a" invocation.
> > read_interfaces() is called by it.
> > read_interfaces() calls read_interfaces_defn().
> > read_interfaces_defn() parses "iface" and "source" directives, and calls
> > read_interfaces_defn() once again on each file specified by "source" in
> > order defined by wordexp(3).
> > 
> > Therefore defn[] array should be filled in this order (assuming that one
> > specifies "source" only at /e/n/i):
> > 
> > 1) any interface definition at /e/n/i in order encountered, until
> > "source" directive.
> > 2) any interface definition provided by "source" directive in order
> > defined by wordexp(3).
> > 3) any interface definition at /e/n/i in order encountered, after the
> > "source" directive.
> > 
> > I'd use ltrace(1) to check it, but building test environment is
> > something that I lack the time to do.
> 
> That's still the order in which the stanzas are read. Don't we now
> need to know what the contents of each stanza is, ie is it an "auto"
> or an "allow-hotplug" stanza, etc?

I simplified things. After defn[] is filled at read_interfaces(),
find_allowup() is called, defn[] being the first argument.
find_allowup() iterates on defn[], using a pointer to defn->allowups.
defn->allowups, unless I'm reading it wrong, is filled by the same
read_interfaces_defn(), in the same order that /e/n/i and "source" are
evaluated.
This filling is done by add_allow_up() each time one specifies "auto" or
"allow-" stanzas.

Reco

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

processing order for configuration files in /etc/network/interfaces.d Martin T <m4rtntns@gmail.com> - 2018-08-23 16:40 +0200
  Re: processing order for configuration files in  /etc/network/interfaces.d <tomas@tuxteam.de> - 2018-08-23 17:10 +0200
    Re: processing order for configuration files in /etc/network/interfaces.d Martin T <m4rtntns@gmail.com> - 2018-08-26 14:50 +0200
      Re: processing order for configuration files in  /etc/network/interfaces.d David Wright <deblis@lionunicorn.co.uk> - 2018-08-26 16:50 +0200
        Re: processing order for configuration files in /etc/network/interfaces.d Martin T <m4rtntns@gmail.com> - 2018-08-26 20:40 +0200
          Re: processing order for configuration files in  /etc/network/interfaces.d Zenaan Harkness <zenaan@freedbms.net> - 2018-08-27 04:40 +0200
          Re: processing order for configuration files in  /etc/network/interfaces.d <tomas@tuxteam.de> - 2018-08-27 10:20 +0200
            Re: processing order for configuration files in  /etc/network/interfaces.d Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-27 15:10 +0200
              Re: processing order for configuration files in  /etc/network/interfaces.d <tomas@tuxteam.de> - 2018-08-27 15:30 +0200
              Re: processing order for configuration files in  /etc/network/interfaces.d Reco <recoverym4n@gmail.com> - 2018-08-27 15:40 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d <tomas@tuxteam.de> - 2018-08-27 16:50 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d Reco <recoverym4n@gmail.com> - 2018-08-27 17:50 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d <tomas@tuxteam.de> - 2018-08-27 17:50 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-27 18:10 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d Reco <recoverym4n@gmail.com> - 2018-08-27 18:30 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d David Wright <deblis@lionunicorn.co.uk> - 2018-08-27 18:50 +0200
                Re: processing order for configuration files in  /etc/network/interfaces.d Reco <recoverym4n@gmail.com> - 2018-08-27 19:40 +0200
          Re: processing order for configuration files in  /etc/network/interfaces.d David Wright <deblis@lionunicorn.co.uk> - 2018-08-28 15:30 +0200
  Re: processing order for configuration files in  /etc/network/interfaces.d Badiane Ka <badiane_ka@yahoo.com> - 2018-08-29 17:50 +0200

csiph-web