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: provide sock_ip support for lwip #5936

Merged
merged 1 commit into from
Jan 17, 2017

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Oct 12, 2016

This was taken out of #5802 and only provides the sock_ip part and the tests for it.

@miri64 miri64 added Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT 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 labels Oct 12, 2016
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 13, 2016
@miri64
Copy link
Member Author

miri64 commented Oct 31, 2016

Needs adaptation to #5945.

@miri64 miri64 added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 5, 2016
@kaspar030
Copy link
Contributor

Reassigning.

@miri64
Copy link
Member Author

miri64 commented Nov 18, 2016

Adaption to #6137 (comment) also needed...

@miri64
Copy link
Member Author

miri64 commented Nov 29, 2016

Provided the same treatment to this PR as I did for #5937.

@miri64
Copy link
Member Author

miri64 commented Jan 13, 2017

Ping?

@miri64
Copy link
Member Author

miri64 commented Jan 13, 2017

This one isn't WIP anymore either.

@miri64 miri64 removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Jan 13, 2017
Copy link
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

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

@miri64 could you please adapt tests/lwip to use the introduced sock port? It is needed anyway and makes testing much easier. Besides, the code looks fine (it is too much to go into all details) and your provided tests succeed which is great :-)

#error "lwip_sock needs IPv4 or IPv6 support"
#endif

static inline bool _af_not_supported(int af)
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 understand this function on a first sight.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add some doc.

if ((*out = netconn_new_with_proto_and_callback(type, proto, NULL)) == NULL) {
return -ENOMEM;
}
#if SO_REUSE
Copy link
Member

Choose a reason for hiding this comment

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

Strange flag name. Is it lwip specific?

Copy link
Member Author

Choose a reason for hiding this comment

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

This comes from lwIP. So I won't rename it.

To test both set the `LWIP_IPV4` and `LWIP_IPV6` to a non-zero value:

```sh
LWIP_IPV4=1 LWIP_IPV6 make all test
Copy link
Member

Choose a reason for hiding this comment

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

LWIP_IPV6=1

@miri64
Copy link
Member Author

miri64 commented Jan 14, 2017

@miri64 could you please adapt tests/lwip to use the introduced sock port? It is needed anyway and makes testing much easier.

I plan to do this after these are merged. Since the different flavors of sock are divided up into multiple PRs this makes porting in all the different PRs much harder.

@PeterKietzmann
Copy link
Member

@miri64 that makes totally sense! However, I assume you've already tested the implementation with a networking application, right? Most likely the application code will look like described here. But can you share the Makefile here (and in the other sock PRs)? That would make testing a lot easier.

@miri64
Copy link
Member Author

miri64 commented Jan 15, 2017

@miri64 that makes totally sense! However, I assume you've already tested the implementation with a networking application, right? Most likely the application code will look like described here. But can you share the Makefile here (and in the other sock PRs)? That would make testing a lot easier.

Nope, not yet. The assumption basically is so far

  1. networking with lwIP works
  2. interfacing lwIP with sock works as shown by the test applications

=> networking over sock works.

@miri64
Copy link
Member Author

miri64 commented Jan 15, 2017

Addressed comments

@PeterKietzmann
Copy link
Member

Hmm. I'm not happy with that answer. Now I have to write it by myself, find out module names and stuff, which costs time.

@miri64
Copy link
Member Author

miri64 commented Jan 15, 2017

Hmm. I'm not happy with that answer. Now I have to write it by myself, find out module names and stuff, which costs time.

Just to give you a heads-up if you really want to do this: it's a little bit more then that. You need to initialize the socks in code, too. Just adding some modules won't cut it.

@miri64
Copy link
Member Author

miri64 commented Jan 15, 2017

@PeterKietzmann see #6372

@PeterKietzmann
Copy link
Member

Thanks @miri64 that was really helpful. With#6372 I was able to send IP (as well as UDP) between native nodes and also Atmel boards. Guess I have to scan the code again before a merge.

@PeterKietzmann PeterKietzmann added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 16, 2017
@PeterKietzmann
Copy link
Member

Ok I think I'd like to merge this soon. But Jenikns states some errors. We can also have a look at Murdock but for that you should squash your fixup-commits.

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

Oh that's just lwIP not liking 8-bit and 16-bit platforms. Found that out when working on #6372.

@PeterKietzmann
Copy link
Member

I was able to IPV6=1 BOARD=z1 make clean all flash term and got ALL TESTS SUCCESSFUL

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

which application?

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

(I also get errors, due to some libc functions not defined on z1. Are you using some other toolchain/libc than the default Ubuntu one?)

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

$ msp430-gcc --version
msp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 unpatched)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@PeterKietzmann
Copy link
Member

Are there other applications than tests/lwip_sock_ip? My msp430 gcc is
msp430-gcc (GCC) 4.6.3 20120301

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

Are there other applications than tests/lwip_sock_ip? My msp430 gcc is
msp430-gcc (GCC) 4.6.3 20120301

Not in this PR, but might have been that you were referring to #6372. Curious on z1 I get error messages about missing fflush(). This is why I blacklisted it for now (and immediately squashed)

@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

Oops, something went wrong.. Fixed now.

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 16, 2017
@miri64
Copy link
Member Author

miri64 commented Jan 16, 2017

Removed useless assignment as reported by Jenkins (the variable wasn't used after that point, so it was valid) and squashed immediately:

diff --git a/pkg/lwip/contrib/sock/lwip_sock.c b/pkg/lwip/contrib/sock/lwip_sock.c
index 4dc9bd5..8ae799b 100644
--- a/pkg/lwip/contrib/sock/lwip_sock.c
+++ b/pkg/lwip/contrib/sock/lwip_sock.c
@@ -488,7 +488,6 @@ ssize_t lwip_sock_send(struct netconn **conn, const void *data, size_t len,
             return -EINVAL;
         }
         tmp = *conn;
-        type = (*conn)->type;
     }
     else {
         netbuf_delete(buf);

@miri64
Copy link
Member Author

miri64 commented Jan 17, 2017

Added more boards to BOARD_INSUFFICIENT_MEMORY that were reported by Murdock and squashed immediately.

@miri64
Copy link
Member Author

miri64 commented Jan 17, 2017

Murdock and Jenkins are both happy :-)

Copy link
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

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

Ok let's get this in but you have to take care of this during release testing (and later as well :-))!

@PeterKietzmann PeterKietzmann merged commit 1730b88 into RIOT-OS:master Jan 17, 2017
@miri64 miri64 deleted the pkg/feat/lwip-sock-ip branch January 17, 2017 12:34
@miri64
Copy link
Member Author

miri64 commented Jan 17, 2017

Sure thing :-).

if (conn == NULL) {
return -EADDRNOTAVAIL;
}
#if LWIP_SO_RCVTIMEO
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason to make this optional?
It's kind of surprising that LWIP will by default ignore the timeout in e.g. sock_udp_recv()

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC mostly because lwIP makes it optional. But maybe, with sock, this option should be enforced to be set.

Copy link
Contributor

Choose a reason for hiding this comment

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

There you go #17779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking 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.

4 participants