From patchwork Wed Sep 23 22:08:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Ng X-Patchwork-Id: 1370107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=V4Gta4VX; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=F9p9e1nr; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BxXRb1nVZz9sSC for ; Thu, 24 Sep 2020 08:10:19 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=32r9/IQ3Klfd/nuI5EKND8sEVvlzG2Qd9K7fZAlysw4=; b=V4Gta4VXAmBQYZJ/G6GNjuwFFi +0B7+zgwW49PJF2lYc2PUW0UK9D3PAXaQ6SRm/h97uF7OKtNRoMwCw1yEo/JWjUC5HrFk/+qUwIzP jJNW/qA9vtj4Qenq5l1tfDpvEW3KgD1bi80Z9mKsd2UP9Kj6+SxPxoXC7H32/a6tTBzgwzdizXRfc rANpILC7i4UKBDVCso0zsuG7VOCsOLLej3o0Kw384lwU3g7tHsurCLMOe+NfpBBbDVmxqRh75Qe7/ gZ0WKWcecaHPr/+Yl0h2cOHjfeHidQWMoU00jm/d+jsqjbyQbgXmvfli4ij4nKv+AmMtyQNPiRFG7 KMZzYLsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLCwV-0000cX-Kq; Wed, 23 Sep 2020 22:08:51 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLCwQ-0000be-GM for openwrt-devel@lists.openwrt.org; Wed, 23 Sep 2020 22:08:49 +0000 Received: by mail-wm1-x343.google.com with SMTP id w2so1521988wmi.1 for ; Wed, 23 Sep 2020 15:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=xi/fSRqHs/fM6JPKRTuAv4wO2HD6S4y+ZwnyKCJO0M0=; b=F9p9e1nrfoPy1B7ChrxSsWE+Fogt1olWtfJn8eYboNz/ntaVxbghvmGcUaZFKmQdop psZIKwf0BA1NSOriiVrL50cQm8i/xqiamPXSS+QsdtXILOrqRGTVAe7f3n/SWv3OwIci HmJD1GbRg6F8DRJCO6E/3mKvflE7LFqn4/ARRAUb7Fkl2PDqawCu8+bmYTmt6SqnjB3x 2IjeoMjGSWpsBXimAu010CUnVsx1jdNna+HJ1g22KqAq8RD9lV2HTxNU5pw/bg3WYoEP T0FydBSwoOXdVPHi5U9+cG37Kl2v8M82srx9cZCZFOMDR6whL7kz9mLptSf4vWPKkRlr QwPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xi/fSRqHs/fM6JPKRTuAv4wO2HD6S4y+ZwnyKCJO0M0=; b=aGy3AkeqCnZlOuMXwUobfgoDfvPOutt8c7S/9rpSBxz/hJfsa4D0psf2LX5SaMKCVz zW5TQcz5x5tP7eD9s1GKA9KGk6WrwBgkUY+9/yVDtyRfDI7w+ZJbpxTGGWJbV55UVR1G oaAUfZ+23Fz83K0JEW8uqKEJuliJ4294ag1YLgW6lCuD/5QAmIGpG66SjeUTJC3Sousx AC4M0n0jAu9BqlKjScVeRKuPrQgyhiKFTUixz8QlYcRMxAwwM7cDj5PE3K7JU7OgU2HO B3UsJkbswUCNVt8z0u7OybbRS2GNa3DKBWzhJORx7cI3bBfNWCSoX7DaaHZiDSTFWjKZ 6kyg== X-Gm-Message-State: AOAM531lSBWy+I5RkGqujPeCpwsz8+5tTuRuKtJLRmkzYzEc5GY73ivp uJ6GG9+HUVjXfhUaL1+qfenAi4H3mFI= X-Google-Smtp-Source: ABdhPJyRkaIUaHJ14TXU4DKIEP4GALBTe/gUEw+pzhPsccnDd56ungGqIVoU37hNEP2qKrpWT/u16w== X-Received: by 2002:a7b:c848:: with SMTP id c8mr1468539wml.184.1600898923410; Wed, 23 Sep 2020 15:08:43 -0700 (PDT) Received: from xubuntu-vbox.lan (157.173.9.51.dyn.plus.net. [51.9.173.157]) by smtp.googlemail.com with ESMTPSA id h4sm1389306wrm.54.2020.09.23.15.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 15:08:42 -0700 (PDT) From: Christopher Ng To: openwrt-devel@lists.openwrt.org Subject: [PATCH] fw3: rules: fix parsing of multiple weekdays Date: Wed, 23 Sep 2020 23:08:36 +0100 Message-Id: <20200923220836.18537-1-facboy@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_180846_556630_9BF6BC8F X-CRM114-Status: GOOD ( 11.98 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [facboy[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christopher Ng MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org fw3 was not parsing the 'weekdays' option of rules correctly, it would only put the first day listed into the iptables --weekdays option. Signed-off-by: Christopher Ng --- iptables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iptables.c b/iptables.c index e7e8b59..9e8fa74 100644 --- a/iptables.c +++ b/iptables.c @@ -1208,7 +1208,7 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct fw3_time *time) rem--; } - p += snprintf(p, rem, "%u", i); + len = snprintf(p, rem, "%u", i); if (len < 0 || len >= rem) break;