Skip to content

sysctl: accept slash-separated sysctl names - #2551

Closed
ijajmulani wants to merge 1 commit into
containers:mainfrom
ijajmulani:sysctl-allow-slash-separator
Closed

ijajmulani wants to merge 1 commit into
containers:mainfrom
ijajmulani:sysctl-allow-slash-separator

Conversation

@ijajmulani

Copy link
Copy Markdown

What this PR does / why we need it

Podman rejects slash-separated sysctl keys with:
sysctl 'net/ipv6/conf/bond1.340/autoconf' is not allowed

[root@mymachine ~]# docker run --rm -ti --name c1 --network bond1.340   --sysctl=net/ipv6/conf/bond1.340/autoconf=0   quay.io/libpod/busybox
Error: sysctl 'net/ipv6/conf/bond1.340/autoconf' is not allowed

pkg/sysctl.Validate() only accepts keys whose normalized form matches prefixes like net. or fs.mqueue.. Slash-first sysctl names are valid per sysctl.d(5) but fail the prefix check. This is a problem for network interfaces whose names contain dots (e.g. VLAN interfaces like bond1.340). For those, slash-first notation is required to set per-interface sysctls such as
net/ipv6/conf/bond1.340/autoconf.

Which issue(s) this PR fixes

N/A (no existing issue filed)

Special notes for reviewers

  • Normalization follows the same rules as
    opencontainers/runc#3257.
  • Validation uses the normalized key; the original user-provided key is
    preserved in the returned map passed to the runtime.
  • Runtime path handling is separate (e.g. crun); this PR only fixes
    Podman's allowlist validation in containers/common.

User-visible impact

Users can pass slash-separated sysctls to Podman, e.g.:

podman run --sysctl net/ipv6/conf/bond1.340/autoconf=0 

Dot-first escaped form (net.ipv6.conf.bond1/340.autoconf=0) was already accepted by prefix check; slash-first form was not.

How this was tested
go test ./pkg/sysctl/
Unit tests for convertSysctlVariableToDotsSeparator() and slash-separated VLAN interface keys
Manual: podman run --sysctl net/ipv6/conf/bond1.340/autoconf=0 with macvlan/ipvlan on a VLAN parent interface

Signed-off-by: Ijaj Mulani <ijaj.mulani@cohesity.com>
@github-actions

Copy link
Copy Markdown

This repository has been migrated to https://github.com/containers/container-libs. Please open your PR there.

@github-actions github-actions Bot closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant