summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/socket-util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 8267988ad9..06387bdfd6 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -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;