RIOT-OS / RIOT

RIOT - The friendly OS for IoT
https://riot-os.org
GNU Lesser General Public License v2.1
4.83k stars 1.97k forks source link

tools: cleanup host-side network setup #14618

Open miri64 opened 3 years ago

miri64 commented 3 years ago

The Issue

With https://github.com/RIOT-OS/RIOT/pull/14454 now merged, we have a total of 3 start_network.sh scripts:

For new communication protocols to allow for network communication between host and node such as PPP, the potential for further such scripts popping up, exists.

Moreover, for ethos there is also the setup_network.sh script used to setup testing environments only once which not only copies a lot from the ethos version of the start_network.sh script, but also has some overlap with tapsetup. tapsetup set's up TAP interfaces for native in a bridge and has the distinct advantage of supporting multiple platforms (Linux, Mac OSX, and FreeBSD) and being well tested on them.

Another issue is that both tapsetup and the start_network.sh/setup_network.sh scripts of ethos destroy each others environments if not used carefully, which can lead to a lot of frustration when running host-interaction based tests, like the scapy once on multiple boards including native.

Finally, it is quite annoying for testing, that the host-interaction between host and node can be quite different for native and ethos-based communication: tapsetup creates the TAP interfaces in a bridge, so multiple native instances can communicate among each other and with the host, ethos's script just create a bare TAP interface. For the native case the host needs to communicate over the bridge's interface, for ethos-based tests, over the TAP interface. The first is the case since interfaces in a bridge are only reachable from the bridge on the host machine, and not directly accessible for reception of packages.

Proposed solution

  1. Unify start_network.sh to use setup_network.sh which in turn uses tapsetup to create TAP interfaces including a bridge (or for SLIP and USB CDC-ECM: add respective interface to bridge).
  2. Fold native as a new uplink type into that script.
  3. Use start_network.sh as terminal program for all applications that require it.
  4. (optional) Add state file (to /tmp) that keeps track of created interfaces and their associated bridges and make scripts idempotent.

Issues solved as a side-effect

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

maribu commented 1 year ago

Ping?

miri64 commented 1 year ago

Started working on that, got other responsibilities, project got staled, no idea which state it is now ^^" Still, would be nice to have!