1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

socket-util: refuse "all" and "default" as valid ifnames

Let's avoid collisions with special sysctls.
This commit is contained in:
Lennart Poettering 2021-03-05 20:33:15 +01:00 committed by Yu Watanabe
parent 5d5b6442a2
commit 07a7441a1c

View File

@ -736,6 +736,11 @@ bool ifname_valid_full(const char *p, IfnameValidFlags flags) {
if (dot_or_dot_dot(p))
return false;
/* Let's refuse "all" and "default" as interface name, to avoid collisions with the special sysctl
* directories /proc/sys/net/{ipv4,ipv6}/conf/{all,default} */
if (STR_IN_SET(p, "all", "default"))
return false;
for (const char *t = p; *t; t++) {
if ((unsigned char) *t >= 127U)
return false;