]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket-util: refuse "all" and "default" as valid ifnames
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Mar 2021 19:33:15 +0000 (20:33 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 6 Mar 2021 02:26:18 +0000 (11:26 +0900)
Let's avoid collisions with special sysctls.

src/basic/socket-util.c

index 8267988ad9c7f469d7761507099dd53e4e801313..06387bdfd6d2cdb3bcdd5378ecd68eca6fb678c5 100644 (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;