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] [thread-next>] [day] [month] [year] [list]
Message-ID: <82a26c8f-d2d0-4479-b3b0-ec853517e2f9@machnikowski.net>
Date: Thu, 29 Feb 2024 18:19:49 +0100
From: Maciek Machnikowski <maciek@...hnikowski.net>
To: David Wei <dw@...idwei.uk>, Jakub Kicinski <kuba@...nel.org>,
 Jiri Pirko <jiri@...nulli.us>, Sabrina Dubroca <sd@...asysnail.net>,
 horms@...nel.org, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v14 3/5] netdevsim: add ndo_get_iflink() implementation

On 29/02/2024 00:22, David Wei wrote:
> Add an implementation for ndo_get_iflink() in netdevsim that shows the
> ifindex of the linked peer, if any.
> 
> Signed-off-by: David Wei <dw@...idwei.uk>
> ---
>  drivers/net/netdevsim/netdev.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index c3f3fda5fdc0..8330bc0bcb7e 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -283,6 +283,21 @@ nsim_set_features(struct net_device *dev, netdev_features_t features)
>  	return 0;
>  }
>  
> +static int nsim_get_iflink(const struct net_device *dev)
> +{
> +	struct netdevsim *nsim, *peer;
> +	int iflink;
> +
> +	nsim = netdev_priv(dev);
> +
> +	rcu_read_lock();
> +	peer = rcu_dereference(nsim->peer);
> +	iflink = peer ? READ_ONCE(peer->netdev->ifindex) : 0;
> +	rcu_read_unlock();
> +
> +	return iflink;
> +}
> +
>  static const struct net_device_ops nsim_netdev_ops = {
>  	.ndo_start_xmit		= nsim_start_xmit,
>  	.ndo_set_rx_mode	= nsim_set_rx_mode,
> @@ -300,6 +315,7 @@ static const struct net_device_ops nsim_netdev_ops = {
>  	.ndo_set_vf_rss_query_en = nsim_set_vf_rss_query_en,
>  	.ndo_setup_tc		= nsim_setup_tc,
>  	.ndo_set_features	= nsim_set_features,
> +	.ndo_get_iflink		= nsim_get_iflink,
>  	.ndo_bpf		= nsim_bpf,
>  };
>  
Reviewed-by: Maciek Machnikowski <maciek@...hnikowski.net>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