[OpenWrt-Devel] [PATCH uqmi 1/3] Added option for enabling and disabling protection of simcard by PIN
Signed-off-by: Sławomir Demeszko s.demes...@wireless-instruments.com --- commands-dms.c | 53 + commands-dms.h | 7 +++ 2 files changed, 60 insertions(+) diff --git a/commands-dms.c b/commands-dms.c index ad5c89d..360e926 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -75,6 +75,59 @@ cmd_dms_verify_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct return QMI_CMD_REQUEST; } +static struct qmi_dms_uim_set_pin_protection_request dms_pin_protection_req = { + QMI_INIT_SEQUENCE(info, + .pin_id = QMI_DMS_UIM_PIN_ID_PIN + ) + }; + +#define cmd_dms_set_pin_cb no_cb +static enum qmi_cmd_result +cmd_dms_set_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + qmi_set_ptr(dms_pin_protection_req, info.pin, arg); + return QMI_CMD_DONE; +} + +static enum qmi_cmd_result +cmd_dms_set_pin_protection_prepare(struct qmi_msg *msg, char *arg) +{ + if (!dms_pin_protection_req.data.info.pin) { + uqmi_add_error(Missing argument); + return QMI_CMD_EXIT; + } + + int is_enabled; + if (strcasecmp(arg, disabled) == 0) + is_enabled = false; + else if (strcasecmp(arg, enabled) == 0) + is_enabled = true; + else { + uqmi_add_error(Invalid value (valid: disabled, enabled)); + return QMI_CMD_EXIT; + } + + qmi_set_ptr(dms_pin_protection_req, info.protection_enabled, is_enabled); + qmi_set_dms_uim_set_pin_protection_request(msg, dms_pin_protection_req); + return QMI_CMD_REQUEST; +} + +#define cmd_dms_set_pin1_protection_cb no_cb +static enum qmi_cmd_result +cmd_dms_set_pin1_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + qmi_set_ptr(dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN); + return cmd_dms_set_pin_protection_prepare(msg, arg); +} + +#define cmd_dms_set_pin2_protection_cb no_cb +static enum qmi_cmd_result +cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + qmi_set_ptr(dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2); + return cmd_dms_set_pin_protection_prepare(msg, arg); +} + static struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = { QMI_INIT_SEQUENCE(info, .pin_id = QMI_DMS_UIM_PIN_ID_PIN diff --git a/commands-dms.h b/commands-dms.h index 703b9f7..e214975 100644 --- a/commands-dms.h +++ b/commands-dms.h @@ -2,6 +2,9 @@ __uqmi_command(dms_get_pin_status, get-pin-status, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_verify_pin1, verify-pin1, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_verify_pin2, verify-pin2, required, QMI_SERVICE_DMS), \ + __uqmi_command(dms_set_pin1_protection, set-pin1-protection, required, QMI_SERVICE_DMS), \ + __uqmi_command(dms_set_pin2_protection, set-pin2-protection, required, QMI_SERVICE_DMS), \ + __uqmi_command(dms_set_pin, pin, required, CMD_TYPE_OPTION), \ __uqmi_command(dms_unblock_pin1, unblock-pin1, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_unblock_pin2, unblock-pin2, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_puk, puk, required, CMD_TYPE_OPTION), \ @@ -16,6 +19,10 @@ --get-pin-status: Get PIN verification status\n \ --verify-pin1 pin: Verify PIN1\n \ --verify-pin2 pin: Verify PIN2\n \ + --set-pin1-protection state:Set PIN1 protection state (disabled, enabled)\n \ + --pin pin:PIN1 needed to change state\n \ + --set-pin2-protection state:Set PIN2 protection state (disabled, enabled)\n \ + --pin pin2: PIN2 needed to change state\n \ --unblock-pin1: Unblock PIN1\n \ --puk puk:PUK needed to unblock\n \ --new-pin new pin:New pin\n \ -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH uqmi 3/3] Added commands to change PIN code
Signed-off-by: Sławomir Demeszko s.demes...@wireless-instruments.com --- commands-dms.c | 36 commands-dms.h | 8 2 files changed, 44 insertions(+) diff --git a/commands-dms.c b/commands-dms.c index 76144cf..277223d 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -136,6 +136,42 @@ cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req return cmd_dms_set_pin_protection_prepare(msg, arg); } +static enum qmi_cmd_result +cmd_dms_change_pin_prepare(struct qmi_msg *msg, char *arg) +{ + if (!dms_req_data.pin || !dms_req_data.new_pin) { + uqmi_add_error(Missing argument); + return QMI_CMD_EXIT; + } + + static struct qmi_dms_uim_change_pin_request dms_change_pin_req = { + QMI_INIT_SEQUENCE(info, + .pin_id = dms_req_data.pin_id + ), + QMI_INIT_PTR(info.old_pin, dms_req_data.pin), + QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin) + }; + + qmi_set_dms_uim_change_pin_request(msg, dms_change_pin_req); + return QMI_CMD_REQUEST; +} + +#define cmd_dms_change_pin1_cb no_cb +static enum qmi_cmd_result +cmd_dms_change_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN; + return cmd_dms_change_pin_prepare(msg, arg); +} + +#define cmd_dms_change_pin2_cb no_cb +static enum qmi_cmd_result +cmd_dms_change_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN2; + return cmd_dms_change_pin_prepare(msg, arg); +} + #define cmd_dms_set_new_pin_cb no_cb static enum qmi_cmd_result cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) diff --git a/commands-dms.h b/commands-dms.h index e214975..925aea3 100644 --- a/commands-dms.h +++ b/commands-dms.h @@ -5,6 +5,8 @@ __uqmi_command(dms_set_pin1_protection, set-pin1-protection, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_pin2_protection, set-pin2-protection, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_pin, pin, required, CMD_TYPE_OPTION), \ + __uqmi_command(dms_change_pin1, change-pin1, no, QMI_SERVICE_DMS), \ + __uqmi_command(dms_change_pin2, change-pin2, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_unblock_pin1, unblock-pin1, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_unblock_pin2, unblock-pin2, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_puk, puk, required, CMD_TYPE_OPTION), \ @@ -23,6 +25,12 @@ --pin pin:PIN1 needed to change state\n \ --set-pin2-protection state:Set PIN2 protection state (disabled, enabled)\n \ --pin pin2: PIN2 needed to change state\n \ + --change-pin1:Change PIN1\n \ + --pin old pin:Current PIN1\n \ + --new-pin new pin:New pin\n \ + --change-pin2:Change PIN2\n \ + --pin old pin:Current PIN2\n \ + --new-pin new pin:New pin\n \ --unblock-pin1: Unblock PIN1\n \ --puk puk:PUK needed to unblock\n \ --new-pin new pin:New pin\n \ -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH uqmi 2/3] Added shared struct to allow the same option names for different functions
For example we can use one option --new-pin with commands unblock-pin and with change-pin, without that we need to invent new name for every new command. Signed-off-by: Sławomir Demeszko s.demes...@wireless-instruments.com --- commands-dms.c | 64 +++--- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/commands-dms.c b/commands-dms.c index 360e926..76144cf 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -1,5 +1,12 @@ #include qmi-message.h +static struct { + QmiDmsUimPinId pin_id; + char* pin; + char* new_pin; + char* puk; +} dms_req_data; + static const char *get_pin_status(int status) { static const char *pin_status[] = { @@ -75,24 +82,18 @@ cmd_dms_verify_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct return QMI_CMD_REQUEST; } -static struct qmi_dms_uim_set_pin_protection_request dms_pin_protection_req = { - QMI_INIT_SEQUENCE(info, - .pin_id = QMI_DMS_UIM_PIN_ID_PIN - ) - }; - #define cmd_dms_set_pin_cb no_cb static enum qmi_cmd_result cmd_dms_set_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_pin_protection_req, info.pin, arg); + dms_req_data.pin = arg; return QMI_CMD_DONE; } static enum qmi_cmd_result cmd_dms_set_pin_protection_prepare(struct qmi_msg *msg, char *arg) { - if (!dms_pin_protection_req.data.info.pin) { + if (!dms_req_data.pin) { uqmi_add_error(Missing argument); return QMI_CMD_EXIT; } @@ -107,7 +108,14 @@ cmd_dms_set_pin_protection_prepare(struct qmi_msg *msg, char *arg) return QMI_CMD_EXIT; } - qmi_set_ptr(dms_pin_protection_req, info.protection_enabled, is_enabled); + struct qmi_dms_uim_set_pin_protection_request dms_pin_protection_req = { + QMI_INIT_SEQUENCE(info, + .pin_id = dms_req_data.pin_id + ), + QMI_INIT_PTR(info.pin, dms_req_data.pin), + QMI_INIT_PTR(info.protection_enabled, is_enabled) + }; + qmi_set_dms_uim_set_pin_protection_request(msg, dms_pin_protection_req); return QMI_CMD_REQUEST; } @@ -116,7 +124,7 @@ cmd_dms_set_pin_protection_prepare(struct qmi_msg *msg, char *arg) static enum qmi_cmd_result cmd_dms_set_pin1_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN); + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN; return cmd_dms_set_pin_protection_prepare(msg, arg); } @@ -124,21 +132,15 @@ cmd_dms_set_pin1_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req static enum qmi_cmd_result cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_pin_protection_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2); + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN2; return cmd_dms_set_pin_protection_prepare(msg, arg); } -static struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = { - QMI_INIT_SEQUENCE(info, - .pin_id = QMI_DMS_UIM_PIN_ID_PIN - ) - }; - #define cmd_dms_set_new_pin_cb no_cb static enum qmi_cmd_result cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_unlock_pin_req, info.new_pin, arg); + dms_req_data.new_pin = arg; return QMI_CMD_DONE; } @@ -146,7 +148,7 @@ cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct static enum qmi_cmd_result cmd_dms_set_puk_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_unlock_pin_req, info.puk, arg); + dms_req_data.puk = arg; return QMI_CMD_DONE; } @@ -154,13 +156,19 @@ cmd_dms_set_puk_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi static enum qmi_cmd_result cmd_dms_unblock_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - qmi_set_ptr(dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN); - - if (!dms_unlock_pin_req.data.info.puk || !dms_unlock_pin_req.data.info.new_pin) { + if (!dms_req_data.puk || !dms_req_data.new_pin) { uqmi_add_error(Missing argument); return QMI_CMD_EXIT; } + struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = { + QMI_INIT_SEQUENCE(info, + .pin_id = QMI_DMS_UIM_PIN_ID_PIN + ), + QMI_INIT_PTR(info.puk, dms_req_data.puk), + QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin)
[OpenWrt-Devel] [PATCH uqmi] Add support for 16-bit reference number in concatenated SMS.
Signed-off-by: Sławomir Demeszko s.demes...@wireless-instruments.com --- commands-wms.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands-wms.c b/commands-wms.c index 47d4d76..6ac52eb 100644 --- a/commands-wms.c +++ b/commands-wms.c @@ -179,11 +179,16 @@ static int decode_udh(const unsigned char *data) break; switch (type) { - case 0: + case 0x00: blobmsg_add_u32(status, concat_ref, (uint32_t) val[0]); blobmsg_add_u32(status, concat_part, (uint32_t) val[2]); blobmsg_add_u32(status, concat_parts, (uint32_t) val[1]); break; + case 0x08: + blobmsg_add_u32(status, concat_ref, (uint32_t) (val[0] 8 | val[1])); + blobmsg_add_u32(status, concat_part, (uint32_t) val[3]); + blobmsg_add_u32(status, concat_parts, (uint32_t) val[2]); + break; default: break; } -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] binutils: break-out libbfd, libopcodes and ar
Package libbfd, libopcodes and ar seperately. Signed-off-by: Daniel Golle dan...@makrotopia.org --- package/devel/binutils/Makefile | 50 - 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/package/devel/binutils/Makefile b/package/devel/binutils/Makefile index ff968b9..cf77690 100644 --- a/package/devel/binutils/Makefile +++ b/package/devel/binutils/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=binutils PKG_VERSION:=2.24 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=@GNU/binutils PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -27,18 +27,39 @@ PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk +define Package/libbfd + SECTION:=libs + CATEGORY:=Libraries + TITLE:=libbfd + DEPENDS:=+zlib +endef + +define Package/libopcodes + SECTION:=libs + CATEGORY:=Libraries + TITLE:=libbfd + DEPENDS:=+libbfd +endef + define Package/binutils SECTION:=devel CATEGORY:=Development TITLE:=binutils - DEPENDS:=+objdump + DEPENDS:=+objdump +ar endef define Package/objdump SECTION:=devel CATEGORY:=Development TITLE:=objdump - DEPENDS:=+zlib + DEPENDS:=+libopcodes +endef + +define Package/ar + SECTION:=devel + CATEGORY:=Development + TITLE:=ar + DEPENDS:=+zlib +libbfd endef define Package/binutils/description @@ -65,11 +86,24 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/* $(1)/ endef +define Package/libbfd/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/ +endef + +define Package/libopcodes/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/ +endef + define Package/objdump/install - $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/ +endef + +define Package/ar/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ar $(1)/usr/bin/ endef define Package/binutils/install @@ -77,7 +111,11 @@ define Package/binutils/install $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/ mv $(1)/usr/bin/strings $(1)/bin/strings rm -f $(1)/usr/bin/objdump + rm -f $(1)/usr/bin/ar endef +$(eval $(call BuildPackage,libbfd)) +$(eval $(call BuildPackage,libopcodes)) $(eval $(call BuildPackage,binutils)) $(eval $(call BuildPackage,objdump)) +$(eval $(call BuildPackage,ar)) -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH fstools] support UBI blocks (volumes)
We already had ubifs idinfo, so only /dev/ubiN_M support was missing. Signed-off-by: Rafał Miłecki zaj...@gmail.com --- block.c | 1 + libblkid-tiny/libblkid-tiny.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index bba68c2..68cfd5a 100644 --- a/block.c +++ b/block.c @@ -481,6 +481,7 @@ static void cache_load(int mtd) if (mtd) { _cache_load(/dev/mtdblock*); _cache_load(/dev/ubiblock*); + _cache_load(/dev/ubi?*_?*); } _cache_load(/dev/mmcblk*); _cache_load(/dev/sd*); diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c index a01a43e..1e641f7 100644 --- a/libblkid-tiny/libblkid-tiny.c +++ b/libblkid-tiny/libblkid-tiny.c @@ -174,7 +174,7 @@ int probe_block(char *block, struct blkid_struct_probe *pr) struct stat s; int i; - if (stat(block, s) || (!S_ISBLK(s.st_mode) !S_ISREG(s.st_mode))) + if (stat(block, s) || (!S_ISBLK(s.st_mode) !S_ISREG(s.st_mode) !strncmp(block, ubi, 3))) return -1; pr-err = -1; -- 1.8.4.5 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] dnsmasq: allow de-selecting features from -full variant.
Hi yousong, thanks for the patch. A few issues/comments: Am 17.12.2014 um 02:21 schrieb Yousong Zhou: Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- package/network/services/dnsmasq/Makefile | 27 ++-- .../network/services/dnsmasq/files/dnsmasq.init|5 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index a530225..2da593d 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.72 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq @@ -72,6 +72,26 @@ define Package/dnsmasq/conffiles /etc/dnsmasq.conf endef +define Package/dnsmasq/config/Default + if PACKAGE_$(1)-$(2) + config PACKAGE_dnsmasq_$(2)_dhcpv6 +bool Build with DHCPv6 support. +default y This config needs to depend on IPV6 + config PACKAGE_dnsmasq_$(2)_dnssec +bool Build with DNSSEC support. +default y This config needs to select PACKAGE_libnettle + config PACKAGE_dnsmasq_$(2)_auth +bool Build with the facility to act as an authoritative DNS server. +default y + config PACKAGE_dnsmasq_$(2)_ipset +bool Build with ipset support. +select PACKAGE_kmod-ipt-ipset +default y + endif +endef It would be nice if this would appear in a submenu and only if the dnsmasq package is enabled. + +Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full) + Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles) Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles) @@ -85,7 +105,10 @@ ifeq ($(BUILD_VARIANT),nodhcpv6) endif ifeq ($(BUILD_VARIANT),full) - COPTS += -DHAVE_DNSSEC + COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET) COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,) else COPTS += -DNO_AUTH -DNO_IPSET The installation section Package/dnsmasq-full/install should be modified, too: if DNSSEC is not enabled, there's no need to install trust-anchors.conf --- The patch leaves the main problem unsolved: you still have to enable the whole IPv6 stuff for DNS Auth / DNSSEC / IPSET support. I personally have no problems with migrating from package variants to the configure at build time approach. But I don't think they should be mixed together. The dnsmasq-full package with only dhcpv6 enabled is exactly the same as the dnsmasq-dhcpv6 package variant. And as soon as you deselect one of the config options, dnsmasq-full actually isn't a full package anymore, right ? ;-) IMHO too much inconsistencies. If we go this way, I would prefer having just a single (fully configurable) dnsmasq package. I'll send a patch later this evening. Regards, Frank diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 942acd7..209952b 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -85,6 +85,10 @@ append_address() { xappend --address=$1 } +append_ipset() { + xappend --ipset=$1 +} + append_interface() { local ifname=$(uci_get_state network $1 ifname $1) xappend --interface=$ifname @@ -135,6 +139,7 @@ dnsmasq() { append_parm $cfg local --server config_list_foreach $cfg server append_server config_list_foreach $cfg address append_address + config_list_foreach $cfg ipset append_ipset config_list_foreach $cfg interface append_interface config_list_foreach $cfg notinterface append_notinterface config_list_foreach $cfg addnhosts append_addnhosts ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH uqmi] Add mandatory field to Initiate Network Register
According to json data Action field in Initiate Network Register is mandatory. I get Missing argument from qmi without it. Signed-off-by: Sławomir Demeszko s.demes...@wireless-instruments.com --- commands-nas.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands-nas.c b/commands-nas.c index ccc58ab..7c433ed 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -103,7 +103,10 @@ cmd_nas_set_roaming_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct static enum qmi_cmd_result cmd_nas_initiate_network_register_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) { - static struct qmi_nas_initiate_network_register_request register_req; + static struct qmi_nas_initiate_network_register_request register_req = { + QMI_INIT(action, QMI_NAS_NETWORK_REGISTER_TYPE_AUTOMATIC) + }; + qmi_set_nas_initiate_network_register_request(msg, register_req); return QMI_CMD_REQUEST; } -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] ar8216: phy_init and bug report 18415
Am 17.12.2014 um 08:47 schrieb Weedy: On Nov 28, 2014 3:24 PM, Weedy weedy2...@gmail.com mailto:weedy2...@gmail.com wrote: On Nov 28, 2014 5:23 AM, Heiner Kallweit hkallwe...@gmail.com mailto:hkallwe...@gmail.com wrote: Anybody with a 8216-based device who can test this? Me me me, me me. 4300 currently running trunk with 43332 reverted. I am at your service. Is the current trunk fixed? You never replied after this. Do I need to keep 43332 reverted to keep autoneg working? Ticket 18415 was closed as it was confirmed that as at least version =43419 is ok. (I assume 43410 fixed the issue.) Therefore current trunk should be ok. However if you want to check further what the actual root cause was: - Re-enable the additional reset by reverting 43410 - Issue there? - If yes, check whether inserting a mdiobus_write(bus, i, MII_BMCR, BMCR_ANENABLE); before mdiobus_write(bus, i, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); in ar8xxx_phy_init fixes it. Heiner ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH fstools] block: allow mounting UBIFS partition as extroot
Signed-off-by: Rafał Miłecki zaj...@gmail.com --- block.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 68cfd5a..107ba64 100644 --- a/block.c +++ b/block.c @@ -598,6 +598,10 @@ static void check_filesystem(struct blkid_struct_probe *pr) struct stat statbuf; char *e2fsck = /usr/sbin/e2fsck; + /* UBIFS does not need stuff like fsck */ + if (!strncmp(pr-id-name, ubifs, 5)) + return; + if (strncmp(pr-id-name, ext, 3)) { ERROR(check_filesystem: %s is not supported\n, pr-id-name); return; @@ -974,7 +978,8 @@ static int mount_extroot(char *cfg) pr = find_block_info(m-uuid, m-label, m-device); } if (pr) { - if (strncmp(pr-id-name, ext, 3)) { + if (strncmp(pr-id-name, ext, 3) + strncmp(pr-id-name, ubifs, 5)) { ERROR(extroot: %s is not supported, try ext4\n, pr-id-name); return -1; } -- 1.8.4.5 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH fstools] block: make sure /etc/ exists on the extroot
Otherwise opening .extroot-uuid could fail. Signed-off-by: Rafał Miłecki zaj...@gmail.com --- block.c | 4 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index 107ba64..c29017d 100644 --- a/block.c +++ b/block.c @@ -911,6 +911,10 @@ static int check_extroot(char *path) char tag[64]; char uuid[64] = { 0 }; + snprintf(tag, sizeof(tag), %s/etc, path); + if (stat(tag, s)) + mkdir_p(tag); + snprintf(tag, sizeof(tag), %s/etc/.extroot-uuid, path); if (stat(tag, s)) { fp = fopen(tag, w+); -- 1.8.4.5 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 00/16] uci: fix issues caused by newly-added multiline option value support.
This patch set mainly tries to - Fix heap memory management issues. - Add test more cases with multiline option value and quotes in mind. - Fix issues of uci show, revert, add_list, del_list, batch commands. My previous patch set for adding support for multiline option value support to UCI parser was not complete causing many unexpected problems which I was only aware of when doing a fresh installation. It's very wise of Felix for keeping that update only to uci.git repository at the moment, thus giving me the chance to discover those flaws and fix them at my best. BTW. is there some production tool I can use to batch updating v1 version of this patch series to replaced state? v2 - v1 - Fix use-after-free bug caused by uci_realloc() in between consecutive call to next_arg(). - PATCH 2 fixes memory leaks found by valgrind. - PATCH 4 fixes EOF file check in uci_getln(). - PATCH 5 fixes error messages about unterminated quote string. - Do not quote list values that do not contain whitespace characters (\x20\t\r\n). This is mainly for maximum compatibility with current code using `uci get` on list options. Yousong Zhou (16): Fix a few style issues. Fix memory leaks found by using valgrind on test cases. file: fix use-after-free bug. file: fix EOF check. file: fix error string about unterminated XXX. tests: remove straying echo in 020_get. tests: add more test coverage for `uci show' command. tests: add test coverage for `uci batch' command. tests: add test coverage for `uci revert' command. tests: add test coverage for uci list related commands. cli: fix printing option values occupying multiple lines. delta: add a simple duplication check when adding delta path. delta: preprocess delta line with uci_parse_argument(). delta: use a table for converting between UCI_CMD_XXX and prefixes. delta: fix outputing of delta entries occupying multiple lines. uci_internal: use comma expression for UCI_INTERNAL() call. .gitignore |2 - cli.c | 53 +-- delta.c| 166 +--- file.c | 58 --- list.c |2 +- test/references/add_list_changes.result|4 + test/references/add_list_config.result |6 + test/references/add_list_show.result |3 + test/references/batch_set.result |9 ++ test/references/del_list_config.result |5 + test/references/del_list_multiline_config.result |4 + test/references/revert_option.result |3 + test/references/revert_option_multiline.result |2 + test/references/show_parsing_multiline.data| 20 +++ .../show_parsing_multiline_option.result | 12 ++ .../show_parsing_multiline_package.result | 18 +++ .../show_parsing_multiline_section.result | 16 ++ test/tests.d/020_get |1 - test/tests.d/050_show | 31 test/tests.d/060_batch | 17 ++ test/tests.d/070_revert| 28 test/tests.d/080_list | 52 ++ uci.h |8 + uci_internal.h |8 +- 24 files changed, 394 insertions(+), 134 deletions(-) create mode 100644 test/references/add_list_changes.result create mode 100644 test/references/add_list_config.result create mode 100644 test/references/add_list_show.result create mode 100644 test/references/batch_set.result create mode 100644 test/references/del_list_config.result create mode 100644 test/references/del_list_multiline_config.result create mode 100644 test/references/revert_option.result create mode 100644 test/references/revert_option_multiline.result create mode 100644 test/references/revert_section.result create mode 100644 test/references/show_parsing_multiline.data create mode 100644 test/references/show_parsing_multiline_option.result create mode 100644 test/references/show_parsing_multiline_package.result create mode 100644 test/references/show_parsing_multiline_section.result create mode 100644 test/tests.d/060_batch create mode 100644 test/tests.d/070_revert create mode 100644 test/tests.d/080_list -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 01/16] Fix a few style issues.
- Remove deprecated uci-static and ucimap-example from .gitignore. - Minor code formatting fix. Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- .gitignore |2 -- file.c |2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c3e50e0..0407feb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,5 @@ CMakeFiles install_manifest.txt uci -uci-static -ucimap-example uci_config.h test/save diff --git a/file.c b/file.c index ffa3afa..63ca919 100644 --- a/file.c +++ b/file.c @@ -246,7 +246,7 @@ static char *next_arg(struct uci_context *ctx, bool required, bool name) skip_whitespace(ctx); val = ptr = pctx_pos(pctx); - if(pctx_cur_char(pctx) == ';') { + if (pctx_cur_char(pctx) == ';') { pctx_cur_char(pctx) = 0; pctx-pos += 1; } else { -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 02/16] Fix memory leaks found by using valgrind on test cases.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- cli.c |8 ++-- list.c |2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cli.c b/cli.c index 6fbbfe9..554 100644 --- a/cli.c +++ b/cli.c @@ -360,6 +360,7 @@ static int uci_do_package_cmd(int cmd, int argc, char **argv) { char **configs = NULL; char **p; + int ret = 1; if (argc 2) return 255; @@ -369,14 +370,17 @@ static int uci_do_package_cmd(int cmd, int argc, char **argv) if ((uci_list_configs(ctx, configs) != UCI_OK) || !configs) { cli_perror(); - return 1; + goto out; } for (p = configs; *p; p++) { package_cmd(cmd, *p); } - return 0; + ret = 0; +out: + free(configs); + return ret; } static int uci_do_add(int argc, char **argv) diff --git a/list.c b/list.c index faf4494..0d00f81 100644 --- a/list.c +++ b/list.c @@ -346,7 +346,7 @@ uci_lookup_ext_section(struct uci_context *ctx, struct uci_ptr *ptr) goto done; error: - e = NULL; + free(section); memset(ptr, 0, sizeof(struct uci_ptr)); UCI_THROW(ctx, UCI_ERR_INVAL); done: -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 05/16] file: fix error string about unterminated XXX.
- Remove unreachable call to uci_parse_error(). - Fix false claim of unterminated double quote to single quote. Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- file.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/file.c b/file.c index 3f02c11..0fc68a6 100644 --- a/file.c +++ b/file.c @@ -157,7 +157,6 @@ static void parse_double_quote(struct uci_context *ctx, int *target) break; } } - uci_parse_error(ctx, unterminated \); } /* @@ -180,14 +179,13 @@ static void parse_single_quote(struct uci_context *ctx, int *target) /* Multi-line str value */ uci_getln(ctx, pctx-pos); if (!pctx_cur_char(pctx)) - uci_parse_error(ctx, EOF with unterminated \); + uci_parse_error(ctx, EOF with unterminated '); break; default: addc(ctx, target, pctx-pos); } } - uci_parse_error(ctx, unterminated '); } /* -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 06/16] tests: remove straying echo in 020_get.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/tests.d/020_get |1 - 1 file changed, 1 deletion(-) diff --git a/test/tests.d/020_get b/test/tests.d/020_get index 7fd30ba..630d84d 100644 --- a/test/tests.d/020_get +++ b/test/tests.d/020_get @@ -35,7 +35,6 @@ test_get_option_multiline() { cp ${REF_DIR}/get_multiline.data ${CONFIG_DIR}/test value=$($UCI get test.section.opt) - echo $value assertEquals 'Hello, World. '\''' $value } -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 07/16] tests: add more test coverage for `uci show' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/show_parsing_multiline.data| 20 + .../show_parsing_multiline_option.result | 12 .../show_parsing_multiline_package.result | 18 .../show_parsing_multiline_section.result | 16 ++ test/tests.d/050_show | 31 5 files changed, 97 insertions(+) create mode 100644 test/references/show_parsing_multiline.data create mode 100644 test/references/show_parsing_multiline_option.result create mode 100644 test/references/show_parsing_multiline_package.result create mode 100644 test/references/show_parsing_multiline_section.result diff --git a/test/references/show_parsing_multiline.data b/test/references/show_parsing_multiline.data new file mode 100644 index 000..670e809 --- /dev/null +++ b/test/references/show_parsing_multiline.data @@ -0,0 +1,20 @@ +config main +option version 1.4.1 + +config sockd 'instance0' +option enabled 1 +list internal_network vpn +list external_network wan + +option extra_config ' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_option.result b/test/references/show_parsing_multiline_option.result new file mode 100644 index 000..6f7aacf --- /dev/null +++ b/test/references/show_parsing_multiline_option.result @@ -0,0 +1,12 @@ +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_package.result b/test/references/show_parsing_multiline_package.result new file mode 100644 index 000..218082d --- /dev/null +++ b/test/references/show_parsing_multiline_package.result @@ -0,0 +1,18 @@ +sockd.@main[0]=main +sockd.@main[0].version='1.4.1' +sockd.instance0=sockd +sockd.instance0.enabled='1' +sockd.instance0.internal_network='vpn' +sockd.instance0.external_network='wan' +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/references/show_parsing_multiline_section.result b/test/references/show_parsing_multiline_section.result new file mode 100644 index 000..0506ac3 --- /dev/null +++ b/test/references/show_parsing_multiline_section.result @@ -0,0 +1,16 @@ +sockd.instance0=sockd +sockd.instance0.enabled='1' +sockd.instance0.internal_network='vpn' +sockd.instance0.external_network='wan' +sockd.instance0.extra_config=' + user.unprivileged: nobody + client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + session.max: 64 + log: error + } + + socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 + log: connect + } ' diff --git a/test/tests.d/050_show b/test/tests.d/050_show index 7d7e160..ce0eafc 100644 --- a/test/tests.d/050_show +++ b/test/tests.d/050_show @@ -9,3 +9,34 @@ test_get_parsing() assertFailWithNoReturn ${UCI_Q} show test.section.opt.val.qsdf.qsd assertFailWithNoReturn ${UCI_Q} show test.section.opt.valqsqsd } + +prepare_get_parsing_multiline() { + cp ${REF_DIR}/show_parsing_multiline.data ${CONFIG_DIR}/sockd +} + +test_get_parsing_multiline_package() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_package.result) + assertEquals $value_ref $value +} + +test_get_parsing_multiline_section() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd.instance0) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_section.result) + assertEquals $value_ref $value +} + +test_get_parsing_multiline_option() +{ + prepare_get_parsing_multiline + + value=$(${UCI_Q} show sockd.instance0.extra_config) + value_ref=$(cat ${REF_DIR}/show_parsing_multiline_option.result) + assertEquals $value_ref $value +} -- 1.7.10.4
[OpenWrt-Devel] [PATCH v2 08/16] tests: add test coverage for `uci batch' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/batch_set.result |9 + test/tests.d/060_batch | 17 + 2 files changed, 26 insertions(+) create mode 100644 test/references/batch_set.result create mode 100644 test/tests.d/060_batch diff --git a/test/references/batch_set.result b/test/references/batch_set.result new file mode 100644 index 000..c726bad --- /dev/null +++ b/test/references/batch_set.result @@ -0,0 +1,9 @@ + +config section 'SEC0' + option option0 'value0' + option option1 'Hello, + World' + +config section 'SEC1' + option option0 'value1' + diff --git a/test/tests.d/060_batch b/test/tests.d/060_batch new file mode 100644 index 000..49d15e4 --- /dev/null +++ b/test/tests.d/060_batch @@ -0,0 +1,17 @@ +test_batch_set() +{ + touch ${CONFIG_DIR}/batch_set + +${UCI} batch EOF +set batch_set.SEC0='section' +set batch_set.SEC0.option0='value0' +set batch_set.SEC0.option1='Hello, +' World\ +set batch_set.SEC1='section' +set batch_set.SEC1.option0=value1 + +EOF + ${UCI} commit + assertSameFile ${REF_DIR}/batch_set.result ${CONFIG_DIR}/batch_set +} + -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 09/16] tests: add test coverage for `uci revert' command.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/revert_option.result |3 +++ test/references/revert_option_multiline.result |2 ++ test/tests.d/070_revert| 28 3 files changed, 33 insertions(+) create mode 100644 test/references/revert_option.result create mode 100644 test/references/revert_option_multiline.result create mode 100644 test/references/revert_section.result create mode 100644 test/tests.d/070_revert diff --git a/test/references/revert_option.result b/test/references/revert_option.result new file mode 100644 index 000..c45a19c --- /dev/null +++ b/test/references/revert_option.result @@ -0,0 +1,3 @@ +revert.SEC0='section' +revert.SEC0.option1='Hello, + World' diff --git a/test/references/revert_option_multiline.result b/test/references/revert_option_multiline.result new file mode 100644 index 000..9982d25 --- /dev/null +++ b/test/references/revert_option_multiline.result @@ -0,0 +1,2 @@ +revert.SEC0='section' +revert.SEC0.option0='value0' diff --git a/test/references/revert_section.result b/test/references/revert_section.result new file mode 100644 index 000..e69de29 diff --git a/test/tests.d/070_revert b/test/tests.d/070_revert new file mode 100644 index 000..6035f6f --- /dev/null +++ b/test/tests.d/070_revert @@ -0,0 +1,28 @@ +revert_test_prepare() { + touch ${CONFIG_DIR}/revert + ${UCI} set revert.SEC0=section + ${UCI} set revert.SEC0.option0=value0 + ${UCI} set revert.SEC0.option1='Hello, +' World\ +} + +test_revert_section() +{ + revert_test_prepare + ${UCI} revert revert.SEC0 + assertSameFile ${REF_DIR}/revert_section.result $CHANGES_DIR/revert +} + +test_revert_option() +{ + revert_test_prepare + ${UCI} revert revert.SEC0.option0 + assertSameFile ${REF_DIR}/revert_option.result $CHANGES_DIR/revert +} + +test_revert_option_multiline() +{ + revert_test_prepare + ${UCI} revert revert.SEC0.option1 + assertSameFile ${REF_DIR}/revert_option_multiline.result $CHANGES_DIR/revert +} -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 10/16] tests: add test coverage for uci list related commands.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- test/references/add_list_changes.result |4 ++ test/references/add_list_config.result |6 +++ test/references/add_list_show.result |3 ++ test/references/del_list_config.result |5 +++ test/references/del_list_multiline_config.result |4 ++ test/tests.d/080_list| 52 ++ 6 files changed, 74 insertions(+) create mode 100644 test/references/add_list_changes.result create mode 100644 test/references/add_list_config.result create mode 100644 test/references/add_list_show.result create mode 100644 test/references/del_list_config.result create mode 100644 test/references/del_list_multiline_config.result create mode 100644 test/tests.d/080_list diff --git a/test/references/add_list_changes.result b/test/references/add_list_changes.result new file mode 100644 index 000..78e78b6 --- /dev/null +++ b/test/references/add_list_changes.result @@ -0,0 +1,4 @@ +list_test_config.SEC0='section' +list_test_config.SEC0.list0+='value0' +list_test_config.SEC0.list0+='Hello +, world' diff --git a/test/references/add_list_config.result b/test/references/add_list_config.result new file mode 100644 index 000..679 --- /dev/null +++ b/test/references/add_list_config.result @@ -0,0 +1,6 @@ + +config section 'SEC0' + list list0 'value0' + list list0 'Hello +, world' + diff --git a/test/references/add_list_show.result b/test/references/add_list_show.result new file mode 100644 index 000..3dd83cd --- /dev/null +++ b/test/references/add_list_show.result @@ -0,0 +1,3 @@ +list_test_config.SEC0=section +list_test_config.SEC0.list0='value0' 'Hello +, world' diff --git a/test/references/del_list_config.result b/test/references/del_list_config.result new file mode 100644 index 000..8e66bbb --- /dev/null +++ b/test/references/del_list_config.result @@ -0,0 +1,5 @@ + +config section 'SEC0' + list list0 'Hello +, world' + diff --git a/test/references/del_list_multiline_config.result b/test/references/del_list_multiline_config.result new file mode 100644 index 000..fe67784 --- /dev/null +++ b/test/references/del_list_multiline_config.result @@ -0,0 +1,4 @@ + +config section 'SEC0' + list list0 'value0' + diff --git a/test/tests.d/080_list b/test/tests.d/080_list new file mode 100644 index 000..e0a910a --- /dev/null +++ b/test/tests.d/080_list @@ -0,0 +1,52 @@ +prepare_list_test() { + touch ${CONFIG_DIR}/list_test_config + ${UCI} set list_test_config.SEC0=section + ${UCI} add_list list_test_config.SEC0.list0=value0 + ${UCI} add_list list_test_config.SEC0.list0='Hello +,' world\ +} +test_add_list_config() { + prepare_list_test + ${UCI} commit + assertSameFile ${REF_DIR}/add_list_config.result $CONFIG_DIR/list_test_config +} + +test_add_list_get() { + # To maintain compatibility with current code, do not quote + # list values that do not contain blank spaces (\x20\t\r\n) within it. + prepare_list_test + value_list_get=$(${UCI} get list_test_config.SEC0.list0) + assertEquals $value_list_get value0 '\Hello +, world\' +} + +test_add_list_show() { + prepare_list_test + value_list_show=$(${UCI} show list_test_config) + value_list_show_ref=$(cat $REF_DIR/add_list_show.result) + assertEquals $value_list_show $value_list_show_ref +} + +test_add_list_changes() { + prepare_list_test + value_list_changes=$(${UCI} changes) + value_list_changes_ref=$(cat $REF_DIR/add_list_changes.result) + assertEquals $value_list_changes $value_list_changes_ref +} + +test_del_list() { + prepare_list_test + ${UCI} commit + ${UCI} del_list list_test_config.SEC0.list0=value0 + ${UCI} commit + assertSameFile ${REF_DIR}/del_list_config.result $CONFIG_DIR/list_test_config +} + +test_del_list_multiline() { + prepare_list_test + ${UCI} commit + ${UCI} del_list list_test_config.SEC0.list0='Hello +,'' world' + ${UCI} commit + assertSameFile ${REF_DIR}/del_list_multiline_config.result $CONFIG_DIR/list_test_config +} -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 13/16] delta: preprocess delta line with uci_parse_argument().
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- delta.c | 25 ++--- file.c |7 +-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/delta.c b/delta.c index b56df5b..2eb2ae7 100644 --- a/delta.c +++ b/delta.c @@ -95,11 +95,14 @@ int uci_add_delta_path(struct uci_context *ctx, const char *dir) return 0; } -static inline int uci_parse_delta_tuple(struct uci_context *ctx, char **buf, struct uci_ptr *ptr) +static inline int uci_parse_delta_tuple(struct uci_context *ctx, struct uci_ptr *ptr) { + struct uci_parse_context *pctx = ctx-pctx; + char *str = pctx_cur_str(pctx), *arg; int c = UCI_CMD_CHANGE; - switch(**buf) { + UCI_INTERNAL(uci_parse_argument, ctx, ctx-pctx-file, str, arg); + switch(*arg) { case '^': c = UCI_CMD_REORDER; break; @@ -122,9 +125,9 @@ static inline int uci_parse_delta_tuple(struct uci_context *ctx, char **buf, str } if (c != UCI_CMD_CHANGE) - *buf += 1; + arg += 1; - UCI_INTERNAL(uci_parse_ptr, ctx, ptr, *buf); + UCI_INTERNAL(uci_parse_ptr, ctx, ptr, arg); if (!ptr-section) goto error; @@ -155,13 +158,13 @@ error: return 0; } -static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p, char *buf) +static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p) { struct uci_element *e = NULL; struct uci_ptr ptr; int cmd; - cmd = uci_parse_delta_tuple(ctx, buf, ptr); + cmd = uci_parse_delta_tuple(ctx, ptr); if (strcmp(ptr.package, p-e.name) != 0) goto error; @@ -214,6 +217,7 @@ static int uci_parse_delta(struct uci_context *ctx, FILE *stream, struct uci_pac pctx-file = stream; while (!feof(pctx-file)) { + pctx-pos = 0; uci_getln(ctx, 0); if (!pctx-buf[0]) continue; @@ -223,7 +227,7 @@ static int uci_parse_delta(struct uci_context *ctx, FILE *stream, struct uci_pac * delta as possible */ UCI_TRAP_SAVE(ctx, error); - uci_parse_delta_line(ctx, p, pctx-buf); + uci_parse_delta_line(ctx, p); UCI_TRAP_RESTORE(ctx); changes++; error: @@ -311,11 +315,10 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch pctx-file = f; while (!feof(f)) { struct uci_element *e; - char *buf; + pctx-pos = 0; uci_getln(ctx, 0); - buf = pctx-buf; - if (!buf[0]) + if (!pctx-buf[0]) continue; /* NB: need to allocate the element before the call to @@ -324,7 +327,7 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch e = uci_alloc_generic(ctx, UCI_TYPE_DELTA, pctx-buf, sizeof(struct uci_element)); uci_list_add(list, e-list); - uci_parse_delta_tuple(ctx, buf, ptr); + uci_parse_delta_tuple(ctx, ptr); if (section) { if (!ptr.section || (strcmp(section, ptr.section) != 0)) continue; diff --git a/file.c b/file.c index 0fc68a6..5be2e66 100644 --- a/file.c +++ b/file.c @@ -278,13 +278,8 @@ int uci_parse_argument(struct uci_context *ctx, FILE *stream, char **str, char * uci_alloc_parse_context(ctx); ctx-pctx-file = stream; - - if (!*str) { + if (!*str) uci_getln(ctx, 0); - *str = ctx-pctx-buf; - } else { - UCI_ASSERT(ctx, ctx-pctx-pos == *str - ctx-pctx-buf); - } /*FIXME do we need to skip empty lines? */ ofs_result = next_arg(ctx, false, false); -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 12/16] delta: add a simple duplication check when adding delta path.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- delta.c |2 ++ uci.h |2 ++ 2 files changed, 4 insertions(+) diff --git a/delta.c b/delta.c index 082633b..b56df5b 100644 --- a/delta.c +++ b/delta.c @@ -87,6 +87,8 @@ int uci_add_delta_path(struct uci_context *ctx, const char *dir) UCI_HANDLE_ERR(ctx); UCI_ASSERT(ctx, dir != NULL); + if (!strcmp(dir, ctx-savedir)) + return -1; e = uci_alloc_generic(ctx, UCI_TYPE_PATH, dir, sizeof(struct uci_element)); uci_list_add(ctx-delta_path, e-list); diff --git a/uci.h b/uci.h index 36c8890..eb7470c 100644 --- a/uci.h +++ b/uci.h @@ -262,6 +262,8 @@ extern int uci_set_confdir(struct uci_context *ctx, const char *dir); * * This function allows you to add directories, which contain 'overlays' * for the active config, that will never be committed. + * Caller of this API should ensure that no duplicate entries (including the + * default search path, e.g. `UCI_SAVEDIR') should be added. */ extern int uci_add_delta_path(struct uci_context *ctx, const char *dir); -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 11/16] cli: fix printing option values occupying multiple lines.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- cli.c | 45 +++-- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/cli.c b/cli.c index 554..2ee1e36 100644 --- a/cli.c +++ b/cli.c @@ -168,18 +168,41 @@ static void cli_perror(void) uci_perror(ctx, appname); } -static void uci_show_value(struct uci_option *o) +static void uci_print_value(FILE *f, const char *v) +{ + fprintf(f, '); + while (*v) { + if (*v != '\'') + fputc(*v, f); + else + fprintf(f, '\\''); + v++; + } + fprintf(f, '); +} + +static void uci_show_value(struct uci_option *o, bool quote) { struct uci_element *e; bool sep = false; + char *space; switch(o-type) { case UCI_TYPE_STRING: - printf(%s\n, o-v.string); + if (quote) + uci_print_value(stdout, o-v.string); + else + printf(%s, o-v.string); + printf(\n); break; case UCI_TYPE_LIST: uci_foreach_element(o-v.list, e) { - printf(%s%s, (sep ? delimiter : ), e-name); + printf(%s, (sep ? delimiter : )); + space = strpbrk(e-name, \t\r\n); + if (!space !quote) + printf(%s, e-name); + else + uci_print_value(stdout, e-name); sep = true; } printf(\n); @@ -190,13 +213,13 @@ static void uci_show_value(struct uci_option *o) } } -static void uci_show_option(struct uci_option *o) +static void uci_show_option(struct uci_option *o, bool quote) { printf(%s.%s.%s=, o-section-package-e.name, (cur_section_ref ? cur_section_ref : o-section-e.name), o-e.name); - uci_show_value(o); + uci_show_value(o, quote); } static void uci_show_section(struct uci_section *s) @@ -209,7 +232,7 @@ static void uci_show_section(struct uci_section *s) sname = (cur_section_ref ? cur_section_ref : s-e.name); printf(%s.%s=%s\n, cname, sname, s-type); uci_foreach_element(s-options, e) { - uci_show_option(uci_to_option(e)); + uci_show_option(uci_to_option(e), true); } } @@ -251,8 +274,10 @@ static void uci_show_changes(struct uci_package *p) printf(%s%s.%s, prefix, p-e.name, h-section); if (e-name) printf(.%s, e-name); - if (h-cmd != UCI_CMD_REMOVE) - printf(%s%s, op, h-value); + if (h-cmd != UCI_CMD_REMOVE) { + printf(%s, op); + uci_print_value(stdout, h-value); + } printf(\n); } } @@ -298,7 +323,7 @@ static int package_cmd(int cmd, char *tuple) uci_show_section(ptr.s); break; case UCI_TYPE_OPTION: - uci_show_option(ptr.o); + uci_show_option(ptr.o, true); break; default: /* should not happen */ @@ -444,7 +469,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv) printf(%s\n, ptr.s-type); break; case UCI_TYPE_OPTION: - uci_show_value(ptr.o); + uci_show_value(ptr.o, false); break; default: break; -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 14/16] delta: use a table for converting between UCI_CMD_XXX and prefixes.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- delta.c | 64 +++ uci.h |6 ++ 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/delta.c b/delta.c index 2eb2ae7..556250d 100644 --- a/delta.c +++ b/delta.c @@ -95,34 +95,29 @@ int uci_add_delta_path(struct uci_context *ctx, const char *dir) return 0; } +char const uci_command_char[] = { + [UCI_CMD_ADD] = '+', + [UCI_CMD_REMOVE] = '-', + [UCI_CMD_CHANGE] = 0, + [UCI_CMD_RENAME] = '@', + [UCI_CMD_REORDER] = '^', + [UCI_CMD_LIST_ADD] = '|', + [UCI_CMD_LIST_DEL] = '~' +}; + static inline int uci_parse_delta_tuple(struct uci_context *ctx, struct uci_ptr *ptr) { struct uci_parse_context *pctx = ctx-pctx; char *str = pctx_cur_str(pctx), *arg; - int c = UCI_CMD_CHANGE; + int c; UCI_INTERNAL(uci_parse_argument, ctx, ctx-pctx-file, str, arg); - switch(*arg) { - case '^': - c = UCI_CMD_REORDER; - break; - case '-': - c = UCI_CMD_REMOVE; - break; - case '@': - c = UCI_CMD_RENAME; - break; - case '+': - /* UCI_CMD_ADD is used for anonymous sections or list values */ - c = UCI_CMD_ADD; - break; - case '|': - c = UCI_CMD_LIST_ADD; - break; - case '~': - c = UCI_CMD_LIST_DEL; - break; + for (c = 0; c = __UCI_CMD_LAST; c++) { + if (uci_command_char[c] == *arg) + break; } + if (c __UCI_CMD_LAST) + c = UCI_CMD_CHANGE; if (c != UCI_CMD_CHANGE) arg += 1; @@ -445,30 +440,9 @@ int uci_save(struct uci_context *ctx, struct uci_package *p) uci_foreach_element_safe(p-delta, tmp, e) { struct uci_delta *h = uci_to_delta(e); - char *prefix = ; - - switch(h-cmd) { - case UCI_CMD_REMOVE: - prefix = -; - break; - case UCI_CMD_RENAME: - prefix = @; - break; - case UCI_CMD_ADD: - prefix = +; - break; - case UCI_CMD_REORDER: - prefix = ^; - break; - case UCI_CMD_LIST_ADD: - prefix = |; - break; - case UCI_CMD_LIST_DEL: - prefix = ~; - break; - default: - break; - } + char prefix[2] = {0, 0}; + if (h-cmd = __UCI_CMD_LAST) + prefix[0] = uci_command_char[h-cmd]; fprintf(f, %s%s.%s, prefix, p-e.name, h-section); if (e-name) diff --git a/uci.h b/uci.h index eb7470c..b31d007 100644 --- a/uci.h +++ b/uci.h @@ -450,6 +450,9 @@ struct uci_option } v; }; +/* + * UCI_CMD_ADD is used for anonymous sections or list values + */ enum uci_command { UCI_CMD_ADD, UCI_CMD_REMOVE, @@ -458,7 +461,10 @@ enum uci_command { UCI_CMD_REORDER, UCI_CMD_LIST_ADD, UCI_CMD_LIST_DEL, + __UCI_CMD_MAX, + __UCI_CMD_LAST = __UCI_CMD_MAX - 1 }; +extern char const uci_command_char[]; struct uci_delta { -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 16/16] uci_internal: use comma expression for UCI_INTERNAL() call.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- uci_internal.h |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uci_internal.h b/uci_internal.h index 89863f1..cb8f86c 100644 --- a/uci_internal.h +++ b/uci_internal.h @@ -227,10 +227,10 @@ struct uci_backend _var = { \ * Sets Exception handling to passthrough mode. * Allows API functions to change behavior compared to public use */ -#define UCI_INTERNAL(func, ctx, ...) do { \ - ctx-internal = true; \ - func(ctx, __VA_ARGS__); \ -} while (0) +#define UCI_INTERNAL(func, ctx, ...) ( \ + ctx-internal = true, \ + func(ctx, __VA_ARGS__) \ +) /** * UCI_NESTED: Do an normal nested call of a public API function -- 1.7.10.4 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 15/16] delta: fix outputing of delta entries occupying multiple lines.
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- delta.c | 85 ++- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/delta.c b/delta.c index 556250d..cdd46bc 100644 --- a/delta.c +++ b/delta.c @@ -66,6 +66,35 @@ uci_free_delta(struct uci_delta *h) uci_free_element(h-e); } +static void uci_delta_save(struct uci_context *ctx, FILE *f, + const char *name, const struct uci_delta *h) +{ + const struct uci_element *e = h-e; + char prefix[2] = {0, 0}; + + if (h-cmd = __UCI_CMD_LAST) + prefix[0] = uci_command_char[h-cmd]; + + fprintf(f, %s%s.%s, prefix, name, h-section); + if (e-name) + fprintf(f, .%s, e-name); + + if (h-cmd == UCI_CMD_REMOVE !h-value) + fprintf(f, \n); + else { + int i; + + fprintf(f, ='); + for (i = 0; h-value[i]; i++) { + unsigned char c = h-value[i]; + if (c != '\'') + fputc(c, f); + else + fprintf(f, '\\''); + } + fprintf(f, '\n); + } +} int uci_set_savedir(struct uci_context *ctx, const char *dir) { @@ -309,30 +338,29 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch f = uci_open_stream(ctx, filename, NULL, SEEK_SET, true, false); pctx-file = f; while (!feof(f)) { - struct uci_element *e; + enum uci_command c; + bool match; pctx-pos = 0; uci_getln(ctx, 0); if (!pctx-buf[0]) continue; - /* NB: need to allocate the element before the call to -* uci_parse_delta_tuple, otherwise the original string -* gets modified before it is saved */ - e = uci_alloc_generic(ctx, UCI_TYPE_DELTA, pctx-buf, sizeof(struct uci_element)); - uci_list_add(list, e-list); - - uci_parse_delta_tuple(ctx, ptr); + c = uci_parse_delta_tuple(ctx, ptr); + match = true; if (section) { if (!ptr.section || (strcmp(section, ptr.section) != 0)) - continue; + match = false; } - if (option) { + if (match option) { if (!ptr.option || (strcmp(option, ptr.option) != 0)) - continue; + match = false; + } + + if (!match) { + uci_add_delta(ctx, list, c, + ptr.section, ptr.option, ptr.value); } - /* match, drop this element again */ - uci_free_element(e); } /* rebuild the delta file */ @@ -340,8 +368,9 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch if (ftruncate(fileno(f), 0) 0) UCI_THROW(ctx, UCI_ERR_IO); uci_foreach_element_safe(list, tmp, e) { - fprintf(f, %s\n, e-name); - uci_free_element(e); + struct uci_delta *h = uci_to_delta(e); + uci_delta_save(ctx, f, name, h); + uci_free_delta(h); } UCI_TRAP_RESTORE(ctx); @@ -349,7 +378,7 @@ done: free(filename); uci_close_stream(pctx-file); uci_foreach_element_safe(list, tmp, e) { - uci_free_element(e); + uci_free_delta(uci_to_delta(e)); } uci_cleanup(ctx); } @@ -440,29 +469,7 @@ int uci_save(struct uci_context *ctx, struct uci_package *p) uci_foreach_element_safe(p-delta, tmp, e) { struct uci_delta *h = uci_to_delta(e); - char prefix[2] = {0, 0}; - if (h-cmd = __UCI_CMD_LAST) - prefix[0] = uci_command_char[h-cmd]; - - fprintf(f, %s%s.%s, prefix, p-e.name, h-section); - if (e-name) - fprintf(f, .%s, e-name); - - if (h-cmd == UCI_CMD_REMOVE !h-value) - fprintf(f, \n); - else { - int i; - - fprintf(f, ='); - for (i = 0; h-value[i]; i++) { - unsigned char c = h-value[i]; - if (c != '\'') - fputc(c, f); - else - fprintf(f, '\\''); - } - fprintf(f, '\n); - } + uci_delta_save(ctx, f, p-e.name, h); uci_free_delta(h); } --
Re: [OpenWrt-Devel] [PATCH] dnsmasq: allow de-selecting features from -full variant.
Hi, Frank. On 18 December 2014 at 01:49, Frank Schäfer fschaefer@googlemail.com wrote: Hi yousong, thanks for the patch. A few issues/comments: Am 17.12.2014 um 02:21 schrieb Yousong Zhou: Signed-off-by: Yousong Zhou yszhou4t...@gmail.com --- package/network/services/dnsmasq/Makefile | 27 ++-- .../network/services/dnsmasq/files/dnsmasq.init|5 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index a530225..2da593d 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.72 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq @@ -72,6 +72,26 @@ define Package/dnsmasq/conffiles /etc/dnsmasq.conf endef +define Package/dnsmasq/config/Default + if PACKAGE_$(1)-$(2) + config PACKAGE_dnsmasq_$(2)_dhcpv6 +bool Build with DHCPv6 support. +default y This config needs to depend on IPV6 + config PACKAGE_dnsmasq_$(2)_dnssec +bool Build with DNSSEC support. +default y This config needs to select PACKAGE_libnettle + config PACKAGE_dnsmasq_$(2)_auth +bool Build with the facility to act as an authoritative DNS server. +default y + config PACKAGE_dnsmasq_$(2)_ipset +bool Build with ipset support. +select PACKAGE_kmod-ipt-ipset +default y + endif +endef It would be nice if this would appear in a submenu and only if the dnsmasq package is enabled. This currently only appear if dnsmasq-full is selected. + +Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full) + Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles) Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles) @@ -85,7 +105,10 @@ ifeq ($(BUILD_VARIANT),nodhcpv6) endif ifeq ($(BUILD_VARIANT),full) - COPTS += -DHAVE_DNSSEC + COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \ + $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET) COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,) else COPTS += -DNO_AUTH -DNO_IPSET The installation section Package/dnsmasq-full/install should be modified, too: if DNSSEC is not enabled, there's no need to install trust-anchors.conf --- The patch leaves the main problem unsolved: you still have to enable the whole IPv6 stuff for DNS Auth / DNSSEC / IPSET support. I personally have no problems with migrating from package variants to the configure at build time approach. But I don't think they should be mixed together. The dnsmasq-full package with only dhcpv6 enabled is exactly the same as the dnsmasq-dhcpv6 package variant. And as soon as you deselect one of the config options, dnsmasq-full actually isn't a full package anymore, right ? ;-) IMHO too much inconsistencies. If we go this way, I would prefer having just a single (fully configurable) dnsmasq package. Another configurable variant should be better. I just noticed that if dnsmasq-full is selected, all of its dependencies like kmod-ipv6 and libnettle are still selected and compiled in even when IPV6 and dnssec are de-selected. I'll send a patch later this evening. Thank you for the comments. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/4] oxnas: refresh kernel config-3.1[48]
and no longer compile-in ext4 filesystem now that sata_oxnas is also built as a module. Signed-off-by: Daniel Golle dan...@makrotopia.org --- target/linux/oxnas/config-3.14 | 16 +++- target/linux/oxnas/config-3.18 | 25 +++-- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/target/linux/oxnas/config-3.14 b/target/linux/oxnas/config-3.14 index 9b0f3f9..8022441 100644 --- a/target/linux/oxnas/config-3.14 +++ b/target/linux/oxnas/config-3.14 @@ -12,11 +12,13 @@ CONFIG_ARCH_OXNAS=y CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_LIBATA_LEDS=y CONFIG_ARM=y # CONFIG_ARM_CPU_SUSPEND is not set CONFIG_ARM_GIC=y @@ -25,6 +27,7 @@ CONFIG_ARM_NR_BANKS=8 CONFIG_ARM_PATCH_PHYS_VIRT=y CONFIG_ARM_THUMB=y CONFIG_ARM_UNWIND=y +CONFIG_ATA_LEDS=y CONFIG_AUTO_ZRELADDR=y # CONFIG_BLK_DEV_INITRD is not set CONFIG_BLK_DEV_SD=y @@ -90,12 +93,7 @@ CONFIG_DTC=y # CONFIG_DW_DMAC_CORE is not set # CONFIG_DW_DMAC_PCI is not set CONFIG_EARLY_PRINTK=y -CONFIG_EXT4_FS=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y CONFIG_FIQ=y -CONFIG_FS_MBCACHE=y -CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y @@ -103,7 +101,6 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IO=y CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_NET_UTILS=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_PINCONF=y CONFIG_GENERIC_SCHED_CLOCK=y @@ -190,7 +187,6 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_IRQ_WORK=y # CONFIG_ISDN is not set -CONFIG_JBD2=y # CONFIG_JFFS2_FS is not set CONFIG_JUMP_LABEL=y CONFIG_KALLSYMS=y @@ -202,7 +198,6 @@ CONFIG_KGDB_SERIAL_CONSOLE=y CONFIG_KTIME_SCALAR=y # CONFIG_LDM_DEBUG is not set CONFIG_LDM_PARTITION=y -# CONFIG_LEDS_PWM is not set # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set # CONFIG_LEDS_TRIGGER_NETDEV is not set # CONFIG_LEDS_TRIGGER_TIMER is not set @@ -215,7 +210,6 @@ CONFIG_MAILBOX=y CONFIG_MDIO_BOARDINFO=y CONFIG_MIGHT_HAVE_PCI=y CONFIG_MIGRATION=y -# CONFIG_MLX5_CORE is not set CONFIG_MODULES_USE_ELF_REL=y # CONFIG_MODULE_STRIPPED is not set # CONFIG_MTD_CFI is not set @@ -237,9 +231,7 @@ CONFIG_MULTI_IRQ_HANDLER=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_RX_BUSY_POLL=y CONFIG_NLS=y -CONFIG_NLS_UTF8=y CONFIG_NO_BOOTMEM=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y @@ -345,8 +337,6 @@ CONFIG_XZ_DEC_ARM=y CONFIG_XZ_DEC_BCJ=y CONFIG_ZBOOT_ROM_BSS=0 CONFIG_ZBOOT_ROM_TEXT=0 -# CONFIG_ZBUD is not set CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y CONFIG_ZONE_DMA_FLAG=0 -CONFIG_ATA_LEDS=y diff --git a/target/linux/oxnas/config-3.18 b/target/linux/oxnas/config-3.18 index e255781..77585af 100644 --- a/target/linux/oxnas/config-3.18 +++ b/target/linux/oxnas/config-3.18 @@ -8,7 +8,6 @@ CONFIG_ARCH_HAS_TICK_BROADCAST=y CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_ARCH_MSM is not set # CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set CONFIG_ARCH_NR_GPIO=0 CONFIG_ARCH_OXNAS=y @@ -22,6 +21,7 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_LIBATA_LEDS=y CONFIG_ARM=y # CONFIG_ARM_CPU_SUSPEND is not set CONFIG_ARM_GIC=y @@ -29,7 +29,7 @@ CONFIG_ARM_L1_CACHE_SHIFT=5 CONFIG_ARM_PATCH_PHYS_VIRT=y CONFIG_ARM_THUMB=y CONFIG_ARM_UNWIND=y -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +CONFIG_ATA_LEDS=y CONFIG_AUTO_ZRELADDR=y # CONFIG_BLK_DEV_INITRD is not set CONFIG_BLK_DEV_SD=y @@ -45,7 +45,6 @@ CONFIG_CLKSRC_RPS_TIMER=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE=console=ttyS0,115200n8 earlyprintk=serial CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_PXA is not set CONFIG_COMPACTION=y CONFIG_CONSOLE_POLL=y CONFIG_COREDUMP=y @@ -77,11 +76,8 @@ CONFIG_CRYPTO_XZ=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_LL=y CONFIG_DEBUG_LL_INCLUDE=mach/debug-macro.S -# CONFIG_DEBUG_LL_UART_8250 is not set CONFIG_DEBUG_LL_UART_NONE=y -# CONFIG_DEBUG_LL_UART_PL01X is not set # CONFIG_DEBUG_UART_8250 is not set -# CONFIG_DEBUG_UART_BCM63XX is not set # CONFIG_DEBUG_UART_PL01X is not set # CONFIG_DEBUG_USER is not set CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=8 @@ -98,7 +94,6 @@ CONFIG_DTC=y # CONFIG_DW_DMAC_PCI is not set CONFIG_EARLY_PRINTK=y CONFIG_FIQ=y -# CONFIG_FSL_EDMA is not set CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -107,14 +102,12 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IO=y CONFIG_GENERIC_IRQ_SHOW=y
[OpenWrt-Devel] [PATCH 2/4] oxnas: sata_oxnas: refactoring phase 1
locking for 2nd port and hwraid was added from vendor's GPL code which doesn't comply with current kernel coding style. - moved all global variables into host_priv - renamed locks - sanetized acquire() and release() parameter list Signed-off-by: Daniel Golle dan...@makrotopia.org --- target/linux/oxnas/files/drivers/ata/sata_oxnas.c | 256 - .../oxnas/patches-3.14/999-libata-hacks.patch | 9 +- .../oxnas/patches-3.18/999-libata-hacks.patch | 9 +- 3 files changed, 152 insertions(+), 122 deletions(-) diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index f8b53f1..39e73d7 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -335,6 +335,8 @@ enum { SATA_SCSI_STACK }; +typedef irqreturn_t (*oxnas_sata_isr_callback_t)(int, unsigned long, int); + struct sata_oxnas_host_priv { void __iomem *port_base; void __iomem *dmactl_base; @@ -353,12 +355,22 @@ struct sata_oxnas_host_priv { struct reset_control *rst_sata; struct reset_control *rst_link; struct reset_control *rst_phy; + spinlock_t phy_lock; + spinlock_t core_lock; + int core_locked; + int reentrant_port_no; + int hw_lock_count; + int direct_lock_count; + void *locker_uid; + int current_locker_type; + int scsi_nonblocking_attempts; + oxnas_sata_isr_callback_t isr_callback; + void *isr_arg; + wait_queue_head_t fast_wait_queue; + wait_queue_head_t scsi_wait_queue; }; -typedef irqreturn_t (*ox820sata_isr_callback_t)(int, unsigned long, int); -static DEFINE_SPINLOCK(oxsphy_lock); -static DEFINE_SPINLOCK(oxsacs_lock); struct sata_oxnas_port_priv { void __iomem *port_base; void __iomem *dmactl_base; @@ -375,22 +387,11 @@ static void sata_oxnas_tf_load(struct ata_port *ap, static void sata_oxnas_irq_on(struct ata_port *ap); static void sata_oxnas_post_reset_init(struct ata_port *ap); -static int sata_oxnas_acquire_hw(int port_no, int may_sleep, - int timeout_jiffies); -static void sata_oxnas_release_hw(unsigned int port_no); +static int sata_oxnas_acquire_hw(struct ata_port *ap, int may_sleep, +int timeout_jiffies); +static void sata_oxnas_release_hw(struct ata_port *ap); -static int core_locked = 0; -static int reentrant_port_no = -1; -static int hw_lock_count = 0; -static int direct_lock_count = 0; -static void *locker_uid = 0; -static int current_locker_type = SATA_UNLOCKED; static const void *HW_LOCKER_UID = (void*)0xdeadbeef; -static DECLARE_WAIT_QUEUE_HEAD(fast_wait_queue); -static DECLARE_WAIT_QUEUE_HEAD(scsi_wait_queue); -static ox820sata_isr_callback_t ox820sata_isr_callback = NULL; -static unsigned long ox820sata_isr_arg = 0; -static int scsi_nonblocking_attempts = 0; /*** * ASIC access @@ -451,14 +452,15 @@ void workaround5458(struct ata_host *ah) */ void sata_oxnas_link_write(struct ata_port *ap, unsigned int link_reg, u32 val) { - struct sata_oxnas_port_priv *port_priv = ap-private_data; - void __iomem *port_base = port_priv-port_base; + struct sata_oxnas_port_priv *pd = ap-private_data; + struct sata_oxnas_host_priv *hd = ap-host-private_data; + void __iomem *port_base = pd-port_base; u32 patience; unsigned long flags; DPRINTK(P%d [0x%02x]-0x%08x\n, ap-port_no, link_reg, val); - spin_lock_irqsave(oxsphy_lock, flags); + spin_lock_irqsave(hd-phy_lock, flags); iowrite32(val, port_base + LINK_DATA); /* accessed twice as a work around for a bug in the SATA abp bridge @@ -470,7 +472,7 @@ void sata_oxnas_link_write(struct ata_port *ap, unsigned int link_reg, u32 val) if (ioread32(port_base + LINK_CONTROL) 0x0001) break; } - spin_unlock_irqrestore(oxsphy_lock, flags); + spin_unlock_irqrestore(hd-phy_lock, flags); } static int sata_oxnas_scr_write_port(struct ata_port *ap, unsigned int sc_reg, @@ -489,12 +491,13 @@ static int sata_oxnas_scr_write(struct ata_link *link, unsigned int sc_reg, u32 sata_oxnas_link_read(struct ata_port *ap, unsigned int link_reg) { struct sata_oxnas_port_priv *pd = ap-private_data; + struct sata_oxnas_host_priv *hd = ap-host-private_data; void __iomem *port_base = pd-port_base; u32 result; u32 patience; unsigned long flags; - spin_lock_irqsave(oxsphy_lock, flags); + spin_lock_irqsave(hd-phy_lock, flags); /* accessed twice as a work around for a bug in the SATA abp bridge * hardware (bug 6828) */ iowrite32(link_reg, port_base + LINK_RD_ADDR); @@ -508,7 +511,7 @@ u32 sata_oxnas_link_read(struct ata_port *ap, unsigned int
[OpenWrt-Devel] [PATCH 3/4] oxnas: sata_oxnas: refactoring phase 2
- replaced // comments by /* comments */ - added line-breaks where needed - fixed white-space according to kernel style - fixed some obvious spelling mistakes in comments and printks - removed some unneeded left-overs imported from vendor code-base - replaced printk(...) by libata macros where possible Signed-off-by: Daniel Golle dan...@makrotopia.org --- target/linux/oxnas/files/drivers/ata/sata_oxnas.c | 287 +- 1 file changed, 175 insertions(+), 112 deletions(-) diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index 39e73d7..30bcb23 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -391,7 +391,7 @@ static int sata_oxnas_acquire_hw(struct ata_port *ap, int may_sleep, int timeout_jiffies); static void sata_oxnas_release_hw(struct ata_port *ap); -static const void *HW_LOCKER_UID = (void*)0xdeadbeef; +static const void *HW_LOCKER_UID = (void *)0xdeadbeef; /*** * ASIC access @@ -561,7 +561,7 @@ static unsigned int sata_oxnas_qc_issue(struct ata_queued_cmd *qc) void __iomem *port_base = pd-port_base; void __iomem *core_base = pd-core_base; int port_no = qc-ap-port_no; - int no_microcode = ( hd-current_ucode == UNKNOWN_MODE ); + int no_microcode = (hd-current_ucode == UNKNOWN_MODE); u32 reg; /* check the core is idle */ @@ -584,7 +584,7 @@ static unsigned int sata_oxnas_qc_issue(struct ata_queued_cmd *qc) /* enable passing of error signals to DMA sub-core by clearing the * appropriate bit */ reg = ioread32(core_base + DATA_PLANE_CTRL); - if(no_microcode) + if (no_microcode) reg |= (DPC_ERROR_MASK_BIT | (DPC_ERROR_MASK_BIT 1)); reg = ~(DPC_ERROR_MASK_BIT port_no); iowrite32(reg, core_base + DATA_PLANE_CTRL); @@ -669,60 +669,84 @@ static int __acquire_sata_core( spin_lock_irqsave(hd-core_lock, flags); - DPRINTK(Entered uid %p, port %d, h/w count %d, d count %d, callback %p, - hw_access %d, core_locked %d, reentrant_port_no %d, isr_callback %p\n, - uid, port_no, hd-hw_lock_count, hd-direct_lock_count, callback, hw_access, - hd-core_locked, hd-reentrant_port_no, hd-isr_callback); + DPRINTK(Entered uid %p, port %d, h/w count %d, d count %d, + callback %p, hw_access %d, core_locked %d, + reentrant_port_no %d, isr_callback %p\n, + uid, port_no, hd-hw_lock_count, hd-direct_lock_count, + callback, hw_access, hd-core_locked, hd-reentrant_port_no, + hd-isr_callback); while (!timed_out) { - if (hd-core_locked || (!hw_access hd-scsi_nonblocking_attempts)) { + if (hd-core_locked || + (!hw_access hd-scsi_nonblocking_attempts)) { /* Can only allow access if from SCSI/SATA stack and if - reentrant access is allowed and this access is to the same - port for which the lock is current held */ +* reentrant access is allowed and this access is to the +* same port for which the lock is current held +*/ if (hw_access (port_no == hd-reentrant_port_no)) { BUG_ON(!hd-hw_lock_count); ++(hd-hw_lock_count); - DPRINTK(Allow SCSI/SATA re-entrant access to uid %p port %d\n, uid, port_no); + DPRINTK(Allow SCSI/SATA re-entrant access to + uid %p port %d\n, uid, port_no); acquired = 1; break; } else if (!hw_access) { - if ((locker_type == SATA_READER) (hd-current_locker_type == SATA_READER)) { + if ((locker_type == SATA_READER) + (hd-current_locker_type == SATA_READER)) { WARN(1, - Already locked by reader, uid %p, locker_uid %p, port %d, - h/w count %d, d count %d, hw_access %d\n, uid, hd-locker_uid, - port_no, hd-hw_lock_count, hd-direct_lock_count, hw_access); + Already locked by reader, + uid %p, locker_uid %p, + port %d, h/w count %d, + d count %d,
[OpenWrt-Devel] [PATCH 4/4] oxnas: sata_oxnas: make irq handler more readable
safed one level of indention by using 'continue' instead of a lengthy if-clause. Signed-off-by: Daniel Golle dan...@makrotopia.org --- target/linux/oxnas/files/drivers/ata/sata_oxnas.c | 26 --- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index 30bcb23..b63cd60 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -2041,7 +2041,7 @@ int sata_oxnas_init_controller(struct ata_host *host) * * @param port SATA port to check and if necessary, correct. */ -static int sata_oxnas_bug_6320_workaround(struct ata_port *ap) +static int sata_oxnas_bug_6320_detect(struct ata_port *ap) { struct sata_oxnas_port_priv *pd = ap-private_data; void __iomem *core_base = pd-core_base; @@ -2175,17 +2175,19 @@ static irqreturn_t sata_oxnas_interrupt(int irq, void *dev_instance) /* check the raw end of command interrupt to see if the * port is done */ mask = (COREINT_END port_no); - if (int_status mask) { - /* this port had an interrupt, clear it */ - iowrite32(mask, core_base + CORE_INT_CLEAR); - bug_present = - (hd-current_ucode == UNKNOWN_MODE) ? - sata_oxnas_bug_6320_workaround( - ah-ports[port_no]):0; - sata_oxnas_port_irq(ah-ports[port_no], - bug_present); - ret = IRQ_HANDLED; - } + if (!(int_status mask)) + continue; + + /* this port had an interrupt, clear it */ + iowrite32(mask, core_base + CORE_INT_CLEAR); + /* check for bug 6320 only if no microcode was loaded */ + bug_present = (hd-current_ucode == UNKNOWN_MODE) ? + sata_oxnas_bug_6320_detect(ah-ports[port_no]) : + 0; + + sata_oxnas_port_irq(ah-ports[port_no], + bug_present); + ret = IRQ_HANDLED; } } -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel