mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
allow for custom tap names
This commit is contained in:
parent
3b94bef32a
commit
bad523831b
@ -5,6 +5,7 @@ COUNT=${2}
|
|||||||
|
|
||||||
DEFCOUNT="2"
|
DEFCOUNT="2"
|
||||||
DEFBRNAME="tapbr0"
|
DEFBRNAME="tapbr0"
|
||||||
|
DEFTAPNAME="tap"
|
||||||
|
|
||||||
if [ -z "${USER}" ]; then
|
if [ -z "${USER}" ]; then
|
||||||
echo 'need to export $USER'
|
echo 'need to export $USER'
|
||||||
@ -18,6 +19,9 @@ fi
|
|||||||
if [ -z "${BRNAME}" ]; then
|
if [ -z "${BRNAME}" ]; then
|
||||||
BRNAME="${DEFBRNAME}"
|
BRNAME="${DEFBRNAME}"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "${TAPNAME}" ]; then
|
||||||
|
TAPNAME="${DEFTAPNAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${COMMAND}" = 'create' ]; then
|
if [ "${COMMAND}" = 'create' ]; then
|
||||||
if [ -z "${COUNT}" ]; then
|
if [ -z "${COUNT}" ]; then
|
||||||
@ -30,11 +34,11 @@ if [ "${COMMAND}" = 'create' ]; then
|
|||||||
sudo ip link set ${BRNAME} up || exit 1
|
sudo ip link set ${BRNAME} up || exit 1
|
||||||
|
|
||||||
for N in $(seq 0 "$((COUNT - 1))"); do
|
for N in $(seq 0 "$((COUNT - 1))"); do
|
||||||
echo "creating tap${N} ..."
|
echo "creating ${TAPNAME}${N} ..."
|
||||||
sudo ip tuntap add dev tap${N} mode tap user ${USER} || exit 1
|
sudo ip tuntap add dev ${TAPNAME}${N} mode tap user ${USER} || exit 1
|
||||||
sudo -s sh -c "echo 1 > /proc/sys/net/ipv6/conf/tap${N}/disable_ipv6" || exit 1
|
sudo -s sh -c "echo 1 > /proc/sys/net/ipv6/conf/${TAPNAME}${N}/disable_ipv6" || exit 1
|
||||||
sudo brctl addif ${BRNAME} tap${N} || exit 1
|
sudo brctl addif ${BRNAME} ${TAPNAME}${N} || exit 1
|
||||||
sudo ip link set tap${N} up || exit 1
|
sudo ip link set ${TAPNAME}${N} up || exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
elif [ "${COMMAND}" = 'delete' ]; then
|
elif [ "${COMMAND}" = 'delete' ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user