Skip to content

gnrc_sock: set remote network interface implicitly#8470

Merged
bergzand merged 2 commits intoRIOT-OS:masterfrom
miri64:gnrc_sock/enh/set-remote-netif-implicitly
Mar 6, 2018
Merged

gnrc_sock: set remote network interface implicitly#8470
bergzand merged 2 commits intoRIOT-OS:masterfrom
miri64:gnrc_sock/enh/set-remote-netif-implicitly

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Jan 29, 2018

Contribution description

When there is only one interface we are simplifying a lot for the users
if the interface is set implicitly.

Issues/PRs references

"Fixes" the problems encountered in #8457.

@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking GNRC labels Jan 29, 2018
@miri64 miri64 requested a review from bergzand January 29, 2018 14:19
static inline void gnrc_ep_set(sock_ip_ep_t *out, const sock_ip_ep_t *in,
size_t in_size)
{
memcpy(out, in, in_size);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason as not to fix the size to sizeof(sock_ip_ep_t) here (and remove the extra argument with it)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Never mind then, It all looked like the same sock_something_ep_t from here :)

gnrc_netif_t *netif = gnrc_netif_iter(NULL);

if (netif != NULL) {
rem->netif = netif->pid;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I read the code correctly it is possible that this changes the const sock_udp_ep_t *remote argument here (first assigning remote to rem and then changing rem here).

Besides changing the argument to non const, I don't really have a solution, but I think it is a bit ugly to modify something that is passed as const

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mhhh change it to non-const is of the table, but you are right! This is bad. I try to come up with a better solution.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@bergzand
Copy link
Copy Markdown
Member

Tested, works. Please squash.

@rfuentess
Copy link
Copy Markdown
Contributor

Tested. Works like a charm.

@miri64 miri64 force-pushed the gnrc_sock/enh/set-remote-netif-implicitly branch from 936b3b8 to 98e45c3 Compare March 5, 2018 16:01
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 5, 2018

Squashed. Sorry for the delay.

When there is only one interface we are simplifying a lot for the users
if the interface is set implicitly.
@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 5, 2018
Copy link
Copy Markdown
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

ACK

@bergzand
Copy link
Copy Markdown
Member

bergzand commented Mar 5, 2018

Just to be sure, Travis/cppcheck complaints look not completely valid to me

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 5, 2018

Yes, but I think it doesn't hurt to copy the cpp-check suppression from ll246ff ;-)

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 5, 2018

Done

@bergzand
Copy link
Copy Markdown
Member

bergzand commented Mar 5, 2018

I think the suppression needs to be above line 255, travis is still complaining

@miri64 miri64 force-pushed the gnrc_sock/enh/set-remote-netif-implicitly branch from 846dcf9 to 527b850 Compare March 5, 2018 22:55
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 5, 2018

I think the suppression needs to be above line 255, travis is still complaining

Arghs that comes from editing on master first and then changing to the branch ^^". Fixed and amended immediately.

@miri64 miri64 force-pushed the gnrc_sock/enh/set-remote-netif-implicitly branch from 527b850 to df8d0d9 Compare March 5, 2018 22:56
@bergzand
Copy link
Copy Markdown
Member

bergzand commented Mar 6, 2018

And now the cppcheck from murdock started to complain. Looks like the same cppcheck exception should be added to the comment at l143 of sys/net/gnrc/sock/ip/gnrc_sock_ip.c

@miri64 miri64 force-pushed the gnrc_sock/enh/set-remote-netif-implicitly branch from df8d0d9 to 15d405f Compare March 6, 2018 11:20
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Mar 6, 2018

Fixed and amended immediately.

Copy link
Copy Markdown
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

Re-ACK

@bergzand bergzand merged commit b343ff8 into RIOT-OS:master Mar 6, 2018
@miri64 miri64 deleted the gnrc_sock/enh/set-remote-netif-implicitly branch March 6, 2018 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants