#!/bin/bash

scripts=/usr/share/zentyal-network

ppp_iface=$1
eth_iface=$2
local_address=$4
remote_address=$5

LOG=/var/log/zentyal/pppoe.log

#TIMESTAMP=$(date +"%Y-%m-%d %T")
#echo "$TIMESTAMP> ppp-up script called with the following values:" >> $LOG
#echo "ppp_iface: $ppp_iface" >> $LOG
#echo "eth_iface: $eth_iface" >> $LOG
#echo "local_address: $local_address" >> $LOG
#echo "remote_address: $remote_address" >> $LOG
#echo "full_args: $@" >> $LOG
#echo "dns: $USEPEERDNS $DNS1 $DNS2" >> $LOG

$scripts/ppp-set-iface.pl $eth_iface $ppp_iface $local_address

$scripts/dhcp-address.pl $eth_iface $local_address 255.255.255.255

# Regenerate firewall rules
firewall_script=/usr/share/zentyal-firewall/dhcp-firewall.pl
[ -x $firewall_script ] && $firewall_script

#TIMESTAMP=$(date +"%Y-%m-%d %T")
#echo "$TIMESTAMP> ppp-up script for $eth_iface ended" >> $LOG
