Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Replace '.' with '/' on sysctl interface names #9

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

jcaamano
Copy link
Contributor

No description provided.

@maiqueb
Copy link
Owner

maiqueb commented Jan 13, 2020

Why is this change needed ? What error do you see without this change ?

I'm specifically interested in why macvlan (where we've 'looted' this from) does not require it, check its implementation here.

@jcaamano
Copy link
Contributor Author

From http://man7.org/linux/man-pages/man5/sysctl.d.5.html

Note that either "/" or "." may be used as separators within sysctl
variable names. If the first separator is a slash, remaining slashes
and dots are left intact. If the first separator is a dot, dots and
slashes are interchanged. "kernel.domainname=foo" and
"kernel/domainname=foo" are equivalent and will cause "foo" to be
written to /proc/sys/kernel/domainname. Either
"net.ipv4.conf.enp3s0/200.forwarding" or
"net/ipv4/conf/enp3s0.200/forwarding" may be used to refer to
/proc/sys/net/ipv4/conf/enp3s0.200/forwarding.

If you get an interface name from DeviceID such as eth0.1, the correct key to use under sysctl is net.ipv4.conf.eth0/1... or net/ipv4/conf/eth0.1.... Otherwise you get an error such as /proc/sys/net.ipv4.conf.eth0/1... not found

sysctl package also needs fixing: containernetworking/plugins#437

macvlan cni does not need it because it is not using interface names that include dots at that time.

Interface names with dots in them need to be replaced with slashes when
used in sysctl keys using dots as separator.

Reference: http://man7.org/linux/man-pages/man5/sysctl.d.5.html
@maiqueb maiqueb merged commit 157b973 into maiqueb:master Feb 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants