Skip to contentSkip to conversation

future of sysctls?

DISCUSSION Ludwig Nussel 3 participants 7 messages May 12, 2011 – May 23, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

I'm currently struggling to find a sane way to set net.ipv6.conf.default.use_tempaddr.
Traditionally at some point during boot "sysctl -e -q -p /etc/sysctl.conf" is called. That doesn't really work out anymore. The aforementioned setting needs to be applied after the ipv6 module is loaded (could be compiled into the kernel too though) otherwise it wouldn't apply. It needs to be set before a network driver is loaded though as the default value is copied to interfaces specific settings at interface creation time. On top of that there are also network interface specific sysctls that need to be applied after an interface is created (e.g. net.ipv6.conf.eth0.use_tempaddr).
Are there any plans to better deal with that?
Like e.g. emitting events when some part of the kernel registers a sysctl so userspace can override the compiled in default value?
Or just offer sysfs attributes instead of sysctls?

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
#1 lore raw
Quoted 13 lines · Ludwig Nussel

Hi,

I'm currently struggling to find a sane way to set net.ipv6.conf.default.use_tempaddr.
Traditionally at some point during boot "sysctl -e -q -p /etc/sysctl.conf" is called. That doesn't really work out anymore. The aforementioned setting needs to be applied after the ipv6 module is loaded (could be compiled into the kernel too though) otherwise it wouldn't apply. It needs to be set before a network driver is loaded though as the default value is copied to interfaces specific settings at interface creation time. On top of that there are also network interface specific sysctls that need to be applied after an interface is created (e.g. net.ipv6.conf.eth0.use_tempaddr).

Something like this is kinda broken anyway, since it is racy: you can apply the sysctl only after the interface is already available.

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

Quoted 4 lines

Are there any plans to better deal with that?
Like e.g. emitting events when some part of the kernel registers a sysctl so userspace can override the compiled in default value?
Or just offer sysfs attributes instead of sysctls?

In a systemd world the ipv6 module is loaded very early and hence the sysctl should always be available, no special setup needed. If the same problem appears in real life with other modules too, then we could order sysctl setting after module loading and fix things by this.

Can't tell you though what to do in a non-systemd world however.

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
#2 lore raw
In reply to Ludwig Nussel
Quoted 13 lines · Lennart Poettering
Quoted 11 lines · Ludwig Nussel

I'm currently struggling to find a sane way to set net.ipv6.conf.default.use_tempaddr.
Traditionally at some point during boot "sysctl -e -q -p /etc/sysctl.conf" is called. That doesn't really work out anymore. The aforementioned setting needs to be applied after the ipv6 module is loaded (could be compiled into the kernel too though) otherwise it wouldn't apply. It needs to be set before a network driver is loaded though as the default value is copied to interfaces specific settings at interface creation time. On top of that there are also network interface specific sysctls that need to be applied after an interface is created (e.g. net.ipv6.conf.eth0.use_tempaddr).

Quoted 2 lines

Something like this is kinda broken anyway, since it is racy: you can apply the sysctl only after the interface is already available.

Exactly.

Quoted 2 lines

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

That's that hack that's currently in place. Network scripts grep /etc/sysctl.conf for interface specific settings...

Quoted 9 lines
Quoted 4 lines

Are there any plans to better deal with that?
Like e.g. emitting events when some part of the kernel registers a sysctl so userspace can override the compiled in default value?
Or just offer sysfs attributes instead of sysctls?

In a systemd world the ipv6 module is loaded very early and hence the sysctl should always be available, no special setup needed. If the same problem appears in real life with other modules too, then we could order sysctl setting after module loading and fix things by this.

Grepping for register_sysctl in the kernel sources shows quite a few modules that use sysctls. A prominent one is nfs.
If you apply sysctl setttings after module loading, specifically network drivers, the ipv6 setting won't have any effect anymore though.

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
#3 lore raw
In reply to Ludwig Nussel
Quoted 18 lines · Ludwig Nussel
Quoted 13 lines · Lennart Poettering
Quoted 11 lines · Ludwig Nussel

