From nobody Tue Nov 14 09:39:07 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SV1TS0Z8Xz51DKL; Tue, 14 Nov 2023 09:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SV1TR6ycbz4KQl; Tue, 14 Nov 2023 09:39:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699954748; 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=cPknaPrlQi/rNWPU+SudONgDmxlTZO4RaPDAJ37bqMw=; b=TjAoqXOKEiLpIUlBXvx80D55Kprsl9AEZ9Febs6gRoTwkkcBUA0w8cMsSPdjire12gbQMc 24zApA/U7h1C6FkUI4Ggc/30z5L/8qnTyS/dMWTbIq0EE6WsxwbhnLigcJSeFrSHVBTNFl qDEPHFuZT7nI8FQqR1YaR7WJ3c7f2ZdzPgri+JIyvhQ3wUm4Y8qwNbOvk3+ZCdJmYXqJXq xUGH/R7rUWBK2Dc3+b+wfYftYau9R9Zr6oIIE2DJd7fWGZF4SofJwxM2e9XqQWHFGsn0z2 ZvBbSgdUsSTOsS5KX2iEe1HUzf7swjH7duyTVBF4ZYJSMOzdDkqzBTT6d+zltg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699954748; 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=cPknaPrlQi/rNWPU+SudONgDmxlTZO4RaPDAJ37bqMw=; b=W84og/Sh3+wLybm5qvCMomLnJPCzyO51SQ7MzHsTxOOcuCNi+XjSawOC8xaAqfw9u7YYze RzxzPXb9Y0ghZsDWZjAmdLxe6etOSAWV4Am7hGbO2vLiq1EkVGFU9tKlJH/jPmJNITOxaG +GbWJqwKbj+dM/9WpvpkXlGa6dP0FSRXQTzrlkA0lvV1HnOZbOSQmwopyvHkzGIN8G6XyC NbAdF/Hs1WZ3SQsSQQORCGgFi8ky0qFxxLCP+7a65B1mWQ5V/fLVGi1auBNJHq9VKdH5JE OSn+GQKULgf0VRVT0Yx5FCOuAsOib0wgB641+TvrV+1zn0IY/PZEeW0g1eQdOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699954748; a=rsa-sha256; cv=none; b=R0IsWhg2LH8Mz9/Hpgp/E2O67ZNCVgyHC/cqGVPUAUWg/DfMUwKZCUfWz270Z/Bd7hTLNd pM/R8Aixld13xerXSt9RnuUEyQz8IkTehD8YOqWIcf94RDDQfKv7H/vYOciKF4KcEIvOMS f9CA0uJ4wKJ/7c9es1ukfa9HUqrZ5PZZKKAhV4Wlye/NyTlwZv8CVAm1ByQLl6Ftsa+l0J +11Ncbx6IjxlMK3DsnmW8vTAF63XCD5J2Nfz7AcQUPKq87mdD06TJfu7WiNAorrOOGTvia N6blcSnQxm1diL7JIWKLcLkq3yhDUqURdz16g8tVHbqE5Uv/DjiTCMZqoBNkTQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SV1TR6296zjft; Tue, 14 Nov 2023 09:39:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AE9d7MN085211; Tue, 14 Nov 2023 09:39:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AE9d7wf085208; Tue, 14 Nov 2023 09:39:07 GMT (envelope-from git) Date: Tue, 14 Nov 2023 09:39:07 GMT Message-Id: <202311140939.3AE9d7wf085208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 20e1f207cc78 - main - ng_ipfw: allow use of 32 bits wide cookies List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20e1f207cc789a28783344614d6d1d1c639c5797 Auto-Submitted: auto-generated The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=20e1f207cc789a28783344614d6d1d1c639c5797 commit 20e1f207cc789a28783344614d6d1d1c639c5797 Author: Eugene Grosbein AuthorDate: 2023-11-14 09:36:08 +0000 Commit: Eugene Grosbein CommitDate: 2023-11-14 09:36:08 +0000 ng_ipfw: allow use of 32 bits wide cookies There is no reason in truncating 32 bits cookie value to 16 bits. Reviewed by: glebius MFC after: 2 weeks --- sys/netgraph/ng_ipfw.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c index b660a825c814..01592a4bbb7d 100644 --- a/sys/netgraph/ng_ipfw.c +++ b/sys/netgraph/ng_ipfw.c @@ -69,7 +69,7 @@ static ng_findhook_t ng_ipfw_findhook; static ng_rcvdata_t ng_ipfw_rcvdata; static ng_disconnect_t ng_ipfw_disconnect; -static hook_p ng_ipfw_findhook1(node_p, u_int16_t ); +static hook_p ng_ipfw_findhook1(node_p, uint32_t ); static int ng_ipfw_input(struct mbuf **, struct ip_fw_args *, bool); /* We have only one node */ @@ -94,7 +94,7 @@ MODULE_DEPEND(ng_ipfw, ipfw, 3, 3, 3); /* Information we store for each hook */ struct ng_ipfw_hook_priv { hook_p hook; - u_int16_t rulenum; + uint32_t cookie; }; typedef struct ng_ipfw_hook_priv *hpriv_p; @@ -152,7 +152,7 @@ static int ng_ipfw_newhook(node_p node, hook_p hook, const char *name) { hpriv_p hpriv; - u_int16_t rulenum; + uint32_t cookie; const char *cp; char *endptr; @@ -166,7 +166,7 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); /* Convert it to integer */ - rulenum = (u_int16_t)strtol(name, &endptr, 10); + cookie = (uint32_t)strtoul(name, &endptr, 10); if (*endptr != '\0') return (EINVAL); @@ -176,7 +176,7 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char *name) return (ENOMEM); hpriv->hook = hook; - hpriv->rulenum = rulenum; + hpriv->cookie = cookie; NG_HOOK_SET_PRIVATE(hook, hpriv); @@ -198,10 +198,10 @@ ng_ipfw_connect(hook_p hook) static hook_p ng_ipfw_findhook(node_p node, const char *name) { - u_int16_t n; /* numeric representation of hook */ + uint32_t n; /* numeric representation of hook */ char *endptr; - n = (u_int16_t)strtol(name, &endptr, 10); + n = (uint32_t)strtoul(name, &endptr, 10); if (*endptr != '\0') return NULL; return ng_ipfw_findhook1(node, n); @@ -209,14 +209,14 @@ ng_ipfw_findhook(node_p node, const char *name) /* Look up hook by rule number */ static hook_p -ng_ipfw_findhook1(node_p node, u_int16_t rulenum) +ng_ipfw_findhook1(node_p node, uint32_t cookie) { hook_p hook; hpriv_p hpriv; LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { hpriv = NG_HOOK_PRIVATE(hook); - if (NG_HOOK_IS_VALID(hook) && (hpriv->rulenum == rulenum)) + if (NG_HOOK_IS_VALID(hook) && (hpriv->cookie == cookie)) return (hook); }