[openwrt/openwrt] firewall: options: fix parsing of boolean attributes
LEDE Commits
lede-commits at lists.infradead.org
Sat Oct 17 18:34:12 EDT 2020
hauke pushed a commit to openwrt/openwrt.git, branch openwrt-18.06:
https://git.openwrt.org/27677af27cba2c3c46cace9675f69bda3c616153
commit 27677af27cba2c3c46cace9675f69bda3c616153
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Wed Sep 30 23:19:02 2020 +0200
firewall: options: fix parsing of boolean attributes
Boolean attributes were parsed the same way as string attributes,
so a value of { "bool_attr": "true" } would be parsed correctly, but
{ "bool_attr": true } (without quotes) was parsed as false.
Fixes FS#3284
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
(cherry picked from commit 7f676b5ed6a2bcd6786a0fcb6a6db3ddfeedf795)
---
package/network/config/firewall/Makefile | 2 +-
...options-fix-parsing-of-boolean-attributes.patch | 38 ++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile
index 7a91924d01..d69269ab49 100644
--- a/package/network/config/firewall/Makefile
+++ b/package/network/config/firewall/Makefile
@@ -9,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=firewall
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git
diff --git a/package/network/config/firewall/patches/0002-options-fix-parsing-of-boolean-attributes.patch b/package/network/config/firewall/patches/0002-options-fix-parsing-of-boolean-attributes.patch
new file mode 100644
index 0000000000..c7a4593f1d
--- /dev/null
+++ b/package/network/config/firewall/patches/0002-options-fix-parsing-of-boolean-attributes.patch
@@ -0,0 +1,38 @@
+From 78d52a28c66ad0fd2af250038fdcf4239ad37bf2 Mon Sep 17 00:00:00 2001
+From: Remi NGUYEN VAN <remi.nguyenvan+openwrt at gmail.com>
+Date: Sat, 15 Aug 2020 13:50:27 +0900
+Subject: [PATCH] options: fix parsing of boolean attributes
+
+Boolean attributes were parsed the same way as string attributes,
+so a value of { "bool_attr": "true" } would be parsed correctly, but
+{ "bool_attr": true } (without quotes) was parsed as false.
+
+Fixes FS#3284
+
+Signed-off-by: Remi NGUYEN VAN <remi.nguyenvan+openwrt at gmail.com>
+---
+ options.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/options.c
++++ b/options.c
+@@ -1170,6 +1170,9 @@ fw3_parse_blob_options(void *s, const st
+ if (blobmsg_type(e) == BLOBMSG_TYPE_INT32) {
+ snprintf(buf, sizeof(buf), "%d", blobmsg_get_u32(e));
+ v = buf;
++ } else if (blobmsg_type(o) == BLOBMSG_TYPE_BOOL) {
++ snprintf(buf, sizeof(buf), "%d", blobmsg_get_bool(o));
++ v = buf;
+ } else {
+ v = blobmsg_get_string(e);
+ }
+@@ -1189,6 +1192,9 @@ fw3_parse_blob_options(void *s, const st
+ if (blobmsg_type(o) == BLOBMSG_TYPE_INT32) {
+ snprintf(buf, sizeof(buf), "%d", blobmsg_get_u32(o));
+ v = buf;
++ } else if (blobmsg_type(o) == BLOBMSG_TYPE_BOOL) {
++ snprintf(buf, sizeof(buf), "%d", blobmsg_get_bool(o));
++ v = buf;
+ } else {
+ v = blobmsg_get_string(o);
+ }
More information about the lede-commits
mailing list