diff options
Diffstat (limited to 'fw')
| -rw-r--r-- | fw/sim/meson.build | 1 | ||||
| -rw-r--r-- | fw/sim/srv/README.md | 17 | ||||
| -rw-r--r-- | fw/sim/srv/zeth.netdev (renamed from fw/radvd.conf) | 15 | ||||
| -rw-r--r-- | fw/sim/srv/zeth.network | 13 | ||||
| -rwxr-xr-x | fw/simulate-network.sh | 56 |
5 files changed, 33 insertions, 69 deletions
diff --git a/fw/sim/meson.build b/fw/sim/meson.build index 5edcad9..2e0b4fa 100644 --- a/fw/sim/meson.build +++ b/fw/sim/meson.build @@ -20,5 +20,4 @@ simulation = custom_target( '--binary-name', 'zephyr.exe', '--target-name', 'simulation-linux-amd64.exe', ], - build_by_default: true, ) diff --git a/fw/sim/srv/README.md b/fw/sim/srv/README.md new file mode 100644 index 0000000..455800f --- /dev/null +++ b/fw/sim/srv/README.md @@ -0,0 +1,17 @@ +# Network setup for native sim firmware + +This folder contains documentation to provide a network setup suitable to run +the native sim build of the firmware. + +It assumes a Linux host, an executable file with the native sim firmware, +`systemd-networkd` as network configuration solution and `ufw` as firewall. + +For network configuration the `zeth.netdev` and `zeth.network` files from this +folder have to be used with `systemd-networkd`. + +The following is required to open the firewall for the firmware on the `zeth` +virtual network interface created by `systemd-networkd`: + +``` +ufw allow in on zeth to any port 1883 proto tcp +``` diff --git a/fw/radvd.conf b/fw/sim/srv/zeth.netdev index 98c703f..e8de39d 100644 --- a/fw/radvd.conf +++ b/fw/sim/srv/zeth.netdev @@ -2,15 +2,6 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -interface zeth -{ - AdvSendAdvert on; - MinRtrAdvInterval 3; - MaxRtrAdvInterval 10; - AdvDefaultPreference low; - prefix 2001:db8::/64 - { - AdvOnLink on; - AdvAutonomous on; - }; -}; +[NetDev] +Name=zeth +Kind=tap diff --git a/fw/sim/srv/zeth.network b/fw/sim/srv/zeth.network new file mode 100644 index 0000000..7bf386a --- /dev/null +++ b/fw/sim/srv/zeth.network @@ -0,0 +1,13 @@ +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at https://mozilla.org/MPL/2.0/. + +[Match] +Name=zeth + +[Network] +IPv6SendRA=yes +Address=2001:db8::36/64 + +[IPv6Prefix] +Prefix=2001:db8::/64 diff --git a/fw/simulate-network.sh b/fw/simulate-network.sh deleted file mode 100755 index 1f28a03..0000000 --- a/fw/simulate-network.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - - -# This Source Code Form is subject to the terms of the Mozilla Public License, -# v. 2.0. If a copy of the MPL was not distributed with this file, You can -# obtain one at https://mozilla.org/MPL/2.0/. - -# This script provides a simulated network environment for a simulated Zephyr -# firmware. -# -# It is based on providing a simulated layer 2 network interface (TAP) and -# providing required services as Linux processes there. One example is the -# radvd service which send router advertisements which are required for IPv6 -# stateless address auto configuration (SLAAC). -# -# Root rights are required to run this script. Use your preferred privilege -# escalation program to call this script like this: -# -# sudo ./simulate-network.sh - - -set -euf - - -FW="$(dirname "$0")" -RADVD_CONF="${FW}/radvd.conf" - -INTERFACE='zeth' -LINUX_IP='fdb3:c9f2:efda:1::2' -NETMASK='64' - -radvd_pid='' - - -cleanup() { - if test "$radvd_pid" != "" - then - kill "$radvd_pid" - fi - - ip link delete "$INTERFACE" -} - - -trap cleanup EXIT - -set -x - -ip tuntap add "$INTERFACE" mode tap -ip link set dev "$INTERFACE" up -ip addr add "${LINUX_IP}/${NETMASK}" dev "$INTERFACE" - -radvd --nodaemon --config "$RADVD_CONF" > /dev/null 2>&1 & -radvd_pid="$!" - -wait |
