[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1329476631.2861.8.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date: Fri, 17 Feb 2012 12:03:51 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Denys Fedoryshchenko <denys@...p.net.lb>
Cc: netdev@...r.kernel.org, "Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: sysfs warnings, reserved names
Le vendredi 17 février 2012 à 11:37 +0100, Eric Dumazet a écrit :
> Le vendredi 17 février 2012 à 12:14 +0200, Denys Fedoryshchenko a
> écrit :
> > Hi
> >
> > Just did a test:
> >
> > ip link set dev eth1 name default
> >
> > And got a lot of (expected) sysfs warnings:
> > [1068625.677143] sysctl table check failed:
> > /net/ipv4/conf/default/promote_secondaries Sysctl already exists
> > [1068625.677151] Pid: 18106, comm: ip Not tainted 3.2.4-centaur #1
> > and etc
> >
> > Kernel 3.2.4, but i guess it doesn't matter much.
> > Maybe such names (as all and default) should be "reserved"?
> > Or it is ok like that?
> >
>
> You're right, we should forbid this to happen.
>
>
Following is a quick hack, I CC Eric because its probaly better to
address this in sysfs.
diff --git a/net/core/dev.c b/net/core/dev.c
index 763a0ed..ec68f89 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -856,7 +856,11 @@ int dev_valid_name(const char *name)
return 0;
if (!strcmp(name, ".") || !strcmp(name, ".."))
return 0;
-
+#if defined(CONFIG_SYSCTL) && defined(CONFIG_INET)
+ /* /proc/sys/net/ipv{4|6}/conf/{default|all} are reserved */
+ if (!strcmp(name, "default") || !strcmp(name, "all"))
+ return 0;
+#endif
while (*name) {
if (*name == '/' || isspace(*name))
return 0;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists