Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

sys/net: add VAINA configuration interface #97

Merged
merged 8 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ targetConfigs/
setenv
.DS_Store
bin/
dist/tools/vaina/target
6 changes: 6 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

menu "Turpial - Radio Firmware Configuration"

config SLIP_LOCAL_ADDR
string "SLIP link local address"
default "fe80::dead:beef:cafe:babe"
help
Default SLIP link local address

rsource "sys/Kconfig"

endmenu
31 changes: 27 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ APPLICATION = radio-firmware

# If no BOARD is found in the environment, use this default:
BOARD ?= turpial
ifeq ($(BOARD),turpial)
BOARDSDIR ?= $(CURDIR)/boards
endif
EXTERNAL_BOARD_DIRS ?= $(CURDIR)/boards

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/RIOT
Expand Down Expand Up @@ -42,20 +40,45 @@ USEMODULE += ps
USEMODULE += netstats_l2
USEMODULE += netstats_ipv6

USEMODULE += vaina

USEMODULE += posix_inet

USEMODULE += timex

USEMODULE += slipdev
USEMODULE += slipdev_stdio

# set slip parameters to default values if unset
SLIP_UART ?= "UART_NUMOF-1"
ifeq ($(BOARD),cc2538dk)
SLIP_UART ?= "UART_NUMOF-1"
else
SLIP_UART ?= "0"
endif
SLIP_BAUDRATE ?= 115200

# export slip parameters
CFLAGS += -DSLIP_UART="UART_DEV($(SLIP_UART))"
CFLAGS += -DSLIP_BAUDRATE=$(SLIP_BAUDRATE)

# Enable SLAAC
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=1

CFLAGS += -I$(CURDIR)

.PHONY: host-tools

host-tools:
$(Q)env -u CC -u CFLAGS make -C $(RIOTTOOLS)

sliptty:
$(Q)env -u CC -u CFLAGS make -C $(RIOTTOOLS)/sliptty

IPV6_PREFIX = 2001:db8::/64

# Configure terminal parameters
TERMDEPS += host-tools
TERMPROG ?= sudo sh $(CURDIR)/dist/tools/vaina/start_network.sh
TERMFLAGS ?= $(FLAGS_EXTRAS) $(IPV6_PREFIX) $(PORT) $(SLIP_BAUDRATE)

include $(RIOTBASE)/Makefile.include
2 changes: 1 addition & 1 deletion RIOT
Submodule RIOT updated 182 files
226 changes: 226 additions & 0 deletions dist/tools/vaina/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions dist/tools/vaina/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "vaina"
version = "0.1.0"
authors = ["Locha Inc"]
edition = "2018"

[dependencies]
clap = { version = "2", features = ["color", "yaml"] }
bytes = "0.5"
snafu = "0.6"
nix = "0.17"

[patch.crates-io]
nix = { git = "https://github.com/nix-rust/nix" }
45 changes: 45 additions & 0 deletions dist/tools/vaina/autoconfigure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

TUN=sl0
PREFIX=128
TUN_GLB="2001::200:0:cafe" # Dirección global de prueba
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

SUDO=${SUDO:-sudo}

unsupported_platform() {
echo "unsupported platform" >&2
echo "(currently supported \`uname -s\` 'Darvin' and 'Linux')" >&2
}

case "$(uname -s)" in
Darvin)
PLATFORM="OSX";;
Linux)
PLATFORM="Linux";;
*)
unsupported_platform
exit 1
;;
esac

add_addresses() {
case "${PLATFORM}" in
Linux)
cargo build --release
${SUDO} ip address add ${TUN_GLB} dev ${TUN}
${SUDO} target/release/vaina rcs add ${TUN} ${TUN_GLB}
${SUDO} target/release/vaina nib add ${TUN} ${PREFIX} ${TUN_GLB}
;;
OSX)
# TODO: add the IPV6 address to the interface!!!
${SUDO} target/release/vaina rcs add ${TUN} ${TUN_GLB}
${SUDO} target/release/vaina nib add ${TUN} ${PREFIX} ${TUN_GLB}
unsupported_platform
;;
esac
return 0
}

add_addresses
Loading