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-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D5F4E0170@AcuExch.aculab.com>
Date:	Mon, 20 Jun 2016 15:29:54 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'David Ahern' <dsa@...ulusnetworks.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 1/3] net: ipv6: Move ip6_route_get_saddr to
 inline

From: Behalf Of David Ahern
> Sent: 17 June 2016 00:24
> VRF driver needs access to ip6_route_get_saddr code. Since it does
> little beyond ipv6_dev_get_saddr and ipv6_dev_get_saddr is already
> exported for modules move ip6_route_get_saddr to the header as an
> inline.
> 
> Code move only; no functional change.

Look a bit large for an inline.

> Signed-off-by: David Ahern <dsa@...ulusnetworks.com>
> ---
>  include/net/ip6_route.h | 21 ++++++++++++++++++---
>  net/ipv6/route.c        | 17 -----------------
>  2 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index f55bf3d294aa..d97305d0e71f 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -18,6 +18,7 @@ struct route_info {
>  	__u8			prefix[0];	/* 0,8 or 16 */
>  };
> 
> +#include <net/addrconf.h>
>  #include <net/flow.h>
>  #include <net/ip6_fib.h>
>  #include <net/sock.h>
> @@ -88,9 +89,23 @@ int ip6_route_add(struct fib6_config *cfg);
>  int ip6_ins_rt(struct rt6_info *);
>  int ip6_del_rt(struct rt6_info *);
> 
> -int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
> -			const struct in6_addr *daddr, unsigned int prefs,
> -			struct in6_addr *saddr);
> +static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
> +				      const struct in6_addr *daddr,
> +				      unsigned int prefs,
> +				      struct in6_addr *saddr)
> +{
> +	struct inet6_dev *idev =
> +			rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL;
> +	int err = 0;
> +
> +	if (rt && rt->rt6i_prefsrc.plen)
> +		*saddr = rt->rt6i_prefsrc.addr;
> +	else
> +		err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
> +					 daddr, prefs, saddr);
> +
> +	return err;
> +}
...

The above looks as though it might be:
	if (!rt)
		return ipv6_dev_get_saddr(net, NULL, dattr, prefs, saddr);
	if (!rt->rt6i_prefsrc.plen)
		return ipv6_dev_get_saddr(net, ip6_dst_idev((struct dst_entry *)rt)->dev, dattr, prefs, saddr);
	*saddr = rt->rt6i_prefsrc.addr;
	return 0;

which could inline to better code.
Alternatively just inline the fast path.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