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

pkg: ndn-riot: initial import of ndn-riot as a package #5914

Merged
merged 6 commits into from
May 24, 2018

Conversation

cgundogan
Copy link
Member

This PR imports ndn-riot [1] as a pkg.
Furthermore, I included a tests application that I adopted from [2].

@cawka I hope you don't mind that I included your changes proposed in #5648.

Can be tested by navigating into tests/ndn-ping and invoke the usual make all term PORT=tap0/1

[1] https://github.com/named-data-iot/ndn-riot
[2] https://github.com/named-data-iot/ndn-riot-examples/tree/master/ndn-ping

@cgundogan cgundogan added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: pkg Area: External package ports labels Oct 6, 2016
@mfrey
Copy link
Contributor

mfrey commented Oct 6, 2016

Build fails for me with (I'm a bit puzzled since the next statement is a assert using the variable)

/home/frey/Desktop/Projekte/RIOT/tests/ndn-ping/bin/pkg/native/ndn-riot/pit.c: 
In function ‘ndn_pit_add’:
/home/frey/Desktop/Projekte/RIOT/tests/ndn-ping/bin/pkg/native/ndn-riot/pit.c:104:13: 
error: unused variable ‘r’ [-Werror=unused-variable]
         int r = ndn_interest_get_name(&entry->shared_pi->block, &pn);

@OlegHahm
Copy link
Member

OlegHahm commented Oct 7, 2016

Looking forward to test this.

@OlegHahm
Copy link
Member

OlegHahm commented Oct 7, 2016

@mfrey, maybe you're building (the package) with NDEBUG set?

@mfrey
Copy link
Contributor

mfrey commented Oct 7, 2016

@OlegHahm I haven't set anything actually. The variable is only used in the assert statement. If you don't build with NEDBUG this is an issue nontheless. Isn't it? Anyway, @cgundogan fixed it by a cast to void. I'll give it a try later.

@OlegHahm
Copy link
Member

OlegHahm commented Oct 7, 2016

The variable is only used in the assert statement. If you don't build with NEDBUG this is an issue nontheless. Isn't it?

Sure. Just wanted to find an explanation.

@wentaoshang
Copy link
Contributor

wentaoshang commented Oct 7, 2016

There is also a unittest suite for encoding & decoding APIs that has not been merged into ndn-riot repo yet:

https://github.com/wentaoshang/RIOT/tree/ndn/tests/unittests/tests-ndn_encoding

I can try to make a separate PR for this if you think it can be included.

@cgundogan
Copy link
Member Author

if you think it can be included.

nice, definitely!

@OlegHahm
Copy link
Member

Doesn't ndn-riot require malloc/free? In that case, the application should use the tlsf package.

@OlegHahm
Copy link
Member

Until #5943 is fixed, the applications should also blacklist boards without hwrng.

@OlegHahm
Copy link
Member

@cgundogan, with named-data-iot/ndn-riot#2 being merged, could you please update the revision of the package?

@cgundogan cgundogan force-pushed the pr/ndn-riot_as_a_pkg branch 2 times, most recently from a4da9bb to 8ea42ac Compare October 19, 2016 06:01
@cgundogan
Copy link
Member Author

@OlegHahm sure, sorry for the delay. I amended the new commit hash to point to current master of https://github.com/named-data-iot/

@wentaoshang
Copy link
Contributor

Sorry I lost track of this issue. Wonder what is the current status? Anything needed to be fixed from NDN-RIOT side? Honestly I'm not very familiar with the Github collaboration procedure but I can try my best to help.

Also I have some concern about the requirement for hardware RNG for micro-ecc, because the two platforms (SAMR21 and IoT-Lab M3) I'm using for NDN-RIOT right now do not have this feature. What I did is to patch micro-ecc (named-data-iot@8b9f0b1) and use deterministic ECDSA signing with pre-generated keys (RFC6979). Any comment on this idea?

@cgundogan cgundogan force-pushed the pr/ndn-riot_as_a_pkg branch from 8ea42ac to f27c93b Compare November 29, 2016 17:25
@cgundogan
Copy link
Member Author

@OlegHahm ping?

@wentaoshang I have no experience with the micro-ecc package, but the diff in your commit (named-data-iot@8b9f0b1) is not very apparent to me. What exactly did you change?

@tfar
Copy link
Contributor

tfar commented Nov 29, 2016

@wentaoshang so you're using your own deterministic ECDSA implementation or is the one you're using part of MicroECC? The patch you're referencing, named-data-iot/RIOT@8b9f0b1 , removes the RIOT hardware random generator integration. Does MicroECC behave differently based on whether g_rng_function is defined or not; or why was it removed? I think RIOT's hwrng_read is always available, regardless of hardware support.

@wentaoshang
Copy link
Contributor

Sorry I forgot to mention this: I'm using a signing function called uECC_sign_deterministic in MicroECC https://github.com/kmackay/micro-ecc/blob/master/uECC.c#L1377 . For that function to work, g_rng_function has to be unset (hence the removal of old patch 0002). The side effect is that it'll turn off hardware RNG for all platforms, which is bad. I tried to figure out some preprocessor tricks to fix that but failed...

@tfar
Copy link
Contributor

tfar commented Nov 29, 2016

@wentaoshang So instead of removing the default implementation, can't you call void uECC_set_rng(uECC_RNG_Function rng_function) at https://github.com/kmackay/micro-ecc/blob/master/uECC.c#L190 in your user code to reset the random number generator callback?

@wentaoshang
Copy link
Contributor

That could also work... Ideally I want to be able to switch automatically between deterministic/nondeterministic signing (maybe at compile time?), based on whether HWRNG is available. But what you proposed sounds a good solution for now.

@tfar
Copy link
Contributor

tfar commented Nov 29, 2016

The setter/getter functions for the random generator callback are part of the public API https://github.com/kmackay/micro-ecc/blob/master/uECC.h#L127 . So it seems what you want to achieve is possible without completely removing support for hardware random number generator in MciroECC.

@wentaoshang
Copy link
Contributor

I agree. I'll try to figure out how to update ndn-riot code. I remember that without named-data-iot/RIOT@8b9f0b1 the code could not compile for platforms with no HWRNG because hwrng_read was not defined. Not sure if the problem has been fixed in more recent releases.

@kaspar030
Copy link
Contributor

kaspar030 commented May 23, 2018

I can't reproduce the error of Murdock, which is weird (it's not a compilation error, but a directory that is missing). Any idea to help me ? @kaspar030 ?

