All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
@ 2015-11-18 12:16 Danny Schweizer
  2015-11-18 12:45 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Schweizer @ 2015-11-18 12:16 UTC (permalink / raw)
  To: linux-bluetooth

This patch fixes the Bug 106691 by changing the default multicast filter
to not filter out any multicast addresses.

---
 net/bluetooth/bnep/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 1641367..ba2467a 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -609,7 +609,7 @@ int bnep_add_connection(struct bnep_connadd_req
*req, struct socket *sock)

 #ifdef CONFIG_BT_BNEP_MC_FILTER
 	/* Set default mc filter */
-	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
+	s->mc_filter = ~0LL;
 #endif

 #ifdef CONFIG_BT_BNEP_PROTO_FILTER
-- 
2.1.4

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

* Re: [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
  2015-11-18 12:16 [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified Danny Schweizer
@ 2015-11-18 12:45 ` Marcel Holtmann
  2015-11-18 13:12   ` Danny Schweizer
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2015-11-18 12:45 UTC (permalink / raw)
  To: Danny Schweizer; +Cc: linux-bluetooth

Hi Danny,

> This patch fixes the Bug 106691 by changing the default multicast filter
> to not filter out any multicast addresses.
> 
> ---
> net/bluetooth/bnep/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
> index 1641367..ba2467a 100644
> --- a/net/bluetooth/bnep/core.c
> +++ b/net/bluetooth/bnep/core.c
> @@ -609,7 +609,7 @@ int bnep_add_connection(struct bnep_connadd_req
> *req, struct socket *sock)
> 
> #ifdef CONFIG_BT_BNEP_MC_FILTER
> 	/* Set default mc filter */
> -	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
> +	s->mc_filter = ~0LL;
> #endif

I am not convinced that these two are actually the same expressions. You need to explain this a lot more in detail on why this change is correct.

Regards

Marcel


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

* Re: [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
  2015-11-18 12:45 ` Marcel Holtmann
@ 2015-11-18 13:12   ` Danny Schweizer
  2015-11-19 13:28     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Schweizer @ 2015-11-18 13:12 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,


> Hi Danny,
> 
>> This patch fixes the Bug 106691 by changing the default multicast filter
>> to not filter out any multicast addresses.
>>
>> ---
>> net/bluetooth/bnep/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
>> index 1641367..ba2467a 100644
>> --- a/net/bluetooth/bnep/core.c
>> +++ b/net/bluetooth/bnep/core.c
>> @@ -609,7 +609,7 @@ int bnep_add_connection(struct bnep_connadd_req
>> *req, struct socket *sock)
>>
>> #ifdef CONFIG_BT_BNEP_MC_FILTER
>> 	/* Set default mc filter */
>> -	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
>> +	s->mc_filter = ~0LL;
>> #endif
> 
> I am not convinced that these two are actually the same expressions. You need to explain this a lot more in detail on why this change is correct.
> 
> Regards
> 
> Marcel

The new expression should set the default mc_filter such that it does
not filter out any multicast addresses (it sets the mc_filter to all
ones). Up to now, the default mc_filter filters out all multicast
addresses except for the broadcast address. The reason why this is
needed is explained in the description of bug 106691. I will copy it here:

A Linux PC is connected with another device over Bluetooth PAN using a
BNEP interface.

Whenever a packet is tried to be sent over the BNEP interface, the
function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
This function calls "bnep_net_mc_filter()", which checks (if the
destination address is multicast) if the address is set in a certain
multicast filter (&s->mc_filter). If it is not, then it is not sent out.

This filter is only changed in two other functions, found in
net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
received. Otherwise, it is set in "bnep_add_connection()", where it is
set to a default value which only adds the broadcast address to the filter:

set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);


To sum up, if the BNEP interface does not receive any message of type
"BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
multicast destination addresses except for broadcast.


However, in the BNEP specification (page 27 in
http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
that per default, all multicast addresses should not be filtered, i.e.
the BNEP interface should be able to send packets with any multicast
destination address.

It seems that the default case is wrong: the multicast filter should not
block almost all multicast addresses, but should not filter out any.

This leads to the problem that e.g. Neighbor Solicitation messages sent
with Bluetooth PAN over the BNEP interface to a multicast destination
address other than broadcast are blocked and not sent out.


Regards,
Danny

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

* Re: [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
  2015-11-18 13:12   ` Danny Schweizer
@ 2015-11-19 13:28     ` Marcel Holtmann
  2015-12-02  8:07       ` Danny Schweizer
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2015-11-19 13:28 UTC (permalink / raw)
  To: Danny Schweizer; +Cc: linux-bluetooth

Hi Danny,

>>> This patch fixes the Bug 106691 by changing the default multicast filter
>>> to not filter out any multicast addresses.
>>> 
>>> ---
>>> net/bluetooth/bnep/core.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
>>> index 1641367..ba2467a 100644
>>> --- a/net/bluetooth/bnep/core.c
>>> +++ b/net/bluetooth/bnep/core.c
>>> @@ -609,7 +609,7 @@ int bnep_add_connection(struct bnep_connadd_req
>>> *req, struct socket *sock)
>>> 
>>> #ifdef CONFIG_BT_BNEP_MC_FILTER
>>> 	/* Set default mc filter */
>>> -	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
>>> +	s->mc_filter = ~0LL;
>>> #endif
>> 
>> I am not convinced that these two are actually the same expressions. You need to explain this a lot more in detail on why this change is correct.
>> 
> 
> The new expression should set the default mc_filter such that it does
> not filter out any multicast addresses (it sets the mc_filter to all
> ones). Up to now, the default mc_filter filters out all multicast
> addresses except for the broadcast address. The reason why this is
> needed is explained in the description of bug 106691. I will copy it here:
> 
> A Linux PC is connected with another device over Bluetooth PAN using a
> BNEP interface.
> 
> Whenever a packet is tried to be sent over the BNEP interface, the
> function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
> This function calls "bnep_net_mc_filter()", which checks (if the
> destination address is multicast) if the address is set in a certain
> multicast filter (&s->mc_filter). If it is not, then it is not sent out.
> 
> This filter is only changed in two other functions, found in
> net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
> only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
> received. Otherwise, it is set in "bnep_add_connection()", where it is
> set to a default value which only adds the broadcast address to the filter:
> 
> set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
> 
> 
> To sum up, if the BNEP interface does not receive any message of type
> "BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
> multicast destination addresses except for broadcast.
> 
> 
> However, in the BNEP specification (page 27 in
> http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
> that per default, all multicast addresses should not be filtered, i.e.
> the BNEP interface should be able to send packets with any multicast
> destination address.
> 
> It seems that the default case is wrong: the multicast filter should not
> block almost all multicast addresses, but should not filter out any.
> 
> This leads to the problem that e.g. Neighbor Solicitation messages sent
> with Bluetooth PAN over the BNEP interface to a multicast destination
> address other than broadcast are blocked and not sent out.

and something along these lines should be in the commit message as explanation for your change. And the reference to the specification should be added as an extra comment in the code.

Regards

Marcel


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

* Re: [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
  2015-11-19 13:28     ` Marcel Holtmann
@ 2015-12-02  8:07       ` Danny Schweizer
  2015-12-05 18:20         ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Schweizer @ 2015-12-02  8:07 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

A Linux PC is connected with another device over Bluetooth
 PAN using a BNEP interface.

Whenever a packet is tried to be sent over the BNEP interface, the
function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
This function calls "bnep_net_mc_filter()", which checks (if the
destination address is multicast) if the address is set in a certain
multicast filter (&s->mc_filter). If it is not, then it is not sent out.

This filter is only changed in two other functions, found in
net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
received. Otherwise, it is set in "bnep_add_connection()", where it is
set to a default value which only adds the broadcast address to the filter:

set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);

To sum up, if the BNEP interface does not receive any message of type
"BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
multicast destination addresses except for broadcast.

However, in the BNEP specification (page 27 in
http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
that per default, all multicast addresses should not be filtered, i.e.
the BNEP interface should be able to send packets with any multicast
destination address.

It seems that the default case is wrong: the multicast filter should not
block almost all multicast addresses, but should not filter out any.

This leads to the problem that e.g. Neighbor Solicitation messages sent
with Bluetooth PAN over the BNEP interface to a multicast destination
address other than broadcast are blocked and not sent out.

Therefore, in the default case, we set the mc_filter to ~0LL to not
filter out any multicast addresses.
---
 net/bluetooth/bnep/core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 1641367..8e02289 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -608,8 +608,12 @@ int bnep_add_connection(struct bnep_connadd_req
*req, struct socket *sock)
 	s->msg.msg_flags = MSG_NOSIGNAL;

 #ifdef CONFIG_BT_BNEP_MC_FILTER
-	/* Set default mc filter */
-	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
+	/*
+	 * Set default mc filter to not filter out any mc addresses
+	 * as defined in the BNEP specification (revision 0.95a)
+	 * http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf
+	 */
+	s->mc_filter = ~0LL;
 #endif

 #ifdef CONFIG_BT_BNEP_PROTO_FILTER
-- 
2.1.4

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

* Re: [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
  2015-12-02  8:07       ` Danny Schweizer
@ 2015-12-05 18:20         ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2015-12-05 18:20 UTC (permalink / raw)
  To: Danny Schweizer; +Cc: linux-bluetooth

Hi Danny,

> A Linux PC is connected with another device over Bluetooth
> PAN using a BNEP interface.
> 
> Whenever a packet is tried to be sent over the BNEP interface, the
> function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
> This function calls "bnep_net_mc_filter()", which checks (if the
> destination address is multicast) if the address is set in a certain
> multicast filter (&s->mc_filter). If it is not, then it is not sent out.
> 
> This filter is only changed in two other functions, found in
> net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
> only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
> received. Otherwise, it is set in "bnep_add_connection()", where it is
> set to a default value which only adds the broadcast address to the filter:
> 
> set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
> 
> To sum up, if the BNEP interface does not receive any message of type
> "BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
> multicast destination addresses except for broadcast.
> 
> However, in the BNEP specification (page 27 in
> http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
> that per default, all multicast addresses should not be filtered, i.e.
> the BNEP interface should be able to send packets with any multicast
> destination address.
> 
> It seems that the default case is wrong: the multicast filter should not
> block almost all multicast addresses, but should not filter out any.
> 
> This leads to the problem that e.g. Neighbor Solicitation messages sent
> with Bluetooth PAN over the BNEP interface to a multicast destination
> address other than broadcast are blocked and not sent out.
> 
> Therefore, in the default case, we set the mc_filter to ~0LL to not
> filter out any multicast addresses.
> ---
> net/bluetooth/bnep/core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)

I can not apply this patch since it comes in weirdly. Please send a clean copy and shorten the subject line so it fits appropriately. And maybe use git send-email.

Regards

Marcel


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

* [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified
@ 2015-11-19 14:29 Danny Schweizer
  0 siblings, 0 replies; 7+ messages in thread
From: Danny Schweizer @ 2015-11-19 14:29 UTC (permalink / raw)
  To: linux-bluetooth

A Linux PC is connected with another device over Bluetooth
 PAN using a BNEP interface.

Whenever a packet is tried to be sent over the BNEP interface, the
function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
This function calls "bnep_net_mc_filter()", which checks (if the
destination address is multicast) if the address is set in a certain
multicast filter (&s->mc_filter). If it is not, then it is not sent out.

This filter is only changed in two other functions, found in
net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
received. Otherwise, it is set in "bnep_add_connection()", where it is
set to a default value which only adds the broadcast address to the filter:

set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);

To sum up, if the BNEP interface does not receive any message of type
"BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
multicast destination addresses except for broadcast.

However, in the BNEP specification (page 27 in
http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
that per default, all multicast addresses should not be filtered, i.e.
the BNEP interface should be able to send packets with any multicast
destination address.

It seems that the default case is wrong: the multicast filter should not
block almost all multicast addresses, but should not filter out any.

This leads to the problem that e.g. Neighbor Solicitation messages sent
with Bluetooth PAN over the BNEP interface to a multicast destination
address other than broadcast are blocked and not sent out.

Therefore, in the default case, we set the mc_filter to ~0LL to not
filter out any multicast addresses.
---
 net/bluetooth/bnep/core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 1641367..8e02289 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -608,8 +608,12 @@ int bnep_add_connection(struct bnep_connadd_req
*req, struct socket *sock)
 	s->msg.msg_flags = MSG_NOSIGNAL;

 #ifdef CONFIG_BT_BNEP_MC_FILTER
-	/* Set default mc filter */
-	set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);
+	/*
+	 * Set default mc filter to not filter out any mc addresses
+	 * as defined in the BNEP specification (revision 0.95a)
+	 * http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf
+	 */
+	s->mc_filter = ~0LL;
 #endif

 #ifdef CONFIG_BT_BNEP_PROTO_FILTER
-- 
2.1.4

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

end of thread, other threads:[~2015-12-05 18:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 12:16 [PATCH] BNEP multicast filter is filtering multicast addresses in default case although differently specified Danny Schweizer
2015-11-18 12:45 ` Marcel Holtmann
2015-11-18 13:12   ` Danny Schweizer
2015-11-19 13:28     ` Marcel Holtmann
2015-12-02  8:07       ` Danny Schweizer
2015-12-05 18:20         ` Marcel Holtmann
2015-11-19 14:29 Danny Schweizer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.