From nobody Wed Dec 17 20:55:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D24CC77B76 for ; Mon, 17 Apr 2023 15:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbjDQPLj (ORCPT ); Mon, 17 Apr 2023 11:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjDQPL3 (ORCPT ); Mon, 17 Apr 2023 11:11:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A25847A84; Mon, 17 Apr 2023 08:11:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DBB8626BF; Mon, 17 Apr 2023 15:11:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E71FC433D2; Mon, 17 Apr 2023 15:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681744282; bh=nFZaWwujVFrftUNAia1GiV9zhEX4XBBOtU64C6rgGTg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aHfd5Es54U+PSkGYFjqXdaOz+piDfKMh6VyNxXMY5qW0A644GvPjn7OZvqJYyoUr6 /2JlUZ7BLkYYAmD/VNbmAIJ5pUE5bnK8Z1gG8KO6aXD0n8T+MtF2A5aB9NKdo8OMer B1WlRRiM4WfrLVBXrNGplpBNYCkUbTkduOMnrj7vMFtvuteH8LmzTUZJXN4VHwoyr+ L9cNt5v+j9QmxhY/++d02Yp8qVUg7v4jbB8D0F9gYA+Hsw7HhU2loxUJ9JmdrxlOvN 4+1BXYFAo2m4zZl1+uID5Z+jJ+R1lD9RReitlqte8BQ4pvmTXhmUR45K+DiKjxmzAI L0zl5SiwftTBg== From: Simon Horman Date: Mon, 17 Apr 2023 17:10:45 +0200 Subject: [PATCH nf-next v3 1/4] ipvs: Update width of source for ip_vs_sync_conn_options MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230409-ipvs-cleanup-v3-1-5149ea34b0b9@kernel.org> References: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> In-Reply-To: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> To: Julian Anastasov Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Horatiu Vultur X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ip_vs_sync_conn_v0() copy is made to struct ip_vs_sync_conn_options. That structure looks like this: struct ip_vs_sync_conn_options { struct ip_vs_seq in_seq; struct ip_vs_seq out_seq; }; The source of the copy is the in_seq field of struct ip_vs_conn. Whose type is struct ip_vs_seq. Thus we can see that the source - is not as wide as the amount of data copied, which is the width of struct ip_vs_sync_conn_option. The copy is safe because the next field in is another struct ip_vs_seq. Make use of struct_group() to annotate this. Flagged by gcc-13 as: In file included from ./include/linux/string.h:254, from ./include/linux/bitmap.h:11, from ./include/linux/cpumask.h:12, from ./arch/x86/include/asm/paravirt.h:17, from ./arch/x86/include/asm/cpuid.h:62, from ./arch/x86/include/asm/processor.h:19, from ./arch/x86/include/asm/timex.h:5, from ./include/linux/timex.h:67, from ./include/linux/time32.h:13, from ./include/linux/time.h:60, from ./include/linux/stat.h:19, from ./include/linux/module.h:13, from net/netfilter/ipvs/ip_vs_sync.c:38: In function 'fortify_memcpy_chk', inlined from 'ip_vs_sync_conn_v0' at net/netfilter/ipvs/ip_vs_sync.c:6= 06:3: ./include/linux/fortify-string.h:529:25: error: call to '__read_overflow2_= field' declared with attribute warning: detected read beyond size of field = (2nd parameter); maybe use struct_group()? [-Werror=3Dattribute-warning] 529 | __read_overflow2_field(q_size_field, size); | Compile tested only. Signed-off-by: Simon Horman Reviewed-by: Horatiu Vultur Acked-by: Julian Anastasov --- v3 - Add Horatiu's Reviewed-by tag v2 - Correct spelling of 'conn' in subject - No change --- include/net/ip_vs.h | 6 ++++-- net/netfilter/ipvs/ip_vs_sync.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 6d71a5ff52df..e20f1f92066d 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -630,8 +630,10 @@ struct ip_vs_conn { */ struct ip_vs_app *app; /* bound ip_vs_app object */ void *app_data; /* Application private data */ - struct ip_vs_seq in_seq; /* incoming seq. struct */ - struct ip_vs_seq out_seq; /* outgoing seq. struct */ + struct_group(sync_conn_opt, + struct ip_vs_seq in_seq; /* incoming seq. struct */ + struct ip_vs_seq out_seq; /* outgoing seq. struct */ + ); =20 const struct ip_vs_pe *pe; char *pe_data; diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_syn= c.c index 4963fec815da..d4fe7bb4f853 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c @@ -603,7 +603,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs,= struct ip_vs_conn *cp, if (cp->flags & IP_VS_CONN_F_SEQ_MASK) { struct ip_vs_sync_conn_options *opt =3D (struct ip_vs_sync_conn_options *)&s[1]; - memcpy(opt, &cp->in_seq, sizeof(*opt)); + memcpy(opt, &cp->sync_conn_opt, sizeof(*opt)); } =20 m->nr_conns++; --=20 2.30.2 From nobody Wed Dec 17 20:55:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF062C77B7C for ; Mon, 17 Apr 2023 15:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbjDQPLo (ORCPT ); Mon, 17 Apr 2023 11:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbjDQPLc (ORCPT ); Mon, 17 Apr 2023 11:11:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E04CFAF02; Mon, 17 Apr 2023 08:11:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 473A3626A5; Mon, 17 Apr 2023 15:11:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13DD4C4339E; Mon, 17 Apr 2023 15:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681744285; bh=jO4SH5SYNICEVsSAgMcpOLdT5eYDNjxqRtRYykVAw9k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Xa8XIpFrXoflrJBQKG7si4QG+0+RGUdY/4Ko5Z41kDhHwhPE2skB8OCOMXsC3R0st hrN9wcf2uokQC/+eaP5Xt3j9/zzCO9Om6XZm1Bbe1YEm74QvOfm0V0qRFGDTGoZhvn mImIMqsCoaKKlae40Rjexr+/KI+j+9MESb4pbiCSknd6svf2itMNfN//eAh7bWjjo2 NRObpOgXCqgCPaMYn8G8XTkGfs3NPHHe4RXmYqCUcBX1HIL3MeX4gFNr+lQ35MjTm/ ebZamN4OEoyFT6f/srItZ66jOLcqaGwoUTfR4M87xWypmCR/PZwibDL+3W+J6jYjC6 2h4A6BCartadQ== From: Simon Horman Date: Mon, 17 Apr 2023 17:10:46 +0200 Subject: [PATCH nf-next v3 2/4] ipvs: Consistently use array_size() in ip_vs_conn_init() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230409-ipvs-cleanup-v3-2-5149ea34b0b9@kernel.org> References: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> In-Reply-To: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> To: Julian Anastasov Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Horatiu Vultur X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Consistently use array_size() to calculate the size of ip_vs_conn_tab in bytes. Flagged by Coccinelle: WARNING: array_size is already used (line 1498) to compute the same size No functional change intended. Compile tested only. Signed-off-by: Simon Horman Reviewed-by: Horatiu Vultur Acked-by: Julian Anastasov --- v3 - Correct division by 1024. It was applied to the wrong variable in v2. - Add Horatiu's Reviewed-by tag v2 - Retain division by 1024, which was lost in v1 --- net/netfilter/ipvs/ip_vs_conn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_con= n.c index 13534e02346c..928e64653837 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -1481,6 +1481,7 @@ void __net_exit ip_vs_conn_net_cleanup(struct netns_i= pvs *ipvs) =20 int __init ip_vs_conn_init(void) { + size_t tab_array_size; int idx; =20 /* Compute size and mask */ @@ -1494,8 +1495,9 @@ int __init ip_vs_conn_init(void) /* * Allocate the connection hash table and initialize its list heads */ - ip_vs_conn_tab =3D vmalloc(array_size(ip_vs_conn_tab_size, - sizeof(*ip_vs_conn_tab))); + tab_array_size =3D array_size(ip_vs_conn_tab_size, + sizeof(*ip_vs_conn_tab)); + ip_vs_conn_tab =3D vmalloc(tab_array_size); if (!ip_vs_conn_tab) return -ENOMEM; =20 @@ -1508,10 +1510,8 @@ int __init ip_vs_conn_init(void) return -ENOMEM; } =20 - pr_info("Connection hash table configured " - "(size=3D%d, memory=3D%ldKbytes)\n", - ip_vs_conn_tab_size, - (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024); + pr_info("Connection hash table configured (size=3D%d, memory=3D%zdKbytes)= \n", + ip_vs_conn_tab_size, tab_array_size / 1024); IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n", sizeof(struct ip_vs_conn)); =20 --=20 2.30.2 From nobody Wed Dec 17 20:55:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56320C77B76 for ; Mon, 17 Apr 2023 15:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbjDQPMI (ORCPT ); Mon, 17 Apr 2023 11:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjDQPLg (ORCPT ); Mon, 17 Apr 2023 11:11:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F25487A84; Mon, 17 Apr 2023 08:11:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E95E621FB; Mon, 17 Apr 2023 15:11:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18DE8C433EF; Mon, 17 Apr 2023 15:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681744288; bh=whZTf1hzR45rkNGiBA/AvMf3yE1yk6zr+/351uv3il8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LwutzdALUHvedzMs81IyaeBr740xC45OICwclcOK5pjD59pAI90XcdBNfSYmHYCDX fbHB3T9nNpXikb0n3rsemH/Sj5nkl9rqIS9zG+aD90mw1PLIqJfK8i95noNTfNPpdJ dwXYeFRpLQONqoivhXsLvvvZk8qgjNj10wBW4FbeB4wMAvch4HOSRndRq+PhJNa2dV 3LdASlyqtWPlpNDTnjbatFdUZRUCtmBf8ThhHU7i5LHgE81yR0XeCrcMj4n2N4vU7W BZBcmIARZkPmuNgFUkadujrYBZbxbgZU+mlhMAgCIE7fpG7mn4mlrkLeIm+nRyvPb+ iCZ5rSuNMAMUA== From: Simon Horman Date: Mon, 17 Apr 2023 17:10:47 +0200 Subject: [PATCH nf-next v3 3/4] ipvs: Remove {Enter,Leave}Function MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230409-ipvs-cleanup-v3-3-5149ea34b0b9@kernel.org> References: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> In-Reply-To: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> To: Julian Anastasov Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Horatiu Vultur X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove EnterFunction and LeaveFunction. These debugging macros seem well past their use-by date. And seem to have little value these days. Removing them allows some trivial cleanup of some exit paths for some functions. These are also included in this patch. There is likely scope for further cleanup of both debugging and unwind paths. But let's leave that for another day. Only intended to change debug output, and only when CONFIG_IP_VS_DEBUG is enabled. Compile tested only. Signed-off-by: Simon Horman Reviewed-by: Horatiu Vultur Acked-by: Julian Anastasov --- v3 - Add Horatiu's Reviewed-by tag v2 - No change --- include/net/ip_vs.h | 20 ------------- net/netfilter/ipvs/ip_vs_core.c | 8 ------ net/netfilter/ipvs/ip_vs_ctl.c | 26 +---------------- net/netfilter/ipvs/ip_vs_sync.c | 5 ---- net/netfilter/ipvs/ip_vs_xmit.c | 62 ++++++-------------------------------= ---- 5 files changed, 9 insertions(+), 112 deletions(-) diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index e20f1f92066d..a3adc246ee31 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -265,26 +265,6 @@ static inline const char *ip_vs_dbg_addr(int af, char = *buf, size_t buf_len, pr_err(msg, ##__VA_ARGS__); \ } while (0) =20 -#ifdef CONFIG_IP_VS_DEBUG -#define EnterFunction(level) \ - do { \ - if (level <=3D ip_vs_get_debug_level()) \ - printk(KERN_DEBUG \ - pr_fmt("Enter: %s, %s line %i\n"), \ - __func__, __FILE__, __LINE__); \ - } while (0) -#define LeaveFunction(level) \ - do { \ - if (level <=3D ip_vs_get_debug_level()) \ - printk(KERN_DEBUG \ - pr_fmt("Leave: %s, %s line %i\n"), \ - __func__, __FILE__, __LINE__); \ - } while (0) -#else -#define EnterFunction(level) do {} while (0) -#define LeaveFunction(level) do {} while (0) -#endif - /* The port number of FTP service (in network order). */ #define FTPPORT cpu_to_be16(21) #define FTPDATA cpu_to_be16(20) diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_cor= e.c index 2fcc26507d69..cb83ca506c5c 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -1140,7 +1140,6 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_se= rvice *svc, __be16 vport; unsigned int flags; =20 - EnterFunction(12); vaddr =3D &svc->addr; vport =3D svc->port; daddr =3D &iph->saddr; @@ -1208,7 +1207,6 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_se= rvice *svc, IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport), IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport), cp->flags, refcount_read(&cp->refcnt)); - LeaveFunction(12); return cp; } =20 @@ -1316,13 +1314,11 @@ handle_response(int af, struct sk_buff *skb, struct= ip_vs_proto_data *pd, ip_vs_update_conntrack(skb, cp, 0); ip_vs_conn_put(cp); =20 - LeaveFunction(11); return NF_ACCEPT; =20 drop: ip_vs_conn_put(cp); kfree_skb(skb); - LeaveFunction(11); return NF_STOLEN; } =20 @@ -1341,8 +1337,6 @@ ip_vs_out_hook(void *priv, struct sk_buff *skb, const= struct nf_hook_state *stat int af =3D state->pf; struct sock *sk; =20 - EnterFunction(11); - /* Already marked as IPVS request or reply? */ if (skb->ipvs_property) return NF_ACCEPT; @@ -2365,7 +2359,6 @@ static void __net_exit __ip_vs_dev_cleanup_batch(stru= ct list_head *net_list) struct netns_ipvs *ipvs; struct net *net; =20 - EnterFunction(2); list_for_each_entry(net, net_list, exit_list) { ipvs =3D net_ipvs(net); ip_vs_unregister_hooks(ipvs, AF_INET); @@ -2374,7 +2367,6 @@ static void __net_exit __ip_vs_dev_cleanup_batch(stru= ct list_head *net_list) smp_wmb(); ip_vs_sync_net_cleanup(ipvs); } - LeaveFunction(2); } =20 static struct pernet_operations ipvs_core_ops =3D { diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 2a5ed71c82c3..62606fb44d02 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -1061,8 +1061,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) unsigned int atype; int ret; =20 - EnterFunction(2); - #ifdef CONFIG_IP_VS_IPV6 if (udest->af =3D=3D AF_INET6) { atype =3D ipv6_addr_type(&udest->addr.in6); @@ -1111,7 +1109,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) spin_lock_init(&dest->dst_lock); __ip_vs_update_dest(svc, dest, udest, 1); =20 - LeaveFunction(2); return 0; =20 err_stats: @@ -1134,8 +1131,6 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) __be16 dport =3D udest->port; int ret; =20 - EnterFunction(2); - if (udest->weight < 0) { pr_err("%s(): server weight less than zero\n", __func__); return -ERANGE; @@ -1183,7 +1178,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) =20 ret =3D ip_vs_start_estimator(svc->ipvs, &dest->stats); if (ret < 0) - goto err; + return ret; __ip_vs_update_dest(svc, dest, udest, 1); } else { /* @@ -1192,9 +1187,6 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) ret =3D ip_vs_new_dest(svc, udest); } =20 -err: - LeaveFunction(2); - return ret; } =20 @@ -1209,8 +1201,6 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_= vs_dest_user_kern *udest) union nf_inet_addr daddr; __be16 dport =3D udest->port; =20 - EnterFunction(2); - if (udest->weight < 0) { pr_err("%s(): server weight less than zero\n", __func__); return -ERANGE; @@ -1242,7 +1232,6 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_= vs_dest_user_kern *udest) } =20 __ip_vs_update_dest(svc, dest, udest, 0); - LeaveFunction(2); =20 return 0; } @@ -1317,8 +1306,6 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) struct ip_vs_dest *dest; __be16 dport =3D udest->port; =20 - EnterFunction(2); - /* We use function that requires RCU lock */ rcu_read_lock(); dest =3D ip_vs_lookup_dest(svc, udest->af, &udest->addr, dport); @@ -1339,8 +1326,6 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_v= s_dest_user_kern *udest) */ __ip_vs_del_dest(svc->ipvs, dest, false); =20 - LeaveFunction(2); - return 0; } =20 @@ -1746,7 +1731,6 @@ void ip_vs_service_nets_cleanup(struct list_head *net= _list) struct netns_ipvs *ipvs; struct net *net; =20 - EnterFunction(2); /* Check for "full" addressed entries */ mutex_lock(&__ip_vs_mutex); list_for_each_entry(net, net_list, exit_list) { @@ -1754,7 +1738,6 @@ void ip_vs_service_nets_cleanup(struct list_head *net= _list) ip_vs_flush(ipvs, true); } mutex_unlock(&__ip_vs_mutex); - LeaveFunction(2); } =20 /* Put all references for device (dst_cache) */ @@ -1792,7 +1775,6 @@ static int ip_vs_dst_event(struct notifier_block *thi= s, unsigned long event, if (event !=3D NETDEV_DOWN || !ipvs) return NOTIFY_DONE; IP_VS_DBG(3, "%s() dev=3D%s\n", __func__, dev->name); - EnterFunction(2); mutex_lock(&__ip_vs_mutex); for (idx =3D 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { hlist_for_each_entry(svc, &ip_vs_svc_table[idx], s_list) { @@ -1821,7 +1803,6 @@ static int ip_vs_dst_event(struct notifier_block *thi= s, unsigned long event, } spin_unlock_bh(&ipvs->dest_trash_lock); mutex_unlock(&__ip_vs_mutex); - LeaveFunction(2); return NOTIFY_DONE; } =20 @@ -4537,8 +4518,6 @@ int __init ip_vs_control_init(void) int idx; int ret; =20 - EnterFunction(2); - /* Initialize svc_table, ip_vs_svc_fwm_table */ for (idx =3D 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { INIT_HLIST_HEAD(&ip_vs_svc_table[idx]); @@ -4551,15 +4530,12 @@ int __init ip_vs_control_init(void) if (ret < 0) return ret; =20 - LeaveFunction(2); return 0; } =20 =20 void ip_vs_control_cleanup(void) { - EnterFunction(2); unregister_netdevice_notifier(&ip_vs_dst_notifier); /* relying on common rcu_barrier() in ip_vs_cleanup() */ - LeaveFunction(2); } diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_syn= c.c index d4fe7bb4f853..264f2f87a437 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c @@ -1582,13 +1582,11 @@ ip_vs_send_async(struct socket *sock, const char *b= uffer, const size_t length) struct kvec iov; int len; =20 - EnterFunction(7); iov.iov_base =3D (void *)buffer; iov.iov_len =3D length; =20 len =3D kernel_sendmsg(sock, &msg, &iov, 1, (size_t)(length)); =20 - LeaveFunction(7); return len; } =20 @@ -1614,15 +1612,12 @@ ip_vs_receive(struct socket *sock, char *buffer, co= nst size_t buflen) struct kvec iov =3D {buffer, buflen}; int len; =20 - EnterFunction(7); - /* Receive a packet */ iov_iter_kvec(&msg.msg_iter, ITER_DEST, &iov, 1, buflen); len =3D sock_recvmsg(sock, &msg, MSG_DONTWAIT); if (len < 0) return len; =20 - LeaveFunction(7); return len; } =20 diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmi= t.c index 99c349c0d968..feb1d7fcb09f 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c @@ -706,8 +706,6 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_con= n *cp, { struct iphdr *iph =3D ip_hdr(skb); =20 - EnterFunction(10); - if (__ip_vs_get_out_rt(cp->ipvs, cp->af, skb, NULL, iph->daddr, IP_VS_RT_MODE_NON_LOCAL, NULL, ipvsh) < 0) goto tx_error; @@ -719,12 +717,10 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_c= onn *cp, =20 ip_vs_send_or_cont(NFPROTO_IPV4, skb, cp, 0); =20 - LeaveFunction(10); return NF_STOLEN; =20 tx_error: kfree_skb(skb); - LeaveFunction(10); return NF_STOLEN; } =20 @@ -735,8 +731,6 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_= conn *cp, { struct ipv6hdr *iph =3D ipv6_hdr(skb); =20 - EnterFunction(10); - if (__ip_vs_get_out_rt_v6(cp->ipvs, cp->af, skb, NULL, &iph->daddr, NULL, ipvsh, 0, IP_VS_RT_MODE_NON_LOCAL) < 0) @@ -747,12 +741,10 @@ ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_v= s_conn *cp, =20 ip_vs_send_or_cont(NFPROTO_IPV6, skb, cp, 0); =20 - LeaveFunction(10); return NF_STOLEN; =20 tx_error: kfree_skb(skb); - LeaveFunction(10); return NF_STOLEN; } #endif @@ -768,8 +760,6 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *= cp, struct rtable *rt; /* Route to the other host */ int local, rc, was_input; =20 - EnterFunction(10); - /* check if it is a connection of no-client-port */ if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) { __be16 _pt, *p; @@ -839,12 +829,10 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn= *cp, =20 rc =3D ip_vs_nat_send_or_cont(NFPROTO_IPV4, skb, cp, local); =20 - LeaveFunction(10); return rc; =20 tx_error: kfree_skb(skb); - LeaveFunction(10); return NF_STOLEN; } =20 @@ -856,8 +844,6 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_con= n *cp, struct rt6_info *rt; /* Route to the other host */ int local, rc; =20 - EnterFunction(10); - /* check if it is a connection of no-client-port */ if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT && !ipvsh->fragoffs)) { __be16 _pt, *p; @@ -927,11 +913,9 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_co= nn *cp, =20 rc =3D ip_vs_nat_send_or_cont(NFPROTO_IPV6, skb, cp, local); =20 - LeaveFunction(10); return rc; =20 tx_error: - LeaveFunction(10); kfree_skb(skb); return NF_STOLEN; } @@ -1149,8 +1133,6 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_c= onn *cp, int tun_type, gso_type; int tun_flags; =20 - EnterFunction(10); - local =3D __ip_vs_get_out_rt(ipvs, cp->af, skb, cp->dest, cp->daddr.ip, IP_VS_RT_MODE_LOCAL | IP_VS_RT_MODE_NON_LOCAL | @@ -1199,7 +1181,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_c= onn *cp, &next_protocol, NULL, &dsfield, &ttl, dfp); if (IS_ERR(skb)) - goto tx_error; + return NF_STOLEN; =20 gso_type =3D __tun_gso_type_mask(AF_INET, cp->af); if (tun_type =3D=3D IP_VS_CONN_F_TUNNEL_TYPE_GUE) { @@ -1267,14 +1249,10 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs= _conn *cp, else if (ret =3D=3D NF_DROP) kfree_skb(skb); =20 - LeaveFunction(10); - return NF_STOLEN; =20 tx_error: - if (!IS_ERR(skb)) - kfree_skb(skb); - LeaveFunction(10); + kfree_skb(skb); return NF_STOLEN; } =20 @@ -1298,8 +1276,6 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_v= s_conn *cp, int tun_type, gso_type; int tun_flags; =20 - EnterFunction(10); - local =3D __ip_vs_get_out_rt_v6(ipvs, cp->af, skb, cp->dest, &cp->daddr.in6, &saddr, ipvsh, 1, @@ -1347,7 +1323,7 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_v= s_conn *cp, &next_protocol, &payload_len, &dsfield, &ttl, NULL); if (IS_ERR(skb)) - goto tx_error; + return NF_STOLEN; =20 gso_type =3D __tun_gso_type_mask(AF_INET6, cp->af); if (tun_type =3D=3D IP_VS_CONN_F_TUNNEL_TYPE_GUE) { @@ -1414,14 +1390,10 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip= _vs_conn *cp, else if (ret =3D=3D NF_DROP) kfree_skb(skb); =20 - LeaveFunction(10); - return NF_STOLEN; =20 tx_error: - if (!IS_ERR(skb)) - kfree_skb(skb); - LeaveFunction(10); + kfree_skb(skb); return NF_STOLEN; } #endif @@ -1437,8 +1409,6 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn = *cp, { int local; =20 - EnterFunction(10); - local =3D __ip_vs_get_out_rt(cp->ipvs, cp->af, skb, cp->dest, cp->daddr.i= p, IP_VS_RT_MODE_LOCAL | IP_VS_RT_MODE_NON_LOCAL | @@ -1455,12 +1425,10 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_con= n *cp, =20 ip_vs_send_or_cont(NFPROTO_IPV4, skb, cp, 0); =20 - LeaveFunction(10); return NF_STOLEN; =20 tx_error: kfree_skb(skb); - LeaveFunction(10); return NF_STOLEN; } =20 @@ -1471,8 +1439,6 @@ ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_co= nn *cp, { int local; =20 - EnterFunction(10); - local =3D __ip_vs_get_out_rt_v6(cp->ipvs, cp->af, skb, cp->dest, &cp->daddr.in6, NULL, ipvsh, 0, @@ -1489,12 +1455,10 @@ ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_= conn *cp, =20 ip_vs_send_or_cont(NFPROTO_IPV6, skb, cp, 0); =20 - LeaveFunction(10); return NF_STOLEN; =20 tx_error: kfree_skb(skb); - LeaveFunction(10); return NF_STOLEN; } #endif @@ -1514,8 +1478,6 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_con= n *cp, int local; int rt_mode, was_input; =20 - EnterFunction(10); - /* The ICMP packet for VS/TUN, VS/DR and LOCALNODE will be forwarded directly here, because there is no need to translate address/port back */ @@ -1526,7 +1488,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_con= n *cp, rc =3D NF_ACCEPT; /* do not touch skb anymore */ atomic_inc(&cp->in_pkts); - goto out; + return rc; } =20 /* @@ -1582,14 +1544,11 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_c= onn *cp, /* Another hack: avoid icmp_send in ip_fragment */ skb->ignore_df =3D 1; =20 - rc =3D ip_vs_nat_send_or_cont(NFPROTO_IPV4, skb, cp, local); - goto out; + return ip_vs_nat_send_or_cont(NFPROTO_IPV4, skb, cp, local); =20 tx_error: kfree_skb(skb); rc =3D NF_STOLEN; - out: - LeaveFunction(10); return rc; } =20 @@ -1604,8 +1563,6 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_= conn *cp, int local; int rt_mode; =20 - EnterFunction(10); - /* The ICMP packet for VS/TUN, VS/DR and LOCALNODE will be forwarded directly here, because there is no need to translate address/port back */ @@ -1616,7 +1573,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_= conn *cp, rc =3D NF_ACCEPT; /* do not touch skb anymore */ atomic_inc(&cp->in_pkts); - goto out; + return rc; } =20 /* @@ -1671,14 +1628,11 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_v= s_conn *cp, /* Another hack: avoid icmp_send in ip_fragment */ skb->ignore_df =3D 1; =20 - rc =3D ip_vs_nat_send_or_cont(NFPROTO_IPV6, skb, cp, local); - goto out; + return ip_vs_nat_send_or_cont(NFPROTO_IPV6, skb, cp, local); =20 tx_error: kfree_skb(skb); rc =3D NF_STOLEN; -out: - LeaveFunction(10); return rc; } #endif --=20 2.30.2 From nobody Wed Dec 17 20:55:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDCF5C77B7D for ; Mon, 17 Apr 2023 15:12:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbjDQPMM (ORCPT ); Mon, 17 Apr 2023 11:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjDQPLh (ORCPT ); Mon, 17 Apr 2023 11:11:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD167EEB; Mon, 17 Apr 2023 08:11:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A0AB626BF; Mon, 17 Apr 2023 15:11:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48DF7C4339E; Mon, 17 Apr 2023 15:11:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681744291; bh=OrjAc+wbX0jpj9qzIPJ1s02xVVZRRz0IOup4npCXGEU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qVcQSXwfN2IOEPk6rPNi5wRCCpX/qu6w/oFUi+fyRZ+MGYdVUofHnNyfhknWASswD 1gEvYIKgzjuUj9biC5QuzS93vTh0u90AT+5pJ0J0M5JJwWYXfxeN+vmWo9rFfTNlHa 2UHwubuenTQkVklL+9c+GZNXtWrZu6/EzeSw5ee9/5U61n9DrWDH3EkMBEuBYyyrQ1 FZWCbtxL/Iv3CcRtBaz6N6Qoq5RHtAkXv3or6QqQH4ngJgjXXbHEbwz5Lw9j/B8OYp m1uZy1zaxMUuHjIWatIH8hXR2qEDH4GE23y3Rr+HAzDLcSHRpGujgy+f83wz1fZGEx 1FkTAPvhongVg== From: Simon Horman Date: Mon, 17 Apr 2023 17:10:48 +0200 Subject: [PATCH nf-next v3 4/4] ipvs: Correct spelling in comments MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230409-ipvs-cleanup-v3-4-5149ea34b0b9@kernel.org> References: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> In-Reply-To: <20230409-ipvs-cleanup-v3-0-5149ea34b0b9@kernel.org> To: Julian Anastasov Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Horatiu Vultur X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correct some spelling errors flagged by codespell and found by inspection. Signed-off-by: Simon Horman Reviewed-by: Horatiu Vultur Acked-by: Julian Anastasov --- v3 - Add Horatiu's Reviewed-by tag v2 - No change --- include/net/ip_vs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index a3adc246ee31..ff406ef4fd4a 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -584,7 +584,7 @@ struct ip_vs_conn { spinlock_t lock; /* lock for state transition */ volatile __u16 state; /* state info */ volatile __u16 old_state; /* old state, to be used for - * state transition triggerd + * state transition triggered * synchronization */ __u32 fwmark; /* Fire wall mark from skb */ @@ -635,7 +635,7 @@ struct ip_vs_service_user_kern { u16 protocol; union nf_inet_addr addr; /* virtual ip address */ __be16 port; - u32 fwmark; /* firwall mark of service */ + u32 fwmark; /* firewall mark of service */ =20 /* virtual service options */ char *sched_name; @@ -1036,7 +1036,7 @@ struct netns_ipvs { struct ipvs_sync_daemon_cfg bcfg; /* Backup Configuration */ /* net name space ptr */ struct net *net; /* Needed by timer routines */ - /* Number of heterogeneous destinations, needed becaus heterogeneous + /* Number of heterogeneous destinations, needed because heterogeneous * are not supported when synchronization is enabled. */ unsigned int mixed_address_family_dests; --=20 2.30.2