Try to do build the package in "pkg/ndn-riot/Makefile" (instead of adding "DIRS += BINDIRBASE/..." in "pkg/ndn-riot/Makefile.include". See how other packages do it, usually sth like "$(MAKE)" -C $(PKG_BUILDDIR) edit: in the "all:" target.

@astralien3000
Copy link
Member

Thank you @kaspar030, the problem was indeed the missing rule for compiling the package. I still don't understand why it works on my computer an not for Murdock, but well, at least it is fixed.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

@astralien3000, can you squash ? The last commits should be squashed to the first one of this PR, IIUC.

@aabadie aabadie dismissed their stale review May 23, 2018 13:08

Wrong option selected.

@@ -0,0 +1,11 @@
PKG_NAME=ndn-riot
PKG_URL=https://github.com/astralien3000/ndn-riot
Copy link
Member Author

Choose a reason for hiding this comment

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

What is the reason not to take the official repo's url?

Copy link
Member

Choose a reason for hiding this comment

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

New errors appeared since the last time I tried the code. I will need to do a pull request to the official repos, but for the moment, I try with mine. Of course this should not be merged for the moment.

Copy link

Choose a reason for hiding this comment

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

Just in case, I can quickly merge pull requests in named-data-iot/ndn-riot repo

@astralien3000 astralien3000 force-pushed the pr/ndn-riot_as_a_pkg branch from 04a2500 to 10cb7a7 Compare May 23, 2018 13:35
@astralien3000
Copy link
Member

@kaspar030, well actually adding what you said did not help. I don't know why it worked once, but I got the same error again for 3 builds of Murdock... Maybe it's a race condition like @gebart said ? But I can't reproduce the error even with -j9...

@@ -0,0 +1,3 @@
INCLUDES += -I$(BINDIRBASE)/pkg/$(BOARD)
DIRS += $(BINDIRBASE)/pkg/$(BOARD)/ndn-riot
Copy link
Contributor

Choose a reason for hiding this comment

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

this line needs to go

INCLUDES += -I$(BINDIRBASE)
is this file taken in account ????

INCLUDES += -I$(PKGDIRBASE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I think I see what is going on. You've been using $BINDIRBASE/pkg/$(BOARD), which locally is the same as $PKGDIRBASE. But murdock overrides $BINDIR and $PKGDIRBASE (but not $BINDIRBASE, thus the wrong path is set.

I wonder why this didn't pop up earlier. ;)

So, INCLUDES += -I$(PKGDIRBASE) (as it is now) should work.

@astralien3000
Copy link
Member

Ok ! Almost there ! I just need to wait for the PR of ndn-riot, and we can move. Maybe tomorrow.

@astralien3000
Copy link
Member

Woo ! Murdock is ok (taking apart the static test, because squash is needed). I rolled back to the official ndn-riot repos. Everything is ready from my side, may I squash ? Also, someone else should test the last changes I made.

@astralien3000 astralien3000 force-pushed the pr/ndn-riot_as_a_pkg branch from 55327d1 to dbd049a Compare May 24, 2018 09:18
@astralien3000
Copy link
Member

@cgundogan, @mfrey, can one of you test ndn-ping ?

@adjih
Copy link
Contributor

adjih commented May 24, 2018

Just tested with samr21-xpro: it is working fine with client & server on two different boards.

@@ -34,7 +34,8 @@ extern "C" {
#define ETHERTYPE_RESERVED (0x0000) /**< Reserved */
#define ETHERTYPE_IPV4 (0x0800) /**< Internet protocol version 4 */
#define ETHERTYPE_ARP (0x0806) /**< Address resolution protocol */
#define ETHERTYPE_NDN (0x0801) /**< Parc CCNX */
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this change have an impact on other named data network (CCN-lite) implementations ?

Copy link
Contributor

@mfrey mfrey May 24, 2018

Choose a reason for hiding this comment

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

I don't think so. CCN-lite for RIOT uses only NDN for now (-> it does not support the other formats of CCN-lite).

Copy link

Choose a reason for hiding this comment

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

Actually, this should be changed to

#define ETHERTYPE_NDN 0x8624

This is the value we are using in other places. This, probably, was just a quick hack.

Copy link
Contributor

@mfrey mfrey May 24, 2018

Choose a reason for hiding this comment

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

I'm slightly confused by the PARC CCNX comment.

Copy link
Member

Choose a reason for hiding this comment

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

I just tested the ccn-lite-relay example, it behave the same as on master.

Copy link
Member

@astralien3000 astralien3000 May 24, 2018

Choose a reason for hiding this comment

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

Actually this line is the one deleted, ETHERTYPE_NDN is defined as 0x8624 in this PR (see this). But ETHERTYPE_CCNX is still defined as 0x0801. What do we do about these lines ? They are ok for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

According to history, Oleg added an ETHERTYPE_NDN in 2015, and then Cenk did a commit in 2016 "ethertype: use correct type for NDN and CCNx", that introduced another name for ETHERTYPE_CCNX and a new proper value for ETHERTYPE_NDN.

I think this reflects properly the fact that NDN and CCNx became different protocols.

Copy link
Member

@astralien3000 astralien3000 left a comment

Choose a reason for hiding this comment

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

No further question from anyone. ACK

@astralien3000 astralien3000 merged commit 260bc37 into RIOT-OS:master May 24, 2018
@cgundogan cgundogan deleted the pr/ndn-riot_as_a_pkg branch May 24, 2018 16:29
@cladmi cladmi modified the milestone: Release 2018.07 Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.