Skip to contentSkip to conversation

Fix handling of skbs of type PACKET_OTHERHOST

PATCH In review Simon Vincent 3 participants 20 messages Oct 2, 2014 – Oct 5, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix handling of skbs of type PACKET_OTHERHOST

This series of patches fix the cases where the pkt_type is overriden resulting in skbs of type PACKET_OTHERHOST getting set to PACKET_HOST. Also it drops packets of PACKET_OTHERHOST type in the 6lowpan layer as there is not point processing them as they are dropped at the next layer.

Simon Vincent (3):
6lowpan: Ensure pkt_type is not lost
ieee802154: 6lowpan: Ensure pkt_type is not lost
ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

 net/6lowpan/iphc.c            | 1 -
 net/ieee802154/6lowpan_rtnl.c | 4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 6lowpan: Ensure pkt_type is not lost

Remove line which overrrides pkt_type to PACKET_HOST

---
 net/6lowpan/iphc.c | 1 -
 1 file changed, 1 deletion(-)
net/6lowpan/iphc.c +0 -1
index 142eef5..002cd7c 100644
@@ -189,7 +189,6 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
 	skb_copy_to_linear_data(new, hdr, sizeof(struct ipv6hdr));
 
 	new->protocol = htons(ETH_P_IPV6);
-	new->pkt_type = PACKET_HOST;
 	new->dev = dev;
 
 	raw_dump_table(__func__, "raw skb data dump before receiving",
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH linux-wpan 1/3] 6lowpan: Ensure pkt_type is not lost

Quoted 2 lines · Simon Vincent

Remove line which overrrides pkt_type to PACKET_HOST

s/overrrides/overrides

Quoted 20 lines
---
 net/6lowpan/iphc.c | 1 -
 1 file changed, 1 deletion(-)
net/6lowpan/iphc.c +0 -1
index 142eef5..002cd7c 100644
@@ -189,7 +189,6 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
 	skb_copy_to_linear_data(new, hdr, sizeof(struct ipv6hdr));
 
 	new->protocol = htons(ETH_P_IPV6);
