]> git.ipfire.org Git - thirdparty/systemd.git/commit
socket-util: refuse ifnames with embedded '%' as invalid
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Mar 2021 19:43:02 +0000 (20:43 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 10 Mar 2021 02:11:52 +0000 (11:11 +0900)
commite5f8ce13bbaf0d8b9ff597692c67fba0e38b4200
tree7bb4f2624a7b75e7a4157e01f37b527fa77540cc
parentbef1e1a06602dd7771699ff079ed32f5ea34122c
socket-util: refuse ifnames with embedded '%' as invalid

So Linux has this (insane — in my opinion) "feature" that if you name a
network interface "foo%d" then it will automatically look for the
interface starting with "foo…" with the lowest number that is not used
yet and allocates that.

We should never clash with this "magic" handling of ifnames, hence
refuse this, since otherwise we never know what the name is we end up
with.

We should probably switch things from a deny list to an allow list
sooner or later and be much stricter. Since the kernel directly enforces
only very few rules on the names, we'd need to do some research what is
safe and what is not first, though.
src/basic/socket-util.c
src/test/test-socket-netlink.c