8000 gnrc_static: add static network configuration by benpicco · Pull Request #18477 · RIOT-OS/RIOT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gnrc_static: add static network configuration #18477

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

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

benpicco
Copy link
Contributor
@benpicco benpicco commented Aug 19, 2022

Contribution description

At FrOSCon we will be are provided with a static address and prefix, there is no auto-configuration.

This adds a gnrc_static module that allows to run a border router with compile-time constant config.

Testing procedure

At FrOSCon, run the GNRC border router example with

make -C examples/gnrc_border_router UPLINK=ethernet PREFIX_CONF=static IPV6_ADDR=2001:638:408:2019::666e:6f72:64/64 IPV6_PREFIX=2001:638:408:2017::/64 IPV6_DEFAULT_ROUTER=2001:638:408:2019::1

edit the border router is working fine with this setting at FrOSCon, there is also a CoAP server running on it that is available on the Internet.

Issues/PRs references

@github-actions github-actions bot added Area: examples Area: Example Applications Area: network Area: Networking Area: sys Area: System labels Aug 19, 2022
@benpicco benpicco requested review from chrysn and jia200x August 19, 2022 12:17
@benpicco benpicco force-pushed the examples/gnrc_border_router-static branch 3 times, most recently from 9cf2cec to 9818b2f Compare August 20, 2022 12:25
@benpicco benpicco requested a review from maribu August 21, 2022 13:34
@benpicco benpicco force-pushed the examples/gnrc_border_router-static branch from 9818b2f to 4abf093 Compare August 21, 2022 13:39
@github-actions github-actions bot added the Area: Kconfig Area: Kconfig integration label Oct 1, 2022
@benpicco
Copy link
Contributor Author
benpicco commented Oct 1, 2022

I added Kconfig but I have no idea how to test this.
e.g. when I do

make -C examples/gnrc_networking TEST_KCONFIG=1 menuconfig

I don't see any option to configure GNRC.
When I search for the added config options, I get

image

Copy link
Member
@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

There is still a Makefile for the module missing:

$ QUIETER=1 PREFIX_CONF=static make -C examples/gnrc_border_router flash -j --no-print-directory
/home/mlenders/Repositories/RIOT-OS/RIOT/makefiles/kconfig.mk:118: Warning! SHOULD_RUN_KCONFIG is not set but a previous configuration file was detected (did you run `make menuconfig`?). Kconfig will run regardless.
/home/mlenders/Repositories/RIOT-OS/RIOT/makefiles/kconfig.mk:118: Warning! SHOULD_RUN_KCONFIG is not set but a previous configuration file was detected (did you run `make menuconfig`?). Kconfig will run regardless.
Building application "gnrc_border_router" for "native" with MCU "native".

make[4]: *** No targets specified and no makefile found.  Stop.
make[3]: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/Makefile.base:31: ALL--/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/network_layer/ipv6/static_addr] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/Makefile.base:31: ALL--/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc] Error 2
make[1]: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/Makefile.base:31: ALL--/home/mlenders/Repositories/RIOT-OS/RIOT/sys] Error 2
make: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/examples/gnrc_border_router/../../Makefile.include:738: application_gnrc_border_router.module] Error 2

@miri64
Copy link
Member
miri64 commented Oct 4, 2022

I added Kconfig but I have no idea how to test this. e.g. when I do

make -C examples/gnrc_networking TEST_KCONFIG=1 menuconfig

I don't see any option to configure GNRC. When I search for the added config options, I get

You need to include the module, for them to be visible, but for that you need to define the rules to build the module first ;-).

@benpicco
Copy link
Contributor Author
benpicco commented Oct 4, 2022

Oops, forgot to commit the Makefile

You need to include the module, for them to be visible, but for that you need to define the rules to build the module first ;-).

That didn't help - the Makefile was present on my local machine.

The whole GNRC module is not visible

image

@benpicco
Copy link
Contributor Author

I think KConfig can't be tested because there is nothing that selects the USEMODULE_GNRC Kconfig option / this option doesn't exist yet.

Copy link
Member
@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Argghs sorry, I provided the solution to your problem days ago, but did not submit my review. There are two Kconfig paths at the moment: You tried the dependency resolution via Kconfig, which, yes, as you rightly pointed out, does not work with GNRC yet. But if you run with TEST_KCONFIG=0 (which is what you get when you just type make menuconfig on an app and the current default), you will only run the configuration via Kconfig, no dependency resolution. Then it works.

@benpicco benpicco requested a review from miri64 November 8, 2022 00:11
@benpicco
Copy link
Contributor Author

May I squash?

@benpicco benpicco force-pushed the examples/gnrc_border_router-static branch from d4709b3 to 34e9d66 Compare December 11, 2022 22:34
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 11, 2022
@benpicco benpicco requested a review from kaspar030 December 13, 2022 09:48
Copy link
Member
@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Some questions about the chosen defaults.


