[systemd-devel] Masking .network files

Tom Gundersen teg at jklm.no
Sat Apr 19 10:09:20 PDT 2014


On Fri, Apr 11, 2014 at 2:56 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sat, 05.04.14 11:26, Tom Gundersen (teg at jklm.no) wrote:
>
>>
>> On Sat, Apr 5, 2014 at 12:43 AM, Leonid Isaev <lisaev at umail.iu.edu> wrote:
>> >         I seem to have a strange issue with the way networkd processes its
>> > configuration files. The machine is actually a systemd-nspawn container with
>> > a static IP address, so I had to mask the default 80-container-host0.network
>> > and create a custom config. Both real and virtual machines are up-to-date
>> > archlinux [testing] installations.
>>
>> So the best way to do this is to name your custom config file either
>> the same as what you are overriding (if the overridden file should
>> anyway never be used, which is the case for what you describe), or
>> simply name it starting with a lower number. That way the first
>> matching file will be applied.
>>
>> The 'masking' logic that you know from unit files does not really make
>> much sense for .network files (but maybe this is something we should
>> change...). Symlinks to /dev/null are just treated as empty .network
>> files, so their meaning is "no [Match] section", which matches
>> everything and "no [Network] section", which does nothing. I suppose
>> this may be used to express "ignore any subsequent .network files",
>> but I doubt that is a particularly useful thing to do.
>
> I am pretty masking one unit file should not have the effect that all
> lexicographically later ones also get masked. Masking should always be
> local, a tool to get rid of one entry only, not all of them.
>
> I'd strongly recommend to make sure that networkd uses util.c's
> null_or_empty() call to detect whether a .network file is masked, and
> then just skip over it, continuing with the next one.

Yes, makes sense. I just pushed a patch implementing masking for
.link, .network and .netdev files.

Cheers,

Tom


More information about the systemd-devel mailing list