1#!/bin/bash
2#
3# Copyright (c) 2019 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
17DEV=/tmp/ppp.dev
18
19if [ ! -L "$DEV" ]; then
20    echo "The $DEV is not a symbolic link to PTY."
21    echo "Please run loop-ppp-dev.sh script to create it."
22    exit 1
23fi
24
25PTS_DEV=`find $DEV -ls -type l | awk -F' ' '{ print $13 }'`
26
27STOPPED=0
28trap ctrl_c INT TERM
29
30ctrl_c() {
31    STOPPED=1
32}
33
34while [ $STOPPED -eq 0  ]; do
35    pppd $PTS_DEV +ipv6 local \
36	 noauth novj noccp noaccomp nodefaultroute nomp nodetach \
37	 debug silent 192.0.2.2:192.0.2.1
38    sleep 2
39done
40