[systemd-devel] [PATCH] rules: only run systemd-sysctl when a network device is added

Kay Sievers kay at vrfy.org
Mon Jun 17 12:18:33 PDT 2013


On Mon, Jun 17, 2013 at 3:30 PM, Ross Lagerwall <rosslagerwall at gmail.com> wrote:
> On Mon, Jun 17, 2013 at 12:09:53AM +0200, Michał Bartoszkiewicz wrote:
>> On Sun, Jun 16, 2013 at 11:58 PM, Ross Lagerwall
>> <rosslagerwall at gmail.com> wrote:
>> > OK, thanks.  But my testing shows otherwise: I created a .conf file with:
>> > net.ipv4.conf.enp1s0.forwarding=1
>> > (where eth0 is the old name, enp1s0 is the new, predictable name)
>> > It *correctly* sets /proc/sys/net/ipv4/conf/enp1s0/forwarding=1 after
>> > a reboot with the patch applied.
>>
>> This works because systemd-sysctl runs from 99-systemd.rules, so the
>> name has already been changed by earlier rules.
>
> Yeah, that was what I understood to be happening but I wasn't sure if
> there is another case where something can go wrong.

The rules order should not matter actually, we collect all RUN keys
during rules execution and execute them later. The device renaming
happens between the rule exec and the RUN exec.

Therefore, it should be fine to limit sysctl to "add" events. Applied it now.

Thanks,
Kay


More information about the systemd-devel mailing list