diff options
author | Lahav Schlesinger <lschlesinger@drivenets.com> | 2021-08-10 09:06:58 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-08-10 16:03:34 -0700 |
commit | d3432bf10f17bd8ef7d6ca0a268f63bfb0c3d372 (patch) | |
tree | aa070171743df8266ee530f70e8f448ee6267e89 /net/core/neighbour.c | |
parent | a5397d68b2dbdb8f725ab2ff420171fbde39dbe5 (diff) |
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>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r-- | net/core/neighbour.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b963d6b02c4f..2d5bc3a75fae 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -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; |