I'm currently struggling to find a sane way to set net.ipv6.conf.default.use_tempaddr.
Traditionally at some point during boot "sysctl -e -q -p /etc/sysctl.conf" is called. That doesn't really work out anymore. The aforementioned setting needs to be applied after the ipv6 module is loaded (could be compiled into the kernel too though) otherwise it wouldn't apply. It needs to be set before a network driver is loaded though as the default value is copied to interfaces specific settings at interface creation time. On top of that there are also network interface specific sysctls that need to be applied after an interface is created (e.g. net.ipv6.conf.eth0.use_tempaddr).

Quoted 2 lines

Something like this is kinda broken anyway, since it is racy: you can apply the sysctl only after the interface is already available.

Quoted 7 lines

Exactly.

Quoted 2 lines

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

That's that hack that's currently in place. Network scripts grep /etc/sysctl.conf for interface specific settings...

Urks. What we could do to make this nicer is add a simple prefix match logic to our sysctl apply tool, so that it is easy to apply a subtree of sysctls when the time comes.

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
#4 lore raw
In reply to Ludwig Nussel
Quoted 23 lines · Lennart Poettering
Quoted 22 lines · Ludwig Nussel
Quoted 13 lines · Lennart Poettering
Quoted 11 lines · Ludwig Nussel

I'm currently struggling to find a sane way to set net.ipv6.conf.default.use_tempaddr.
Traditionally at some point during boot "sysctl -e -q -p /etc/sysctl.conf" is called. That doesn't really work out anymore. The aforementioned setting needs to be applied after the ipv6 module is loaded (could be compiled into the kernel too though) otherwise it wouldn't apply. It needs to be set before a network driver is loaded though as the default value is copied to interfaces specific settings at interface creation time. On top of that there are also network interface specific sysctls that need to be applied after an interface is created (e.g. net.ipv6.conf.eth0.use_tempaddr).

Quoted 2 lines

Something like this is kinda broken anyway, since it is racy: you can apply the sysctl only after the interface is already available.

Exactly.

Quoted 2 lines

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

Quoted 6 lines
Quoted 2 lines

That's that hack that's currently in place. Network scripts grep /etc/sysctl.conf for interface specific settings...

Urks. What we could do to make this nicer is add a simple prefix match logic to our sysctl apply tool, so that it is easy to apply a subtree of sysctls when the time comes.

I've sent a patch to the procps maintainer but he has yet to respond. It's not a real solution anyways. It just makes a dirty hack a little more efficient.

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
#5 lore raw
In reply to Ludwig Nussel
Quoted 6 lines · Ludwig Nussel
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

That's that hack that's currently in place. Network scripts grep /etc/sysctl.conf for interface specific settings...

Quoted 7 lines
Quoted 3 lines

Urks. What we could do to make this nicer is add a simple prefix match logic to our sysctl apply tool, so that it is easy to apply a subtree of sysctls when the time comes.

I've sent a patch to the procps maintainer but he has yet to respond. It's not a real solution anyways. It just makes a dirty hack a little more efficient.

Note that systemd does not use the procps' implementation of sysctl, but our own one since the upstream version does not support /etc/sysctl.d/ or anything like this.

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
#6 lore raw
In reply to Ludwig Nussel
Quoted 12 lines · Lennart Poettering
Quoted 10 lines · Ludwig Nussel
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Might be a good idea to just ignore these kinds of settings. Or if this is not possible, then set them from NM or whatever controls the network.

That's that hack that's currently in place. Network scripts grep /etc/sysctl.conf for interface specific settings...

Urks. What we could do to make this nicer is add a simple prefix match logic to our sysctl apply tool, so that it is easy to apply a subtree of sysctls when the time comes.

Quoted 7 lines
Quoted 3 lines

I've sent a patch to the procps maintainer but he has yet to respond. It's not a real solution anyways. It just makes a dirty hack a little more efficient.

Note that systemd does not use the procps' implementation of sysctl, but our own one since the upstream version does not support /etc/sysctl.d/ or anything like this.

procps project has been forked, ML:

http://www.freelists.org/list/procps

The upstream is active and maintained by people from Fedora, Suse and Debian. So, it would be better to contribute to this project than maintain and distribute systemd specific stuff... :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com