-
Notifications
You must be signed in to change notification settings - Fork 2.1k
net/netif: add function to get interface by name from a buffer #16709
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
net/netif: add function to get interface by name from a buffer #16709
Conversation
I like the idea. In fact, I think we should use this new function instead of
I would be in favour of changing the API and deprecate the current EDIT: I just noticed |
I don't really have a strong opinion here, there is no overhead in keeping the current function the way it is implemented. |
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.
ACK. tests/gnrc_netif
passes:
make all test && echo "OK"
...
~~ SNIP 1 - size: 20 byte, type: NETTYPE_NETIF (-1)
if_pid: 6 rssi: -32768 lqi: 0
flags: 0x0
src_l2addr: 3E:E6:B5:22:FD:0B
dst_l2addr: 3E:E6:B5:22:FD:0A
~~ PKT - 2 snips, total size: 61 byte
OK
Regarding the API change of netif_get_by_name
, this can be discussed later.
Lol, I just added the same thing to #16705 ^^ |
sys/net/netif/netif.c
Outdated
netif_t *netif_get_by_name(const char *name) | ||
{ | ||
return netif_get_by_name_buffer(name, strlen(name)); | ||
} |
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.
This can be static inline
in the header now.
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.
Moved to the header
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.
The old style function could be inline (Github does not let me make a change request without a comment and I forgot to make one before...)
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.
Please squash immediately with my last suggestion.
c9c6c89
to
78c415f
Compare
Squashed directly! |
Ci found some issues |
78c415f
to
d2d1c7e
Compare
Fixed, |
Contribution description
This adds a function to
netif
that allows to search an interface by name, using a buffer and length (like the one provided by the URI parser), instead a null-terminated string.tests/gnrc_netif
has been extended accordingly.Testing procedure
tests/gnrc_netif
should pass.Issues/PRs references
Split from #16233