From: Aaro Koskinen <[email protected]>
Busybox sysctl is incompatible with procps when '.' appears in
directory name, mostly happens with VLANs.
busybox syntax (since 2008): net.ipv4.conf.eth0.100.mc_forwarding
procps syntax (since 2002): net.ipv4.conf.eth0/100.mc_forwarding
(supported by both: net/ipv4/conf/eth0.100/mc_forwarding)
Use procps syntax for output; for input, allow both.
Signed-off-by: Aaro Koskinen <[email protected]>
---
v2: Drop the config option, and support the busybox-specific syntax on
input.
procps/sysctl.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 5fa7646d1..eb5ed37dc 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -57,7 +57,28 @@ enum {
static void sysctl_dots_to_slashes(char *name)
{
char *cptr, *last_good, *end;
+ int n = 0;
+ if (!strchr(name, '/'))
+ goto busybox_old_syntax;
+
+ cptr = name;
+ while (*cptr) {
+ if (*cptr == '.') {
+ *cptr = '/';
+ n++;
+ } else if (*cptr == '/') {
+ if (!n)
+ return; /* slash syntax is used */
+ *cptr = '.';
+ } else if (*cptr == '=') {
+ return;
+ }
+ cptr++;
+ }
+ return;
+
+busybox_old_syntax:
/* Convert minimum number of '.' to '/' so that
* we end up with existing file's name.
*
@@ -112,6 +133,8 @@ static int sysctl_act_on_setting(char *setting)
while (*cptr) {
if (*cptr == '/')
*cptr = '.';
+ else if (*cptr == '.')
+ *cptr = '/';
cptr++;
}
--
2.17.0
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox