1#!/bin/sh 2# 3# Copyright (c) 2016 Intel Corporation 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# Run tunslip in a loop. This way we can restart qemu and do not need 18# to manually restart tunslip process that creates the tun0 device. 19 20tunslip_prog="" 21 22for tunslip in ./tunslip6 "${0%/*}/tunslip6" $ZEPHYR_BASE/../net-tools/tunslip6 23do 24 if [ -x "$tunslip" ] 25 then 26 tunslip_prog="$tunslip" 27 break 28 fi 29done 30 31test -z "$tunslip_prog" && echo "Cannot find tunslip6 executable." && exit 1 32 33if [ `id -u` != 0 ]; then 34 echo "Run this script as a root user!" 35 exit 2 36fi 37 38STOPPED=0 39trap ctrl_c INT TERM 40 41ctrl_c() { 42 STOPPED=1 43} 44 45while [ $STOPPED -eq 0 ]; do 46 "$tunslip_prog" -T -s /tmp/slip.dev 2001:db8::1/64 $@ 47done 48