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: <20241014231917.7858-1-kuniyu@amazon.com>
Date: Mon, 14 Oct 2024 16:19:17 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <gnaaman@...venets.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <gilad@...man.io>,
	<kuba@...nel.org>, <netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH net-next v3 2/2] Create netdev->neighbour association

From: Gilad Naaman <gnaaman@...venets.com>
Date: Thu, 10 Oct 2024 12:01:25 +0000
> diff --git a/Documentation/networking/net_cachelines/net_device.rst b/Documentation/networking/net_cachelines/net_device.rst
> index 1b018ac35e9a..889501a16da2 100644
> --- a/Documentation/networking/net_cachelines/net_device.rst
> +++ b/Documentation/networking/net_cachelines/net_device.rst
> @@ -186,4 +186,5 @@ struct dpll_pin*                    dpll_pin
>  struct hlist_head                   page_pools
>  struct dim_irq_moder*               irq_moder
>  u64                                 max_pacing_offload_horizon
> +struct hlist_head                   neighbours[3]

I think 2 should be enough as DECnet was removed two years ago.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1202cdd66531

MPLS also does not support DECnet via RTA_VIA, see nla_get_via().


[...]
> +static int family_to_neightbl_index(int family)
> +{
> +	switch (family) {
> +	case AF_INET:
> +		return NEIGH_ARP_TABLE;
> +	case AF_INET6:
> +		return NEIGH_ND_TABLE;
> +	case AF_DECnet:
> +		return NEIGH_DN_TABLE;
> +	default:
> +		return -1;

AF_DECnet should be unnecessary here and let default warn about it.

	case default:
		DEBUG_NET_WARN_ON_ONCE(1);
		return 0; /* to avoid panic by null-ptr-deref */


[...]
> +static void neigh_flush_dev_fast(struct neigh_table *tbl,
> +				 struct hlist_head *head,
> +				 bool skip_perm)
> +{
> +	struct neighbour *n, *next;
> +
> +	neigh_dev_for_each_safe_rcu_protected(n, next, head,
> +					      lockdep_is_held(&tbl->lock)) {
> +		if (skip_perm && n->nud_state & NUD_PERMANENT)
> +			continue;
> +
> +		_neigh_flush_free_neigh(n);
> +	}
> +}
> +
>  static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
>  			    bool skip_perm)
>  {
>  	int i;
>  	struct neigh_hash_table *nht;
>  
> +	i = family_to_neightbl_index(tbl->family);
> +	if (i != -1) {

No need to handle error, and replace the following for-loop with
the dev-base iteration.


> +		neigh_flush_dev_fast(tbl, &dev->neighbours[i], skip_perm);
> +		return;
> +	}
> +
>  	nht = rcu_dereference_protected(tbl->nht,
>  					lockdep_is_held(&tbl->lock));
>  
[...]
> @@ -701,6 +756,11 @@ ___neigh_create(struct neigh_table *tbl, const void *pkey,
>  	if (want_ref)
>  		neigh_hold(n);
>  	hlist_add_head_rcu(&n->list, &nht->hash_buckets[hash_val]);
> +
> +	error = family_to_neightbl_index(tbl->family);
> +	if (error != -1)

Same here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