lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 18 Feb 2024 08:35:51 -0500
From: Oliver Crumrine <ozlinuxc@...il.com>
To: davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com, 
	kuba@...nel.org, pabeni@...hat.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH net-next] net: copy routing table more efficiently in
 rt_dst_clone

Instead of copying field-by-field, copy the entire struct at once. This
should lead to a performance improvment in rt_dst_clone.

Signed-off-by: Oliver Crumrine <ozlinuxc@...il.com>
---
 net/ipv4/route.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 16615d107cf0..ebb17c3a0dec 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1664,22 +1664,8 @@ struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt)
 			   rt->dst.flags);
 
 	if (new_rt) {
+		*new_rt = *rt;
 		new_rt->rt_genid = rt_genid_ipv4(dev_net(dev));
-		new_rt->rt_flags = rt->rt_flags;
-		new_rt->rt_type = rt->rt_type;
-		new_rt->rt_is_input = rt->rt_is_input;
-		new_rt->rt_iif = rt->rt_iif;
-		new_rt->rt_pmtu = rt->rt_pmtu;
-		new_rt->rt_mtu_locked = rt->rt_mtu_locked;
-		new_rt->rt_gw_family = rt->rt_gw_family;
-		if (rt->rt_gw_family == AF_INET)
-			new_rt->rt_gw4 = rt->rt_gw4;
-		else if (rt->rt_gw_family == AF_INET6)
-			new_rt->rt_gw6 = rt->rt_gw6;
-
-		new_rt->dst.input = rt->dst.input;
-		new_rt->dst.output = rt->dst.output;
-		new_rt->dst.error = rt->dst.error;
 		new_rt->dst.lastuse = jiffies;
 		new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate);
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