Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix@nhc-on-br #4544

Closed
wants to merge 2 commits into from
Closed

fix@nhc-on-br #4544

wants to merge 2 commits into from

Conversation

jfischer-no
Copy link
Contributor

This PR fixes the UDP transmission from a RIOT-br to a RIOT-node.
The problem is that the forwarded packet has no nested structure (such as a packet generated on the node, for example, pkt->next-> next-> type == GNRC_NETTYPE_UDP).

fix for testing, see #4462
Tested on PhyNode(pba-d-01-kw2x) as BR and PhyNode as node (microcoap_server).

@jfischer-no jfischer-no added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch labels Dec 23, 2015
@jfischer-no jfischer-no added this to the Release 2015.12 milestone Dec 23, 2015
gnrc_pktbuf_realloc_data(udp, nhc_len);

if (udp->type == GNRC_NETTYPE_IPV6) {
/* forwarded ipv6 packet */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to mark the UDP header properly before encoding in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had it in my head, I think yes.

@jfischer-no
Copy link
Contributor Author

e78dbd3 commit is misleading, (pkt->size - aligned_size) will overflow if _align(size) is greater then pkt->size.
e.g.

size = 21; // new size
aligned_size = 24;
pkt_size = 23;

I will open a own PR for e78dbd3 tonight.

@jfischer-no jfischer-no mentioned this pull request Dec 23, 2015
@cgundogan
Copy link
Member

@jfischer-phytec-iot just tested this. CoAP seems to work for my setup with your fix. I can CoAP ping the 6lr and I can request "/riot/board". Requesting "/.well-known/core" however does not work very reliably. What about you?

@cgundogan
Copy link
Member

requesting well-known does only seem to work for the first time, then I need to reboot the 6lr to request it again

@cgundogan
Copy link
Member

this can also be an unrelated issue though.

@jfischer-no
Copy link
Contributor Author

I have only tested "/riot/board". I had to interrupt ... 🔍 -> 🎁. I will continue tonight.

@cgundogan
Copy link
Member

It seems that CoAP requests do not work if they are big enough to get fragmented by 6lo. Requesting /riot/board works, because its response is too small to get fragment. I implemented a custom coap handler that returns a large string that enforces fragmenting and again - the same behaviour as for the well-known request: it does not work. Sniffing on the linux side reveals that the response (garbled or not) is not received. So the packet gets lost between the 6lr and 6lbr.

@jfischer-no
Copy link
Contributor Author

@cgundogan Do ping6 with increased payload works?

#!/bin/bash

IP=affe::42 # a riot node behind 6lbr

for (( n=0; n<=13; n++ ))
do
        for (( packetsize=0; packetsize<=299; packetsize++ ))
        do
           echo "ping6 with payload $packetsize"
           ping6 -i 0.2 -c 1 -s $packetsize -w 1 $IP
        done

        for (( packetsize=299; packetsize>0; packetsize-- ))
        do
           echo "ping6 with payload $packetsize"
           ping6 -i 0.2 -c 1 -s $packetsize -w 1 $IP
        done
done

@jfischer-no
Copy link
Contributor Author

@cgundogan @authmillenon For fragmented packets, rbuf_add fails after gnrc_sixlowpan_iphc_decode, because entry->pkt points to udp header.(?)
https://github.com/RIOT-OS/RIOT/blob/master/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c#L114
I do not know yet how is it better to fix.

@kaspar030
Copy link
Contributor

Hm, so with this PR, NHC messes up fragmentation? Maybe drop NHC for the release? Taking a while to fix...

@jfischer-no
Copy link
Contributor Author

with this PR, NHC messes up fragmentation

jaein, it was created by me, I missed it in the implementation.
Also, it pleases me not as it currently works with the pktsnip and NHC (UDP). It is difficult to understand and there are other NHCs to implement not only for UDP.

@OlegHahm @cgundogan @kaspar030 @authmillenon
I am in favor to drop NHC for the release, but merge 7350062 and e78dbd3.

@miri64
Copy link
Member

miri64 commented Dec 30, 2015

@jfischer-phytec-iot are you sure it is a UDP snip? entry->pkt should have a structure like this:

Christmas present already payed off ;-)

"Payload" might be marked as UDP.

@jfischer-no
Copy link
Contributor Author

@authmillenon no, not at https://github.com/RIOT-OS/RIOT/blob/master/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c#L114
There are (for first frag, on BR):

