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

sys/net/netif: add convenience functions for getting/printing IPv6 addresses #18161

Merged
merged 6 commits into from
Jun 6, 2022

Conversation

maribu
Copy link
Member

@maribu maribu commented Jun 2, 2022

Contribution description

At a few places this was already either done by hand or via an ugly hack to call the shell handler if ifconfig from C, so apparently there is a use for it. In addition, the hack of calling a single shell handler doesn't work well with XFA, as XFA items are not subject to link time garbage collection.

Testing procedure

Run examples/gnrc_minimal and it should still print all IPv6 address (but now as JSON, because that's what cool kids do now).

2022-06-02 12:30:55,146 # RIOT network stack example application
2022-06-02 12:30:55,159 # {"IPv6 addresses": ["fe80::a04d:49ff:fe6f:54ff", "fe80::ff:fe00:ff", "fe80::4c49:6f54:4f76:1ff", "fe80::4c49:6f54:4f76:ff", "fe80::4c49:6fff:fe54:ff"]}

Issues/PRs references

Needed for #18152

@maribu maribu added Area: network Area: Networking Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Jun 2, 2022
@maribu maribu requested review from benpicco and fjmolinas June 2, 2022 10:44
@github-actions github-actions bot added Area: examples Area: Example Applications Area: sys Area: System Area: tests Area: tests and testing framework labels Jun 2, 2022
Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

Small static chec nitpick, otherwise good to have this

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

LGTM, if muedock is happy let's go with it!

@fjmolinas
Copy link
Contributor

Please squash!

@maribu maribu added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 2, 2022
@maribu maribu enabled auto-merge June 2, 2022 11:19
@maribu
Copy link
Member Author

maribu commented Jun 2, 2022

Thanks for the quick review :)

@miri64 miri64 disabled auto-merge June 2, 2022 12:05
@maribu maribu mentioned this pull request Jun 2, 2022
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

examples/telnet_server would also benefit from this

@maribu
Copy link
Member Author

maribu commented Jun 2, 2022

I take this of from the CI queue now and let this wait for #18162 - once this is in it can use fmt when used anyway as before. Especially for newlib users there is quite a bit of memory to be safed when not using printf.

@maribu maribu removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 2, 2022
@maribu maribu added the State: waiting for other PR State: The PR requires another PR to be merged first label Jun 2, 2022
@maribu maribu requested a review from kaspar030 as a code owner June 2, 2022 16:21
Also use `IS_USED(MODULE_FMT)` rather than the preprocessor and rely
on the optimizer to eliminate the dead branch.
- add `netif_get_ipv6()` to query IPv6 (as a slim convenience wrapper
  for `netif_get_opt()`)
- add `netifs_get_ipv6()` to query IPv6 addresses of all netifs
- add `netif_print_ipv6()` to print the IPv6 address(es) of a single
  netif
- add `netifs_print_ipv6()` to print the IPv6 address(es) of all netifs
@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Jun 6, 2022
@benpicco benpicco enabled auto-merge June 6, 2022 23:22
@benpicco benpicco merged commit bdf1c97 into RIOT-OS:master Jun 6, 2022
@maribu maribu deleted the sys/net/netif branch June 7, 2022 05:24
@maribu
Copy link
Member Author

maribu commented Jun 7, 2022

thx (:

@miri64
Copy link
Member

miri64 commented Jun 20, 2022

This broke the release tests. Will provide a fix to Release-Specs ASAP.

miri64 added a commit to miri64/Release-Specs that referenced this pull request Jun 20, 2022
The address output of `examples/nanocoap_server` was changed to JSON in
RIOT-OS/RIOT#18161. This changes the parsing to
account for that.
@miri64
Copy link
Member

miri64 commented Jun 20, 2022

See RIOT-OS/Release-Specs#252

@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: examples Area: Example Applications Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants