#!/bin/bash
###
### $1: PPP_IFACE
### $2: PPP_TTY
### $3: PPP_SPEED
### $4: PPP_LOCAL
### $5: PPP_REMOTE
### $6: PPP_IPPARAM

(
echo
echo "`date` $1 started"
INT="$PPP_IFACE"
/usr/local/sbin/remountrw
echo "1:$1  2:$2  3:$2  4:$4   5:$5"

if [ "$2" = "/dev/ttyUSB0" ]; then
  echo "ip-up for 3g. Will configure 3g stuff"
else
  echo "ip-up for other interface was started but this is 3g stuff. Will do nothing"
  exit 1
fi


### Do all the needed stuff like
### Add port forward from this interface etc...

### Restart daemons which listen at local ip addresses
/etc/init.d/ntp restart
/etc/init.d/pdnsd restart

### Log infos
/usr/local/bin/log_new_ip_address $4 $5 &
) 2>&1 >> /var/log/ppp_up_stuff.log