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

2013-06-17 Thread Ross Lagerwall
On Mon, Jun 17, 2013 at 12:09:53AM +0200, Michał Bartoszkiewicz wrote:
 On Sun, Jun 16, 2013 at 11:58 PM, Ross Lagerwall
 rosslagerw...@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.

Thanks
-- 
Ross Lagerwall
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-17 Thread Kay Sievers
On Mon, Jun 17, 2013 at 3:30 PM, Ross Lagerwall rosslagerw...@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
 rosslagerw...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-16 Thread Kay Sievers
On Fri, Jun 14, 2013 at 3:39 PM, Ross Lagerwall rosslagerw...@gmail.com wrote:
 On Fri, Jun 14, 2013 at 02:44:23PM +0200, Zbigniew Jędrzejewski-Szmek wrote:
 On Thu, Jun 13, 2013 at 10:45:12AM +0100, Ross Lagerwall wrote:
  Otherwise, when a network device is renamed, systemd-sysctl is run twice
  with the same network device name: once for ACTION=add and once for
  ACTION=move.

 Hm, but if I have some sysctl for the network device,
 /proc/sys/net/ipv4/conf/enp0s1f3/log_martians=11 or something, aren't
 I going to have it under the *new* name, not the old name?

 Yes.  Currently, systemd-sysctl is run twice when a network device is
 added, *both* times with the new name as the prefix, like:
 systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/enp0s1f3 ... (with the new 
 name)

 Once is caused by the add action, the other is caused by the move
 (rename) action.

 The patch causes it to only run the systemd-sysctl command once.

 Unless I'm misunderstanding what is happening?

The problem Zbigniew describes is that if one adds config options with
predictable network names used, and we do not apply the stuff at
move, we will never apply them.

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-16 Thread Ross Lagerwall
On Sun, Jun 16, 2013 at 07:42:03PM +0200, Kay Sievers wrote:
  Yes.  Currently, systemd-sysctl is run twice when a network device is
  added, *both* times with the new name as the prefix, like:
  systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/enp0s1f3 ... (with the new 
  name)
 
  Once is caused by the add action, the other is caused by the move
  (rename) action.
 
  The patch causes it to only run the systemd-sysctl command once.
 
  Unless I'm misunderstanding what is happening?
 
 The problem Zbigniew describes is that if one adds config options with
 predictable network names used, and we do not apply the stuff at
 move, we will never apply them.
 

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.

I'm still not clear about in which situations it could fail?
-- 
Ross Lagerwall
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-16 Thread Michał Bartoszkiewicz
On Sun, Jun 16, 2013 at 11:58 PM, Ross Lagerwall
rosslagerw...@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.

--
Michał Bartoszkiewicz mbartoszkiew...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-16 Thread Reindl Harald


Am 16.06.2013 23:58, schrieb Ross Lagerwall:
 The problem Zbigniew describes is that if one adds config options with
 predictable network names used, and we do not apply the stuff at
 move, we will never apply them.

 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.
 
 I'm still not clear about in which situations it could fail?

and because all this magic is too fragile at least since Fedora 18
i created a service which is started after network.service and since
them all my services and forwardings are working again as expected

[root@srv-rhsoft:~]$ cat /etc/systemd/system/sysctl-post-network.service
[Unit]
Description=apply settings after network
After=network.service openvpn.service hostapd.service 
network-wlan-bridge.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/sysctl -p
StandardOutput=null

[Install]
WantedBy=multi-user.target



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-14 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Jun 13, 2013 at 10:45:12AM +0100, Ross Lagerwall wrote:
 Otherwise, when a network device is renamed, systemd-sysctl is run twice
 with the same network device name: once for ACTION=add and once for
 ACTION=move.

Hm, but if I have some sysctl for the network device,
/proc/sys/net/ipv4/conf/enp0s1f3/log_martians=11 or something, aren't
I going to have it under the *new* name, not the old name?

Zbyszek

 ---
  rules/99-systemd.rules.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
 index d17bdd9..e9b2da7 100644
 --- a/rules/99-systemd.rules.in
 +++ b/rules/99-systemd.rules.in
 @@ -49,7 +49,7 @@ SUBSYSTEM==usb, ENV{DEVTYPE}==usb_device, 
 ENV{ID_USB_INTERFACES}==*:0701??:
  
  # Apply sysctl variables to network devices (and only to those) as they 
 appear.
  
 -SUBSYSTEM==net, KERNEL!=lo, RUN+=@rootlibexecdir@/systemd-sysctl 
 --prefix=/proc/sys/net/ipv4/conf/$name 
 --prefix=/proc/sys/net/ipv4/neigh/$name 
 --prefix=/proc/sys/net/ipv6/conf/$name 
 --prefix=/proc/sys/net/ipv6/neigh/$name
 +ACTION==add, SUBSYSTEM==net, KERNEL!=lo, 
 RUN+=@rootlibexecdir@/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name 
 --prefix=/proc/sys/net/ipv4/neigh/$name 
 --prefix=/proc/sys/net/ipv6/conf/$name 
 --prefix=/proc/sys/net/ipv6/neigh/$name
  
  # Asynchronously mount file systems implemented by these modules as
  # soon as they are loaded.
 -- 
 1.8.3.1
 
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-14 Thread Ross Lagerwall
On Fri, Jun 14, 2013 at 02:44:23PM +0200, Zbigniew Jędrzejewski-Szmek wrote:
 On Thu, Jun 13, 2013 at 10:45:12AM +0100, Ross Lagerwall wrote:
  Otherwise, when a network device is renamed, systemd-sysctl is run twice
  with the same network device name: once for ACTION=add and once for
  ACTION=move.
 
 Hm, but if I have some sysctl for the network device,
 /proc/sys/net/ipv4/conf/enp0s1f3/log_martians=11 or something, aren't
 I going to have it under the *new* name, not the old name?

Yes.  Currently, systemd-sysctl is run twice when a network device is
added, *both* times with the new name as the prefix, like:
systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/enp0s1f3 ... (with the new name)

Once is caused by the add action, the other is caused by the move
(rename) action.

The patch causes it to only run the systemd-sysctl command once.

Unless I'm misunderstanding what is happening?

Regards
-- 
Ross Lagerwall
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-06-13 Thread Ross Lagerwall
Otherwise, when a network device is renamed, systemd-sysctl is run twice
with the same network device name: once for ACTION=add and once for
ACTION=move.
---
 rules/99-systemd.rules.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index d17bdd9..e9b2da7 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -49,7 +49,7 @@ SUBSYSTEM==usb, ENV{DEVTYPE}==usb_device, 
ENV{ID_USB_INTERFACES}==*:0701??:
 
 # Apply sysctl variables to network devices (and only to those) as they appear.
 
-SUBSYSTEM==net, KERNEL!=lo, RUN+=@rootlibexecdir@/systemd-sysctl 
--prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name 
--prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name
+ACTION==add, SUBSYSTEM==net, KERNEL!=lo, 
RUN+=@rootlibexecdir@/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name 
--prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name 
--prefix=/proc/sys/net/ipv6/neigh/$name
 
 # Asynchronously mount file systems implemented by these modules as
 # soon as they are loaded.
-- 
1.8.3.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel