-
Notifications
You must be signed in to change notification settings - Fork 2k
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
gnrc_sock: implicitly set netif if there is only a single one #18065
Conversation
this one seems to meet expetations better than #17927 |
cb7aae7
to
cbd48c2
Compare
this PR in itself seems good to go but i am not sure how to trigger the changes all users of I would like to see example commands or code snippet or script that does not work prior to this PR but works with this PR eg:
this one works before this PR -> can't evaluate it |
Huh I can't reproduce the ping issue - ping doesn't even make use of gnrc_sock. For a test you can use e.g. With this you can now do
whereas on master you have to specify the interface
|
should this one error out ? (in master) |
It will just run into a timeout, but the test does not print error return codes (I thought I could just do #17922 instead) |
i added me a
I prints -110 but i seemd to have send something (which is kindof strange) |
Which is
What makes you think so? |
With
for some reason i think every send should have errored and i should get -22 (EINVAL) but it sends and waits (which seems wrong) |
For this you would need diff --git a/sys/net/gnrc/sock/udp/gnrc_sock_udp.c b/sys/net/gnrc/sock/udp/gnrc_sock_udp.c
index bc02fd979f..9169130f81 100644
--- a/sys/net/gnrc/sock/udp/gnrc_sock_udp.c
+++ b/sys/net/gnrc/sock/udp/gnrc_sock_udp.c
@@ -133,6 +133,9 @@ int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local,
}
gnrc_ep_set((sock_ip_ep_t *)&sock->remote,
(sock_ip_ep_t *)remote, sizeof(sock_udp_ep_t));
+ if (sock->remote.netif == SOCK_ADDR_ANY_NETIF) {
+ return -EINVAL;
+ }
}
if (local != NULL) {
/* listen only with local given */ |
Shouldn't this only happen if the address is a link-local address? |
some how gnrc purports it send bytes even though it did not. (i think this happen in https://github.com/RIOT-OS/RIOT/blob/master/sys/net/gnrc/sock/gnrc_sock.c#L290 ) I was wrong here thpkt is send without netif information sys/net/gnrc/netif/gnrc_netif.c : gnrc_netif_get_by_ipv6_addr or sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c : _send () (there is already a loopback check in line 699) |
why not do this in ?: sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c : _send () (there is already a loopback check in line 699) |
BTW.: This is working like intended, (it reads well and documentation is good ( the function is still doing the same thing just in another way) |
Since this has already a check for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more sane default, eases development
I think its much better to have the package go somewhere especially if it is just one direction then them to be send but not send |
Thank you for the review! |
Contribution description
The interface is already set implicitly for the
gnrc_netif_highlander()
case - also set it implicitly if there is only a single interface.Testing procedure
Issues/PRs references
alternative to #17927