Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next v3] net: Support filtering interfaces on no master
@ 2021-08-10  9:06 Lahav Schlesinger
  2021-08-10  9:37 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Lahav Schlesinger @ 2021-08-10  9:06 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, davem, kuba

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>
Cc: David Ahern <dsahern@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
---
v2 -> v3
 - Change the way 'master' is checked for being non NULL
v1 -> v2
 - Change from filtering just for non VRF slaves to non slaves at all

 net/core/neighbour.c | 7 +++++++
 net/core/rtnetlink.c | 7 +++++++
 2 files changed, 14 insertions(+)

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;
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7c9d32cfe607..2dcf1c084b20 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  9:06 [PATCH net-next v3] net: Support filtering interfaces on no master Lahav Schlesinger
@ 2021-08-10  9:37 ` Leon Romanovsky
  2021-08-10 13:19 ` David Ahern
  2021-08-10 23:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2021-08-10  9:37 UTC (permalink / raw)
  To: Lahav Schlesinger; +Cc: netdev, dsahern, davem, kuba

On Tue, Aug 10, 2021 at 09:06:58AM +0000, Lahav Schlesinger wrote:
> 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>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> ---
> v2 -> v3
>  - Change the way 'master' is checked for being non NULL
> v1 -> v2
>  - Change from filtering just for non VRF slaves to non slaves at all
> 
>  net/core/neighbour.c | 7 +++++++
>  net/core/rtnetlink.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 

Thanks, for resending.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  9:06 [PATCH net-next v3] net: Support filtering interfaces on no master Lahav Schlesinger
  2021-08-10  9:37 ` Leon Romanovsky
@ 2021-08-10 13:19 ` David Ahern
  2021-08-10 23:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: David Ahern @ 2021-08-10 13:19 UTC (permalink / raw)
  To: Lahav Schlesinger, netdev; +Cc: dsahern, davem, kuba

On 8/10/21 3:06 AM, Lahav Schlesinger wrote:
> 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>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> ---
> v2 -> v3
>  - Change the way 'master' is checked for being non NULL
> v1 -> v2
>  - Change from filtering just for non VRF slaves to non slaves at all
> 
>  net/core/neighbour.c | 7 +++++++
>  net/core/rtnetlink.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  9:06 [PATCH net-next v3] net: Support filtering interfaces on no master Lahav Schlesinger
  2021-08-10  9:37 ` Leon Romanovsky
  2021-08-10 13:19 ` David Ahern
@ 2021-08-10 23:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-10 23:10 UTC (permalink / raw)
  To: Lahav Schlesinger; +Cc: netdev, dsahern, davem, kuba

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 10 Aug 2021 09:06:58 +0000 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v3] net: Support filtering interfaces on no master
    https://git.kernel.org/netdev/net-next/c/d3432bf10f17

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  7:27 Lahav Schlesinger
@ 2021-08-10  8:39 ` Leon Romanovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2021-08-10  8:39 UTC (permalink / raw)
  To: Lahav Schlesinger; +Cc: netdev, dsahern, davem, kuba

On Tue, Aug 10, 2021 at 07:27:43AM +0000, Lahav Schlesinger wrote:
> 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.
> 
> I have a patch for iproute2 ready for adding this support in userspace.

This line should be removed too.

Thanks

> 
> Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> ---
> v2 -> v3
>  - Change the way 'master' is checked for being non NULL
> v1 -> v2
>  - Change from filtering just for non VRF slaves to non slaves at all
> 
>  net/core/neighbour.c | 7 +++++++
>  net/core/rtnetlink.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> 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;
>  
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 7c9d32cfe607..2dcf1c084b20 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -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;
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next v3] net: Support filtering interfaces on no master
@ 2021-08-10  7:27 Lahav Schlesinger
  2021-08-10  8:39 ` Leon Romanovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Lahav Schlesinger @ 2021-08-10  7:27 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, davem, kuba

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.

I have a patch for iproute2 ready for adding this support in userspace.

Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
Cc: David Ahern <dsahern@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
---
v2 -> v3
 - Change the way 'master' is checked for being non NULL
v1 -> v2
 - Change from filtering just for non VRF slaves to non slaves at all

 net/core/neighbour.c | 7 +++++++
 net/core/rtnetlink.c | 7 +++++++
 2 files changed, 14 insertions(+)

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;
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7c9d32cfe607..2dcf1c084b20 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  7:12 ` Leon Romanovsky
@ 2021-08-10  7:26   ` Lahav Schlesinger
  0 siblings, 0 replies; 9+ messages in thread
From: Lahav Schlesinger @ 2021-08-10  7:26 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev, dsahern, davem, kuba

On Tue, Aug 10, 2021 at 10:12:21AM +0300, Leon Romanovsky wrote:
> On Tue, Aug 10, 2021 at 06:49:43AM +0000, Lahav Schlesinger wrote:
> > 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.
> >
>
> .....
>
> > I have a patch for iproute2 ready for adding this support in userspace.
> >
> > v2 -> v3
> >  - Change the way 'master' is checked for being non NULL
> > v1 -> v2
> >  - Change from filtering just for non VRF slaves to non slaves at all
> >
>
> The above lines don't belong to commit message. Please put them under "---"
>
> Thanks
>

Oops, sorry about that!

> > Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
> > Cc: David Ahern <dsahern@kernel.org>
> > Cc: David S. Miller <davem@davemloft.net>
> > Cc: Jakub Kicinski <kuba@kernel.org>
> > ---
> >  net/core/neighbour.c | 7 +++++++
> >  net/core/rtnetlink.c | 7 +++++++
> >  2 files changed, 14 insertions(+)
> >
> > 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;
> >
> > diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> > index 7c9d32cfe607..2dcf1c084b20 100644
> > --- a/net/core/rtnetlink.c
> > +++ b/net/core/rtnetlink.c
> > @@ -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;
> >
> > --
> > 2.25.1
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next v3] net: Support filtering interfaces on no master
  2021-08-10  6:49 Lahav Schlesinger
@ 2021-08-10  7:12 ` Leon Romanovsky
  2021-08-10  7:26   ` Lahav Schlesinger
  0 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2021-08-10  7:12 UTC (permalink / raw)
  To: Lahav Schlesinger; +Cc: netdev, dsahern, davem, kuba

On Tue, Aug 10, 2021 at 06:49:43AM +0000, Lahav Schlesinger wrote:
> 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.
>

.....

> I have a patch for iproute2 ready for adding this support in userspace.
> 
> v2 -> v3
>  - Change the way 'master' is checked for being non NULL
> v1 -> v2
>  - Change from filtering just for non VRF slaves to non slaves at all
> 

The above lines don't belong to commit message. Please put them under "---"

Thanks

> Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> ---
>  net/core/neighbour.c | 7 +++++++
>  net/core/rtnetlink.c | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> 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;
>  
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 7c9d32cfe607..2dcf1c084b20 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -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;
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next v3] net: Support filtering interfaces on no master
@ 2021-08-10  6:49 Lahav Schlesinger
  2021-08-10  7:12 ` Leon Romanovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Lahav Schlesinger @ 2021-08-10  6:49 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, davem, kuba

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.

I have a patch for iproute2 ready for adding this support in userspace.

v2 -> v3
 - Change the way 'master' is checked for being non NULL
v1 -> v2
 - Change from filtering just for non VRF slaves to non slaves at all

Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
Cc: David Ahern <dsahern@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
---
 net/core/neighbour.c | 7 +++++++
 net/core/rtnetlink.c | 7 +++++++
 2 files changed, 14 insertions(+)

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;
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7c9d32cfe607..2dcf1c084b20 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-10 23:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  9:06 [PATCH net-next v3] net: Support filtering interfaces on no master Lahav Schlesinger
2021-08-10  9:37 ` Leon Romanovsky
2021-08-10 13:19 ` David Ahern
2021-08-10 23:10 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2021-08-10  7:27 Lahav Schlesinger
2021-08-10  8:39 ` Leon Romanovsky
2021-08-10  6:49 Lahav Schlesinger
2021-08-10  7:12 ` Leon Romanovsky
2021-08-10  7:26   ` Lahav Schlesinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).