Bug 77466

Summary: systemd-sysctl improperly parses paths
Product: systemd Reporter: David Ford <david+bugs.freedesktop.org>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description David Ford 2014-04-15 06:02:54 UTC
systemd-sysctl doesn't parse /proc paths correctly like sysctl does.

# cat 99-sysctl.conf
net.ipv4.conf.enp3s0/200.proxy_arp_pvlan=1
net.ipv4.conf.enp3s0/200.forwarding=1
net.ipv4.conf.enp3s0/100.forwarding=1
net.ipv4.conf.enp5s0.forwarding=1


# SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-sysctl
[...]
Setting 'net/ipv4/conf/enp3s0/200/proxy_arp_pvlan' to '1'
Failed to write '1' to '/proc/sys/net/ipv4/conf/enp3s0/200/proxy_arp_pvlan': No such file or directory
Setting 'net/ipv4/conf/enp3s0/200/forwarding' to '1'
Failed to write '1' to '/proc/sys/net/ipv4/conf/enp3s0/200/forwarding': No such file or directory
Setting 'net/ipv4/conf/enp3s0/100/forwarding' to '1'
Failed to write '1' to '/proc/sys/net/ipv4/conf/enp3s0/100/forwarding': No such file or directory
Setting 'net/ipv4/conf/enp5s0/forwarding' to '1'

# sysctl -p 99-sysctl.conf
net.ipv4.conf.enp3s0/200.proxy_arp_pvlan = 1
net.ipv4.conf.enp3s0/200.forwarding = 1
net.ipv4.conf.enp3s0/100.forwarding = 1
net.ipv4.conf.enp5s0.forwarding = 1
Comment 1 Zbigniew Jedrzejewski-Szmek 2014-04-15 12:48:33 UTC
AFAICT, sysctl replaces '.' with '/', and '/' with '.'. So it'll write /proc/sys/net/ipv4/conf/enp3s0.200/forwarding

Do you have a file with a dot in the name?
Comment 2 David Ford 2014-04-15 16:02:35 UTC
it's posted as the first section in my report.
Comment 3 Zbigniew Jedrzejewski-Szmek 2014-04-15 16:50:05 UTC
Where exactly?
Comment 4 David Ford 2014-04-15 17:03:32 UTC
# cat 99-sysctl.conf
net.ipv4.conf.enp3s0/200.proxy_arp_pvlan=1
net.ipv4.conf.enp3s0/200.forwarding=1
net.ipv4.conf.enp3s0/100.forwarding=1
net.ipv4.conf.enp5s0.forwarding=1


sysctl -p /etc/sysctl.d/99-sysctl.conf will parse this correctly. systemd-sysctl will not parse the first three lines correctly.
Comment 5 Zbigniew Jedrzejewski-Szmek 2014-04-15 17:06:32 UTC
> net.ipv4.conf.enp3s0/200.proxy_arp_pvlan=1
The question is how is the *file* that sysctl writes to called?
Comment 6 David Ford 2014-04-15 17:30:20 UTC
exactly opposite the conf file syntax. e.g.:

/proc/sys/net/ipv4/conf/enp3s0.200/proxy_arp_pvlan
Comment 7 Lennart Poettering 2014-04-15 21:44:10 UTC
So you are saying that the classic sysctl tool actually maps "." to "/" and "/" to "." in the fs?

How incredibly awful.
Comment 8 David Ford 2014-04-15 23:32:15 UTC
i'll agree, it turned out to be awkward, but it's the standard we've had for two decades :}
Comment 9 Zbigniew Jedrzejewski-Szmek 2014-04-17 02:25:35 UTC
Fixed in http://cgit.freedesktop.org/systemd/systemd/commit/?id=2e573fc.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.