| Message ID | 20261104033304.7CD45606A329@smtp.subspace.kernel.org |
|---|---|
| State | New |
| Headers | show
Return-Path: <netfilter-devel+bounces-16866-incoming=patchwork.ozlabs.org@vger.kernel.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netfilter-devel+bounces-16866-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) (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 legolas.ozlabs.org (Postfix) with ESMTPS id 4jK9xv4c1Pz1y2d for <incoming@patchwork.ozlabs.org>; Wed, 04 Nov 2026 14:33:07 +1100 (AEDT) Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 6BE852360B for <incoming@patchwork.ozlabs.org>; Wed, 4 Nov 2026 03:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793763184; b=OZRDwWwxlT4ZoymjwYtnp1gnuSg5+QuAPuWx+w5LG8smJEAPw0kB55g1Zjyce4ThJlxV x9hduDgQm5Pa4DeWeqUfkoDfabJOr8tVuT66kie6Eq4LLOW8UdSV71c/dF34jXxREpFFr PvMVdohic7bUNRbnZ5en5XHheRreknm4DPPrHG2OqS9wvwT0BuwbkCCw9G328q9iJdp+D ehKBqKobVb7IOZxw+eYXOMK885eDLDL/0feuasJ092UrV/cHGplol7hVEYL1t99hSDRYa tL+BpfriVTrXyeXuJ0EcBuri2On9JzUn/SD9i7VYSWNqs6YpxO2vu9Dxp1ADGSo2fyw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793763184; h=X-Original-To:Received:DMARC-Filter:X-UUID:X-CID-P-RULE:X-CID-O-INFO: X-CID-META:X-CID-BVR:X-CID-BAS:X-CID-FACTOR:X-CID-RHF:X-UUID:X-User: Received:From:To:Cc:Subject:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Message-Id:Date; bh=l8VqXxd/sdfHt2LeZCunmDHUpQmLkttaE3civqC/2uc=; b=DCU62dEAbDwG9//ZFzow0mApGxye4vCAvrb0bVkZ3gOvVA/WTQnSluWDtijUA1buaaXX 3TVcDPY7qZiBkMBbzUM9mLwLfpkWx6F4iYumT2628Ae4ps22AYU1YX0h6tRICnIZvExyE Xi1XGoMyhbjl6GHlldaAFx5syaIaHPBtfE0rv47I8jKr6JY1If6RHAHFd+hDpOCGiKccp V55bzNXRLrn8m9oIY9XTvqfgu2f7Y17+SVm0Wypz9yS4Sm5Tvb3ovHSjPdRAy4Xg7vgYk N1uIM9AObW9h4F+8KQaIxSLgtqRx7/XFW9JM9/tVhRXj3ihc/DaOfURVJ0uyLg7DdxQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CD45606A329; Wed, 4 Nov 2026 03:33:04 +0000 (UTC) X-Original-To: netfilter-devel@vger.kernel.org Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=124.126.103.232 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793763184; b=PGwbt9Oa0n9pi0IZuk1zaWY/YGZYJRAwavNlctH6e5IT/e5UFh0Fo3tMW3VzD4V8IHUT w6aaX5GeknxhJve9hgwwRK2iaLVIABJUMXW4l4SSTRKufV1BbqgN4D1l2TTbiBVt2nTNx HWuyoDlWRVjCFpNzX/GBbXO5YWfJiz1kkjagIFVY1hl3kqFtaEOfDGiJD7ngYyeMHZo8Y 2st4sK4tlBMDEtYXCcbEnpOIpec0hS2fB2ozdVsKk6R4cSgE3GcSpG3CFjP3m5fURwE2W 54eNH3rNH3jx+p7UMATVV8SbnZyakznDiSxTzF6TWXAYH7SFK6+qUo79s43SNovnU0w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793763184; h=DMARC-Filter:X-UUID:X-CID-P-RULE:X-CID-O-INFO:X-CID-META:X-CID-BVR: X-CID-BAS:X-CID-FACTOR:X-CID-RHF:X-UUID:X-User:Received:From:To:Cc: Subject:In-Reply-To:Content-Type:Content-Transfer-Encoding: MIME-Version; bh=l8VqXxd/sdfHt2LeZCunmDHUpQmLkttaE3civqC/2uc=; b=rNTNmTiDp0+peRRfNS55idg+Vqw04fop6GWWpvdvIgZMRhRn5P6R+DabwWWmlLS2cnMs 0KLGfYhsDLgOxr+jQkPRbpVTJO2TNgHbEDEM6hB+mq4MJ1iNCZd9ZiZpO5FF7zx6eJyMv 0zJa3GES1p43BQApyB78Pe6qIpuLaqkH6kAuxy+xthYD0VPojJzxFJQ02iHEIRs5t10oP XtESeaBYUsVpmubB3r3veYkj5O25vy07Q8uWNXsYaDJzLPox2kxiM6kSd6peJY70jAGPA bPWMJEJCKGHL+Xs8JgwRen9pBBD9PuNVXJwDgQPU52kyAAkP4T4AHli+du9e69L+OhQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.remote-ip=124.126.103.232 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8684606A31B for <netfilter-devel@vger.kernel.org>; Wed, 4 Nov 2026 03:33:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E8684606A31B Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 6c470e5ed80011f19a56ed5b684f684d-20261104 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:c578295c-945f-4d84-8d15-e5ab0e360a6d,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:7db8b62,CLOUDID:ea64efadd61072fb2bf8b8ab97d23355,BulkI D:nil,BulkQuantity:0,SF:82|102|136|865|898,TC:nil,Content:0|15|50|99,EDM:- 3|-100,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OS A:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 6c470e5ed80011f19a56ed5b684f684d-20261104 X-User: yupeng@kylinos.cn Received: from [127.0.1.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from <yupeng@kylinos.cn>) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 567319487; Wed, 04 Nov 2026 11:32:55 +0800 From: YuPeng <yupeng@kylinos.cn> To: netfilter-devel@vger.kernel.org Cc: fw@strlen.de, phil@nwl.cc, debianyu@163.com Subject: [PATCH v2] extensions: ebt_string: Fix --string-icase using ebt_check_inverse In-Reply-To: <atXZ1Fc4HOy--Wam@strlen.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: <netfilter-devel.vger.kernel.org> List-Post: <mailto:netfilter-devel@vger.kernel.org> List-Help: <mailto:netfilter-devel+help@vger.kernel.org> List-Subscribe: <mailto:netfilter-devel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:netfilter-devel+unsubscribe@vger.kernel.org> List-Owner: <mailto:netfilter-devel+owner@vger.kernel.org> Precedence: list MIME-Version: 1.0 Message-Id: <20261104033304.7CD45606A329@smtp.subspace.kernel.org> Date: Wed, 4 Nov 2026 03:33:04 +0000 (UTC) |
| Series |
[v2] extensions: ebt_string: Fix --string-icase using ebt_check_inverse
|
expand
|
diff --git a/extensions/ebt_string.c b/extensions/ebt_string.c index 97fbe19..cbbe103 100644 --- a/extensions/ebt_string.c +++ b/extensions/ebt_string.c @@ -174,7 +174,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, break; case STRING_ICASE: ebt_check_option2(flags, OPT_STRING_ICASE); - if (ebt_check_inverse2(optarg)) + if (ebt_check_inverse(optarg)) ebt_print_error2("Unexpected `!' after --string-icase"); info->u.v1.flags |= XT_STRING_FLAG_IGNORECASE; break;
--string-icase is registered as a no_argument option, so getopt_long always sets optarg to NULL when it is parsed. The ebt_check_inverse2() macro contains a mandatory-argument guard: if (!optarg) { __ebt_print_error("Option without (mandatory) argument"); return -1; } so every use of --string-icase aborts parsing with the misleading error "Option without (mandatory) argument." and XT_STRING_FLAG_IGNORECASE can never be set. The option has been broken since it was added in commit b1cdae8 ("extensions: Add string filter to ebtables"). Reproducer (no privileges required): $ ebtables-legacy --string-icase Option without (mandatory) argument. Use ebt_check_inverse() instead: it tolerates a NULL optarg and returns the current ebt_invert state, which the main option loop resets to 0 after every option, so the flag is set as intended and the "Unexpected '!'" diagnostic is kept. This fix was originally carried in the Kylin Linux SRPM since 2022; the commit message has been rewritten to describe the actual failure mode observed on current master. Signed-off-by: YuPeng <yupeng@kylinos.cn> --- v2: Use ebt_check_inverse() instead of removing the check entirely, as suggested by Florian Westphal. No other changes. extensions/ebt_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)