fw3: zones: limit zone names to 11 bytes
authorAlexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
Sun, 30 Aug 2020 21:10:09 +0000 (00:10 +0300)
committerDavid Bauer <mail@david-bauer.net>
Sat, 5 Sep 2020 10:52:05 +0000 (12:52 +0200)
As defined in currently used iptables v1.8.4, chain name must be
under 29 chars. Thus, user can only edit 11 chars.

See also the bugreport [0].

[0] https://dev.archive.openwrt.org/ticket/20380

Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
[improve commit description, move length calculation information to src]
Signed-off-by: David Bauer <mail@david-bauer.net>
zones.h

diff --git a/zones.h b/zones.h
index d78673664cd73c9e956695956235539be5d6237f..beb0e220bca1472eaf5023453dd59c6182a6d732 100644 (file)
--- a/zones.h
+++ b/zones.h
 #include "options.h"
 #include "iptables.h"
 
-/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */
-#define FW3_ZONE_MAXNAMELEN 14
+/* XT_EXTENSION_MAXNAMELEN (29)
+ *  - sizeof("postrouting_")
+ *  - sizeof("_rule")
+ *  - sizeof("\0")
+ */
+#define FW3_ZONE_MAXNAMELEN 11
 
 extern const struct fw3_option fw3_zone_opts[];