fw4.uc: introduce DEPRECATED flag
authorStijn Tintel <stijn@linux-ipv6.be>
Thu, 25 Nov 2021 04:01:51 +0000 (06:01 +0200)
committerStijn Tintel <stijn@linux-ipv6.be>
Thu, 6 Jan 2022 12:51:44 +0000 (14:51 +0200)
When a section contains unknown options, the parse_options function will
return false, and based on that the entire section might be skipped.
For example, rules containing a _name option will be skipped. As this
option used to be added by LuCI in the past, we should not skip those
rules, as it might break existing configs for many users.

Add a new DEPRECATED flag to handle such options.

Suggested-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
root/usr/share/ucode/fw4.uc

index 8057fac628581dec64010f9898d56c4f6273e981..df5ab876f4ed12b352ec444ceb06631467e7bdcf 100644 (file)
@@ -11,6 +11,7 @@ let FLATTEN_LIST = 0x02;
 let NO_INVERT    = 0x04;
 let UNSUPPORTED  = 0x08;
 let REQUIRED     = 0x10;
+let DEPRECATED   = 0x20;
 
 let ipv4_icmptypes = {
        "any": [ 0xFF, 0, 0xFF ],
@@ -622,7 +623,9 @@ return {
                        }
 
                        if (res != null) {
-                               if (flags & UNSUPPORTED)
+                               if (flags & DEPRECATED)
+                                       this.warn_section(s, "option '" + key + "' is deprecated by fw4");
+                               else if (flags & UNSUPPORTED)
                                        this.warn_section(s, "option '" + key + "' is not supported by fw4");
                                else
                                        rv[key] = res;