Skip to content

Commit

Permalink
WIP: dist/tools/ethos/start_network.sh start uhcpd
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Feb 8, 2016
1 parent 3c2cfb7 commit b994769
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dist/tools/ethos/start_network.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/sh

trap "cleanup" EXIT SIGINT SIGTERM
trap "cleanup" EXIT #SIGINT SIGTERM

create_tap() {
ip tuntap add ${TAP} mode tap user ${USER}
sysctl -w net.ipv6.conf.tap0.forwarding=1
sysctl -w net.ipv6.conf.eth0.accept_ra=0
ip link set ${TAP} up
ip a a fe80::1/64 dev ${TAP}
ip a a fc00:dead:beef::1/128 dev lo
ip route add ${PREFIX} via fe80::2 dev ${TAP}
}

Expand All @@ -18,11 +19,20 @@ remove_tap() {
cleanup() {
echo "Cleaning up..."
remove_tap
ip a d fc00:dead:beef::1/128 dev lo
kill $UHCPD_PID
}

start_uhcpd() {
${UHCPD} ${TAP} ${PREFIX} > /dev/null &
UHCPD_PID=$!
}

PORT=$1
TAP=$2
PREFIX=$3
UHCPD=../uhcpd/bin/uhcpd

create_tap
start_uhcpd
./ethos $TAP $PORT

0 comments on commit b994769

Please sign in to comment.