From patchwork Mon Aug 14 23:14:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 7088 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4RPqwY0QnXz3wlH for ; Mon, 14 Aug 2023 23:14:21 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4RPqwW2xrjz1hq; Mon, 14 Aug 2023 23:14:19 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4RPqwW23ffz2yl9; Mon, 14 Aug 2023 23:14:19 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4RPqwV60hpz2xY1 for ; Mon, 14 Aug 2023 23:14:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4RPqwT079vzN6 for ; Mon, 14 Aug 2023 23:14:16 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1692054857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VOtXgdlYcpEpqyR2x0tsQunuuwNOmqWw8yxzi+Ogpl8=; b=uA2kOyNd2rPOrVIildpVrnyHex5TGlWC5ecdCN9HfdB5rY02ln0A13JcFrHYoKF/r1XCYv VgDFDlzXSzSFcWDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1692054857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VOtXgdlYcpEpqyR2x0tsQunuuwNOmqWw8yxzi+Ogpl8=; b=DAWZvZZlo4BOG4v0uJsyOz9LqKfeevtQpGq/woeVS2OPcjLJ3Uyrl+vgY1OVizryv2sprn sxg3iqr8cLB8qg/Al4eiZn3ZkYRYvSI4UMGIUQ0K9CUQic/7t/XDbKl9Z9umnJzREZ1cAM hhhPlP2Vquubwq47Iw0rbtr273ZkZRucdrZP6ruotHAomZ8HtxOyysRxGPTaN9SmVcK9ba IrqKaKHeHkuqUWjEhGT5ngMkcOdMlMqcQgy9n0h0v+WZsETqDvMS5slGYHU2jCJOQZmaxx smsbXfirk7/KVEqk0S9tDbOL9QT+UHYS/lHIb05GGithAtwwmayc2M2o4bLCEQ== Message-ID: <315c2f05-a0cd-4488-b5b2-48b6c6aa3d00@ipfire.org> Date: Mon, 14 Aug 2023 23:14:00 +0000 MIME-Version: 1.0 To: "IPFire: Development" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] squid-asnbl: Update to 0.2.5 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This upstream release incorporates the patch added for resolving #13023. Signed-off-by: Peter Müller Reviewed-by: Adolf Belka --- lfs/squid-asnbl | 5 +- ...les_to_make_compatible_with_python_3.patch | 100 ------------------ 2 files changed, 2 insertions(+), 103 deletions(-) delete mode 100644 src/patches/squid/squid-asnbl-0.2.4_initialise_global_variables_to_make_compatible_with_python_3.patch diff --git a/lfs/squid-asnbl b/lfs/squid-asnbl index b003d605b..32c109e15 100644 --- a/lfs/squid-asnbl +++ b/lfs/squid-asnbl @@ -25,7 +25,7 @@ include Config -VER = 0.2.4 +VER = 0.2.5 THISAPP = squid-asnbl-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -45,7 +45,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_BLAKE2 = 98bdf0ecff1fc4d4ac0e0eb43d37682acf76900df783bf31b172134ebe31a857594e0a98ee06347da40d97b86a6ac0ce9a63ea7a80a1d73948e338f72d1c3af2 +$(DL_FILE)_BLAKE2 = 7206b9fe6c4a0509c9ce0301a5d3553274d005daae2050f23e26056d356c328719821d58d94ed2eac7942a6cafb0ca8de2cb619ce28a0f514b6eef413350e249 install : $(TARGET) @@ -75,7 +75,6 @@ $(subst %,%_BLAKE2,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zvxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squid/squid-asnbl-0.2.4_initialise_global_variables_to_make_compatible_with_python_3.patch # Install ASNBL helper script cd $(DIR_APP) && install -o root -g root -m 0755 asnbl-helper.py /usr/bin/asnbl-helper.py diff --git a/src/patches/squid/squid-asnbl-0.2.4_initialise_global_variables_to_make_compatible_with_python_3.patch b/src/patches/squid/squid-asnbl-0.2.4_initialise_global_variables_to_make_compatible_with_python_3.patch deleted file mode 100644 index e540d4e76..000000000 --- a/src/patches/squid/squid-asnbl-0.2.4_initialise_global_variables_to_make_compatible_with_python_3.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- squid-asnbl-0.2.4/asnbl-helper_orig.py -+++ squid-asnbl-0.2.4/asnbl-helper.py -@@ -172,17 +172,19 @@ - return parsedasns - - --def resolve_asn(ipaddr: str, asndb): -- """ Function call: resolve_asn(IP address to be resolved, -- ASN database instance object) -- This function looks up the Autonomous System for the given IP address. It expects -- an IPFire location database object to be passed as a second parameter, hence relying -- on another function to set that up. """ -+def resolve_asn(ipaddr: str): -+ """ Function call: resolve_asn(IP address to be resolved) -+ This function looks up the Autonomous System for the given IP address. """ -+ -+ # Fix for #13023 -+ # Initialize the result variable before it's first use, otherwise python3 -+ # will sometimes detect a 'mismatch' using global and local variables -+ lookup_result = None - - # libloc cannot handle ipaddress objects here, so casting into a string is necessary - # for good measure, to avoid exceptions here... - try: -- result = asndb.lookup(str(ipaddr)) -+ lookup_result = ASNDB.lookup(str(ipaddr)) - except BlockingIOError: - # XXX: Prevent likely libloc bug from causing this helper to crash - # (see upstream bug https://bugzilla.ipfire.org/show_bug.cgi?id=13023) -@@ -190,21 +192,25 @@ - - # In case nothing was returned above, satisfy result expectation to this function... - try: -- if not result.asn: -+ if not lookup_result.asn: - return 0 - except AttributeError: - return 0 - -- return result.asn -- -- --def asndb_response_tests(testdata: str, asndb): -- """ Function call: asndb_response_tests(response rest data, -- ASN database instance object) -+ return lookup_result.asn -+ -+ -+def asndb_response_tests(testdata: str): -+ """ Function call: asndb_response_tests(response rest data) - - This function asserts the given ASN database to return expected ASNs for - given IP addresses in order to be considered operational. It returns - True if this test succeeds, and False otherwise. """ -+ -+ # Fix for #13023 -+ # Initialize the result variable before it's first use, otherwise python3 -+ # will sometimes detect a 'mismatch' using global and local variables -+ lookup_result_test = None - - tresult = True - -@@ -216,13 +222,13 @@ - - for stestdata in ptdata: - LOGIT.debug("Running response test for '%s' against ASNDB '%s' ...", -- stestdata, asndb) -- -- returndata = resolve_asn(stestdata[0], asndb) -- -- if returndata != int(stestdata[1]): -+ stestdata, ASNDB) -+ -+ lookup_result_test = resolve_asn(stestdata[0]) -+ -+ if lookup_result_test != int(stestdata[1]): - LOGIT.error("Response test failed for ASNDB '%s' (tuple: %s), aborting", -- asndb, stestdata) -+ ASNDB, stestdata) - tresult = False - break - -@@ -428,7 +434,7 @@ - ASNDB = set_up_location_database(config["GENERAL"]["ASNDB_PATH"]) - - LOGIT.debug("Running ASN database response tests...") --if asndb_response_tests(config["GENERAL"]["TESTDATA"], ASNDB): -+if asndb_response_tests(config["GENERAL"]["TESTDATA"]): - LOGIT.debug("ASN database operational - excellent. Waiting for input...") - else: - LOGIT.error("ASN database response tests failed, aborting") -@@ -490,7 +496,7 @@ - ASNS = [] - for singleip in IPS: - # Enumerate ASN for this IP address... -- resolvedasn = resolve_asn(singleip, ASNDB) -+ resolvedasn = resolve_asn(singleip) - - # In case protection against destinations without public AS announcements for their - # IP addresses is desired, the query will be denied in case ASN = 0 appears in an