-	new->pkt_type = PACKET_HOST;
 	new->dev = dev;
 
 	raw_dump_table(__func__, "raw skb data dump before receiving",
Signature · 1 line
1.9.1
#3 lore raw

PATCH 2/3 ieee802154: 6lowpan: Ensure pkt_type is not lost

In reply to Simon Vincent

Remove line which overrides pkt_type to PACKET_HOST

---
 net/ieee802154/6lowpan_rtnl.c | 1 -
 1 file changed, 1 deletion(-)
net/ieee802154/6lowpan_rtnl.c +0 -1
index 4413629..e246edc 100644
@@ -524,7 +524,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 	/* check that it's our buffer */
 	if (skb->data[0] == LOWPAN_DISPATCH_IPV6) {
 		skb->protocol = htons(ETH_P_IPV6);
-		skb->pkt_type = PACKET_HOST;
 
 		/* Pull off the 1-byte of 6lowpan header. */
 		skb_pull(skb, 1);
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/3 ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

In reply to Simon Vincent

There is no point processing pkts which are PACKET_OTHERHOST in 6lowpan as they are discarded as soon as they reach the ipv6 layer. Therefore we should drop them in the 6lowpan layer.

---
 net/ieee802154/6lowpan_rtnl.c | 3 +++
 1 file changed, 3 insertions(+)
net/ieee802154/6lowpan_rtnl.c +3 -0
index e246edc..820922a 100644
@@ -515,6 +515,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 	if (!netif_running(dev))
 		goto drop_skb;
 
+	if (skb->pkt_type == PACKET_OTHERHOST)
+		goto drop_skb;
+
 	if (dev->type != ARPHRD_IEEE802154)
 		goto drop_skb;
 
Signature · 1 line
1.9.1
maintainer
#5 lore raw

Re: [PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

Quoted 14 lines · Simon Vincent

There is no point processing pkts which are PACKET_OTHERHOST in 6lowpan as they are discarded as soon as they reach the ipv6 layer. Therefore we should drop them in the 6lowpan layer.

---
 net/ieee802154/6lowpan_rtnl.c | 3 +++
 1 file changed, 3 insertions(+)
net/ieee802154/6lowpan_rtnl.c +0 -0
index e246edc..820922a 100644

net/ieee802154/6lowpan_rtnl.c static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, · line 523

Quoted 9 lines
net/ieee802154/6lowpan_rtnl.c +3 -0
@@ -515,6 +515,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 	if (!netif_running(dev))
 		goto drop_skb;
 
+	if (skb->pkt_type == PACKET_OTHERHOST)
+		goto drop_skb;
+
 	if (dev->type != ARPHRD_IEEE802154)
 		goto drop_skb;
 

This one should also added in bluetooth, but I don't know where. Maybe Jukka will take care of this.

- Alex

maintainer
#6 lore raw

Re: [PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

In reply to Simon Vincent

Simon,

I applied now this patch to linux-wpan-next/testing, this should fix routing problems. For the upcomming issue "always set PACKET_HOST"... I put it on the TODO list. ;-)

Thanks.

I will send it to bluetooth-next now, then Martin can base his patches on it.

Quoted 26 lines · Simon Vincent

There is no point processing pkts which are PACKET_OTHERHOST in 6lowpan as they are discarded as soon as they reach the ipv6 layer. Therefore we should drop them in the 6lowpan layer.

---
 net/ieee802154/6lowpan_rtnl.c | 3 +++
 1 file changed, 3 insertions(+)
net/ieee802154/6lowpan_rtnl.c +3 -0
index e246edc..820922a 100644
@@ -515,6 +515,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
 	if (!netif_running(dev))
 		goto drop_skb;
 
+	if (skb->pkt_type == PACKET_OTHERHOST)
+		goto drop_skb;
+
 	if (dev->type != ARPHRD_IEEE802154)
 		goto drop_skb;
 
Signature · 1 line
1.9.1
maintainer
#7 lore raw
In reply to Simon Vincent

Hi Simon,

Quoted 6 lines · Simon Vincent

This series of patches fix the cases where the pkt_type is overriden resulting in skbs of type PACKET_OTHERHOST getting set to PACKET_HOST. Also it drops packets of PACKET_OTHERHOST type in the 6lowpan layer as there is not point processing them as they are dropped at the next layer.

serie looks good, I took a fast look into this.

You hit the GENERIC 6LOWPAN branch and all patches have a dependency to each other. Means all patches should go into bluetooth repo.

Marcel's bluetooth repository isn't based on current net, this is done after the merge window. I think we should base it on bluetooth-next, but it's a big issue... forget users for the current kernel, will be fixed in the next version. I discuss this with Marcel at [0]. So we doesn't matter to fix it in current/-stable versions. If somebody like to fix it, he can do the effort and send it to -stable mailinglist.

Please rebase it on bluetooth-next and send it again to the bluetooth mailinglist in cc (also linux-wpan and Jukka, me, etc..).

- Alex

[0] (was somewhere on linux-wpan with Marcel, we don't have a mail archive for this)

maintainer
#8 lore raw
In reply to Simon Vincent
Quoted 5 lines · Simon Vincent

This series of patches fix the cases where the pkt_type is overriden resulting in skbs of type PACKET_OTHERHOST getting set to PACKET_HOST. Also it drops packets of PACKET_OTHERHOST type in the 6lowpan layer as there is not point processing them as they are dropped at the next layer.

Please don't forget:

$ grep -r -n "PACKET_HOST" net/bluetooth/6lowpan.c

276: local_skb->pkt_type = PACKET_HOST;

- Alex

#9 lore raw

I will add this patch when I rebase on bluetooth-next.

Quoted 13 lines · Alexander Aring
Quoted 5 lines · Simon Vincent

This series of patches fix the cases where the pkt_type is overriden resulting in skbs of type PACKET_OTHERHOST getting set to PACKET_HOST. Also it drops packets of PACKET_OTHERHOST type in the 6lowpan layer as there is not point processing them as they are dropped at the next layer.

Please don't forget:

$ grep -r -n "PACKET_HOST" net/bluetooth/6lowpan.c

276: local_skb->pkt_type = PACKET_HOST;

- Alex

#10 lore raw

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

Quoted 8 lines · Alexander Aring
Quoted 6 lines · Simon Vincent
Quoted 5 lines

This series of patches fix the cases where the pkt_type is overriden resulting in skbs of type PACKET_OTHERHOST getting set to PACKET_HOST. Also it drops packets of PACKET_OTHERHOST type in the 6lowpan layer as there is not point processing them as they are dropped at the next layer.

Quoted 8 lines
Quoted 7 lines

Please don't forget:

$ grep -r -n "PACKET_HOST" net/bluetooth/6lowpan.c

276: local_skb->pkt_type = PACKET_HOST;

- Alex

Cheers,
Jukka

maintainer
#11 lore raw

Jukka,

Quoted 7 lines · Jukka Rissanen

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

I see now, that the bluetooth layer never sets this value. I don't know how bluetooth deal with that. But you need to set PACKET_HOST if packet belongs to you, OTHERHOST if packets belongs not to you, or PACKET_BROADCAST if packet belongs to you, but is a broadcast.

Also for PACKET_MULTICAST, if bluetooth support MULTICAST frames.

I think you need handling for this in bluetooth 6lowpan layer.

- Alex

maintainer
#12 lore raw
Quoted 16 lines · Alexander Aring

Jukka,

Quoted 7 lines · Jukka Rissanen

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

I see now, that the bluetooth layer never sets this value. I don't know how bluetooth deal with that. But you need to set PACKET_HOST if packet belongs to you, OTHERHOST if packets belongs not to you, or PACKET_BROADCAST if packet belongs to you, but is a broadcast.

Quoted 5 lines

Also for PACKET_MULTICAST, if bluetooth support MULTICAST frames.

I think you need handling for this in bluetooth 6lowpan layer.

and this should be fixed before Simon's patches. I add Marcel here in cc, maybe he can bring some new information if bluetooth ever set's the pkt_type in sk_buff.

Point is IPv6 needs this information and we should set it to a valid value. ... and this is not always set PACKET_HOST, IPv6 also check on PACKET_BROADCAST.

- Alex

#13 lore raw

Hi Alex,

Quoted 23 lines · Alexander Aring
Quoted 16 lines · Alexander Aring

Jukka,

Quoted 7 lines · Jukka Rissanen

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

I see now, that the bluetooth layer never sets this value. I don't know how bluetooth deal with that. But you need to set PACKET_HOST if packet belongs to you, OTHERHOST if packets belongs not to you, or PACKET_BROADCAST if packet belongs to you, but is a broadcast.

Quoted 5 lines

Also for PACKET_MULTICAST, if bluetooth support MULTICAST frames.

I think you need handling for this in bluetooth 6lowpan layer.

Quoted 6 lines

and this should be fixed before Simon's patches. I add Marcel here in cc, maybe he can bring some new information if bluetooth ever set's the pkt_type in sk_buff.

Point is IPv6 needs this information and we should set it to a valid value. ... and this is not always set PACKET_HOST, IPv6 also check on PACKET_BROADCAST.

Hmm, bluetooth 6lowpan is a bit different from ieee802154 as the bluetooth link is a point-to-point one and typically only uses link local addresses so normally every packet is really meant for that host.

I will investigate this a bit more, so perhaps it is best if Simon does not change the pkt_type field after all. Everything seems to work just fine with unicast and multicast packets at the moment (when pkt_type == PACKET_HOST).

Cheers,
Jukka

maintainer
#14 lore raw

Hi Jukka,

Quoted 33 lines · Jukka Rissanen

Hi Alex,

Quoted 23 lines · Alexander Aring
Quoted 16 lines · Alexander Aring

Jukka,

Quoted 7 lines · Jukka Rissanen

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

I see now, that the bluetooth layer never sets this value. I don't know how bluetooth deal with that. But you need to set PACKET_HOST if packet belongs to you, OTHERHOST if packets belongs not to you, or PACKET_BROADCAST if packet belongs to you, but is a broadcast.

Quoted 5 lines

Also for PACKET_MULTICAST, if bluetooth support MULTICAST frames.

I think you need handling for this in bluetooth 6lowpan layer.

Quoted 6 lines

and this should be fixed before Simon's patches. I add Marcel here in cc, maybe he can bring some new information if bluetooth ever set's the pkt_type in sk_buff.

Point is IPv6 needs this information and we should set it to a valid value. ... and this is not always set PACKET_HOST, IPv6 also check on PACKET_BROADCAST.

Quoted 9 lines

Hmm, bluetooth 6lowpan is a bit different from ieee802154 as the bluetooth link is a point-to-point one and typically only uses link local addresses so normally every packet is really meant for that host.

I will investigate this a bit more, so perhaps it is best if Simon does not change the pkt_type field after all. Everything seems to work just fine with unicast and multicast packets at the moment (when pkt_type == PACKET_HOST).

Okay, then maybe bluetooth 6lowpan need to set it to PACKET_HOST always.

Another idea would be:
We could also set PACKET_BROADCAST if the IPv6 address is a multicast/broadcast addresss.

But it looks wrong, the PACKET_FOO values should be set by mac layer only.

What I deteced is at [0]. There it checks if the "mac frame" was broadcast or multicast. I don't know when this occurs, I need to check this but it seems to be broken, when we always set the PACKET_HOST.

Simon had issues with routing when IPv6 Layer gets a skb with PACKET_HOST and it was PACKET_OTHERHOSTS before.

Simon:

Maybe only send patch:

[PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

this should fix your routing problems, but issue with [0] still exists.

- Alex

[0] http://lxr.free-electrons.com/source/net/ipv6/mcast.c#L1413

maintainer
#15 lore raw

On Thu, Oct 02, 2014 at 12:22:01PM +0200, Alexander Aring wrote:
...

Quoted 20 lines

Okay, then maybe bluetooth 6lowpan need to set it to PACKET_HOST always.

Another idea would be:
We could also set PACKET_BROADCAST if the IPv6 address is a multicast/broadcast addresss.

But it looks wrong, the PACKET_FOO values should be set by mac layer only.

What I deteced is at [0]. There it checks if the "mac frame" was broadcast or multicast. I don't know when this occurs, I need to check this but it seems to be broken, when we always set the PACKET_HOST.

Simon had issues with routing when IPv6 Layer gets a skb with PACKET_HOST and it was PACKET_OTHERHOSTS before.

Quoted 8 lines

Simon:

Maybe only send patch:

[PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

this should fix your routing problems, but issue with [0] still exists.

Another idea would be to put out the handling of setting pkt_type inside the 6LOWPAN GENERIC branch. This is what Martin does in the lowpan_rcv fixes... I still need some time to review his patch.

Maybe Simon add patch "[PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan" this only affects the 802.15.4 branch.

Then Martin solve the lowpan_rcv issue which put out the handling of pkt_type in lowpan_header_create function. Then you can do whatever bluetooth need to do there and we can drop the override of set this value to PACKET_HOST.

- Alex

#16 lore raw
In reply to Alexander Aring
Quoted 60 lines · Alexander Aring

Hi Jukka,

Quoted 29 lines · Jukka Rissanen

Hi Alex,

Quoted 18 lines · Alexander Aring
Quoted 17 lines · Alexander Aring

Jukka,

Quoted 6 lines · Jukka Rissanen

Hi Simon,

Quoted 1 line · Simon Vincent

I will add this patch when I rebase on bluetooth-next.

and thanks for doing that.

I see now, that the bluetooth layer never sets this value. I don't know how bluetooth deal with that. But you need to set PACKET_HOST if packet belongs to you, OTHERHOST if packets belongs not to you, or PACKET_BROADCAST if packet belongs to you, but is a broadcast.

Also for PACKET_MULTICAST, if bluetooth support MULTICAST frames.

Quoted 8 lines
Quoted 2 lines

I think you need handling for this in bluetooth 6lowpan layer.

and this should be fixed before Simon's patches. I add Marcel here in cc, maybe he can bring some new information if bluetooth ever set's the pkt_type in sk_buff.

Point is IPv6 needs this information and we should set it to a valid value. ... and this is not always set PACKET_HOST, IPv6 also check on PACKET_BROADCAST.

Quoted 9 lines

Hmm, bluetooth 6lowpan is a bit different from ieee802154 as the bluetooth link is a point-to-point one and typically only uses link local addresses so normally every packet is really meant for that host.

I will investigate this a bit more, so perhaps it is best if Simon does not change the pkt_type field after all. Everything seems to work just fine with unicast and multicast packets at the moment (when pkt_type == PACKET_HOST).

Okay, then maybe bluetooth 6lowpan need to set it to PACKET_HOST always.

Another idea would be:
We could also set PACKET_BROADCAST if the IPv6 address is a multicast/broadcast addresss.

But it looks wrong, the PACKET_FOO values should be set by mac layer only.

What I deteced is at [0]. There it checks if the "mac frame" was broadcast or multicast. I don't know when this occurs, I need to check this but it seems to be broken, when we always set the PACKET_HOST.

Simon had issues with routing when IPv6 Layer gets a skb with PACKET_HOST and it was PACKET_OTHERHOSTS before.

Quoted 7 lines

Simon:

Maybe only send patch:

[PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

this should fix your routing problems, but issue with [0] still exists.

So I should rebase and submit the whole patch series on bluetooth-next but not add a new patch to change net/bluetooth/6lowpan.c ?

Simon

maintainer
#17 lore raw

Hi Simon,

....

Quoted 7 lines
Quoted 4 lines

[PATCH linux-wpan 3/3] ieee802154: 6lowpan: Drop PACKET_OTHERHOST skbs in 6lowpan

this should fix your routing problems, but issue with [0] still exists.

So I should rebase and submit the whole patch series on bluetooth-next but not add a new patch to change net/bluetooth/6lowpan.c ?

until we don't clarify how bluetooth need to handle the pkt_type value in skb. You should only send one patch [PATCH linux-wpan 3/3] based on wpan-next then.

This should fix your routing issue but for me there exist still an issue at [0] which nobody hit yet.

[0] http://lxr.free-electrons.com/source/net/ipv6/mcast.c#L1413

maintainer
#18 lore raw
In reply to Jukka Rissanen

Hi,

Quoted 5 lines · Jukka Rissanen

Hmm, bluetooth 6lowpan is a bit different from ieee802154 as the bluetooth link is a point-to-point one and typically only uses link local addresses so normally every packet is really meant for that host.

mhh, when it's point-to-point, how can multicast work? Okay, maybe it's some broadcast/multicast over point-to-point communication.

I don't understand maybe I should download some 802.15.1 material and read a little bit more, but for now I have enough to care about the 802.15.4 layer.

- Alex

maintainer
#19 lore raw
Quoted 4 lines · Alexander Aring

Hi,

Quoted 1 line · Jukka Rissanen
Quoted 8 lines
Quoted 4 lines

Hmm, bluetooth 6lowpan is a bit different from ieee802154 as the bluetooth link is a point-to-point one and typically only uses link local addresses so normally every packet is really meant for that host.

mhh, when it's point-to-point, how can multicast work? Okay, maybe it's some broadcast/multicast over point-to-point communication.

mhh, seems to be something like that. I mean [0] should describe it how it works. Maybe detect this mechanism then you know "it's multicast" and set the pkt_type. I am not an expert for this stuff right now.

Salves and masters, you yes it's very different than 802.15.4, we have broadcast frames.

- Alex

[0] http://tools.ietf.org/html/draft-ietf-6lowpan-btle-12#section-3.2.4