config GNRC_IPV6_STATIC_PREFIX
string "Static IPv6 prefix for the downstream network"
default "2001:db8:8000::/48"
Copy link
Member

Choose a reason for hiding this comment

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

2001:db8::100 is not part of 2001:db8:8000::/48 is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the upstream network and the downstream network are two separate networks.

Copy link
Member

Choose a reason for hiding this comment

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

Arghs sorry, missed the upstream part.


config GNRC_IPV6_STATIC_DEFAULT_ROUTER
string "Static IPv6 address of the default router"
default "2001:db8::1"
Copy link
Member

Choose a reason for hiding this comment

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

Does this actually work? Normally, the default router is a link-local address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for the setup at FrOSCon we had IPV6_GATEWAY=2001:638:408:2019::1 and it worked.

Copy link
Member
@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

bors merge

@miri64 miri64 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, 2023
@benpicco
Copy link
Contributor Author

Bors will already do a full build, but it might now fail the merge as Murdock status is now missing.

bors bot added a commit that referenced this pull request Jan 16, 2023
18477: gnrc_static: add static network configuration r=miri64 a=benpicco



19155: Revert "sys/pm_layered: pm_(un)block add attribute optimize(3)" r=benpicco a=Teufelchen1

Revert "sys/pm_layered: pm_(un)block add attribute optimize(3) -shortens hotpath"

This reverts commit 5447203.

### Contribution description

Compiling `examples/gnrc_networking_mac` using `TOOLCHAIN=llvm` yields the following error:
```
RIOT/sys/pm_layered/pm.c:77:16: error: unknown attribute 'optimize' ignored [-Werror,-Wunknown-attributes]
__attribute__((optimize(3)))
```
As indicated, this is because the attribute `optimize` is GCC only and not present in LLVM.
Compare the manpages of [GCC](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html) and [LLVM](https://clang.llvm.org/docs/AttributeReference.html).


### Testing procedure

Since this should only affect performance and not behavior, no special testing is needed. I am not aware of any tests in RIOT which could verify that assumption.

### Issues/PRs references

Introduced in #18846

There is another instance of this attribute being used in[ shell_lock.c](https://github.com/RIOT-OS/RIOT/blob/6fb340d654ac8da07759cb9199c6aaa478589aa7/sys/shell_lock/shell_lock.c#L80). Since the usage is security related, I omit it from this PR.


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
@bors
Copy link
Contributor
bors bot commented Jan 16, 2023

This PR was included in a batch that was canceled, it will be automatically retried

bors bot added a commit that referenced this pull request Jan 16, 2023
18477: gnrc_static: add static network configuration r=miri64 a=benpicco



19155: Revert "sys/pm_layered: pm_(un)block add attribute optimize(3)" r=maribu a=Teufelchen1

Revert "sys/pm_layered: pm_(un)block add attribute optimize(3) -shortens hotpath"

This reverts commit 5447203.

### Contribution description

Compiling `examples/gnrc_networking_mac` using `TOOLCHAIN=llvm` yields the following error:
```
RIOT/sys/pm_layered/pm.c:77:16: error: unknown attribute 'optimize' ignored [-Werror,-Wunknown-attributes]
__attribute__((optimize(3)))
```
As indicated, this is because the attribute `optimize` is GCC only and not present in LLVM.
Compare the manpages of [GCC](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html) and [LLVM](https://clang.llvm.org/docs/AttributeReference.html).


### Testing procedure

Since this should only affect performance and not behavior, no special testing is needed. I am not aware of any tests in RIOT which could verify that assumption.

### Issues/PRs references

Introduced in #18846

There is another instance of this attribute being used in[ shell_lock.c](https://github.com/RIOT-OS/RIOT/blob/6fb340d654ac8da07759cb9199c6aaa478589aa7/sys/shell_lock/shell_lock.c#L80). Since the usage is security related, I omit it from this PR.


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
@bors
Copy link
Contributor
bors bot commented Jan 16, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@benpicco
Copy link
Contributor Author

bors merge

@bors
Copy link
Contributor
bors bot commented Jan 16, 2023

Already running a review

@miri64
Copy link
Member
miri64 commented Jan 16, 2023

Bors will already do a full build, but it might now fail the merge as Murdock status is now missing.

Since the build was already pretty stale, I wanted to trigger another quick build just to make sure the merge train won't fail.

@benpicco
Copy link
Contributor Author
benpicco commented Jan 16, 2023

But the merge train would have run before the quick build.
Quick builds are not yet prioritized above bors runs.

@miri64
Copy link
Member
miri64 commented Jan 16, 2023

But the merge train would have run before the quick build.

Not from how the Murdock queue looked like...

@bors
Copy link
Contributor
bors bot commented Jan 16, 2023

Build succeeded:

@bors bors bot merged commit 211db05 into RIOT-OS:master Jan 16, 2023
@benpicco benpicco deleted the examples/gnrc_border_router-static branch January 16, 2023 17:02
@jia200x jia200x added this to the Release 2023.04 milestone Apr 25, 2023
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: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0