mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 13:37:56 +00:00
net: Support filtering interfaces on no master
Currently there's support for filtering neighbours/links for interfaces which have a specific master device (using the IFLA_MASTER/NDA_MASTER attributes). This patch adds support for filtering interfaces/neighbours dump for interfaces that *don't* have a master. Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20210810090658.2778960-1-lschlesinger@drivenets.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a5397d68b2
commit
d3432bf10f
@ -2528,6 +2528,13 @@ static bool neigh_master_filtered(struct net_device *dev, int master_idx)
|
||||
return false;
|
||||
|
||||
master = dev ? netdev_master_upper_dev_get(dev) : NULL;
|
||||
|
||||
/* 0 is already used to denote NDA_MASTER wasn't passed, therefore need another
|
||||
* invalid value for ifindex to denote "no master".
|
||||
*/
|
||||
if (master_idx == -1)
|
||||
return !!master;
|
||||
|
||||
if (!master || master->ifindex != master_idx)
|
||||
return true;
|
||||
|
||||
|
@ -1959,6 +1959,13 @@ static bool link_master_filtered(struct net_device *dev, int master_idx)
|
||||
return false;
|
||||
|
||||
master = netdev_master_upper_dev_get(dev);
|
||||
|
||||
/* 0 is already used to denote IFLA_MASTER wasn't passed, therefore need
|
||||
* another invalid value for ifindex to denote "no master".
|
||||
*/
|
||||
if (master_idx == -1)
|
||||
return !!master;
|
||||
|
||||
if (!master || master->ifindex != master_idx)
|
||||
return true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user