entry->pkt(type=GNRC_NETTYPE_UNDEF||GNRC_NETTYPE_UDP, size=8)
    |->next(type=GNRC_NETTYPE_SIXLOWPAN, size=...)
    L->next=NULL

I think gnrc_pktbuf_realloc_data for L2 pktsnip would be better method than add new pktsnip for udp header.

@miri64
Copy link
Member

miri64 commented Dec 31, 2015

You mean for IPv6 header?

@miri64
Copy link
Member

miri64 commented Dec 31, 2015

And that's totally broken indeed. entry->pkt should point to an already decoded IPv6 header too.

@miri64
Copy link
Member

miri64 commented Dec 31, 2015

But given my implementation of IPv6 and of 6LoWPAN IPHC I guess reallocing the IPv6 header was what I had originally in mind for NHC.

@kaspar030 kaspar030 mentioned this pull request Jan 4, 2016
if (_align(pkt->size) > aligned_size) {
_pktbuf_free(((uint8_t *)pkt->data) + aligned_size,
pkt->size - aligned_size);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this could generate fragmentation in the packet buffer. When is this part free'd otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@authmillenon moved to #4602

@cgundogan
Copy link
Member

@jfischer-phytec-iot ping6 with bigger payload does work with your PR merged into master. However, CoAP still breaks if packets get fragmented.

@cgundogan
Copy link
Member

I will label this PR for the next release, because I don't think that this will be fixed within the following days. @authmillenon @jfischer-phytec-iot opinions?

@miri64
Copy link
Member

miri64 commented Jan 26, 2016

👍

@OlegHahm OlegHahm removed the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Feb 27, 2016
@jnohlgard
Copy link
Member

@jfischer-phytec-iot What is the status of this PR?

/* shrink udp allocation to final size */
gnrc_pktbuf_realloc_data(udp, nhc_len);

if (udp->type == GNRC_NETTYPE_IPV6) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be if (udp->type != GNRC_NETTYPE_UDP) {?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, since I honestly don't know what state the packet is in at this point.

@miri64
Copy link
Member

miri64 commented Mar 16, 2016

I think this PR needs a rebase.

@miri64
Copy link
Member

miri64 commented Mar 16, 2016

(several PRs mentioned in this PR were merged, though there is no merge conflict).

@jnohlgard
Copy link
Member

@authmillenon what do you think about my comment above?

shouldn't this be if (udp->type != GNRC_NETTYPE_UDP) {?

I can adopt this PR and rebase on master if you want?

@miri64
Copy link
Member

miri64 commented Mar 16, 2016

@authmillenon what do you think about my comment above?

shouldn't this be if (udp->type != GNRC_NETTYPE_UDP) {?

Gave an answer ;-)

I can adopt this PR and rebase on master if you want?

@jfischer-phytec-iot are you okay with that?

@miri64
Copy link
Member

miri64 commented Mar 23, 2016

@jfischer-phytec-iot seems to be inactive at the moment. @gebart can you please adapt for the release?

@jnohlgard
Copy link
Member

I'm off on holidays at the moment, but I might be able to do this during
the weekend anyway.
On Mar 23, 2016 2:43 PM, "Martine Lenders" [email protected] wrote:

@jfischer-phytec-iot https://github.com/jfischer-phytec-iot seems to be
inactive at the moment. @gebart https://github.com/gebart can you
please adapt for the releases


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#4544 (comment)

@miri64 miri64 modified the milestones: Release 2016.07, Release 2016.04 Mar 31, 2016
@miri64
Copy link
Member

miri64 commented Mar 31, 2016

Postponed for next release.

@OlegHahm
Copy link
Member

OlegHahm commented Apr 1, 2016

Why postponing? I think this is important.

@miri64
Copy link
Member

miri64 commented Apr 1, 2016

But nobody is able to work on it at the moment as it seems...

@jnohlgard
Copy link
Member

posted a rebased PR #5232

@OlegHahm OlegHahm modified the milestones: Release 2016.04, Release 2016.07 Apr 3, 2016
@miri64
Copy link
Member

miri64 commented Apr 20, 2016

#5232 was merged, so I close this one

@miri64 miri64 closed this Apr 20, 2016
@jfischer-no jfischer-no deleted the fix@nhc-on-br branch January 23, 2017 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants