#!/bin/bash ################################################################################ # OpenAirInterface # Copyright(c) 1999 - 2014 Eurecom # # OpenAirInterface is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # # OpenAirInterface is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with OpenAirInterface.The full GNU General Public License is # included in this distribution in the file called "COPYING". If not, # see . # # Contact Information # OpenAirInterface Admin: openair_admin@eurecom.fr # OpenAirInterface Tech : openair_tech@eurecom.fr # OpenAirInterface Dev : openair4g-devel@eurecom.fr # # Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE # ################################################################################ # file start_sgi.bash # brief # author Lionel Gauthier # company Eurecom # email: lionel.gauthier@eurecom.fr # ######################################### # INPUT OF THIS SCRIPT: # THE DIRECTORY WHERE ARE LOCATED THE CONFIGURATION FILES ######################################### ########################################################### THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) . $THIS_SCRIPT_PATH/utils.bash . $THIS_SCRIPT_PATH/interfaces.bash . $THIS_SCRIPT_PATH/networks.bash ########################################################### if [ $# -eq 1 ]; then declare -x CONFIG_FILE_DIR=$1 if [ ! -d $CONFIG_FILE_DIR ]; then echo_error "ERROR while invoking this script, as first argument to this script you have to provide the path to a directory (./CONF/VLAN.VIRTUAL.$HOSTNAME for example) containing valid epc and enb config files" exit 1 fi else echo_error "ERROR while invoking this script, as first argument to this script you have to provide the path to a directory (./CONF/VLAN.VIRTUAL.$HOSTNAME for example) containing valid epc and enb config files" exit 1 fi cd $THIS_SCRIPT_PATH ####################################################### # FIND CONFIG FILE ####################################################### SEARCHED_CONFIG_FILE_EPC="epc*$HOSTNAME.conf" CONFIG_FILE_EPC=`find $CONFIG_FILE_DIR -iname $SEARCHED_CONFIG_FILE_EPC` if [ -f $CONFIG_FILE_EPC ]; then echo_warning "EPC config file found is now $CONFIG_FILE_EPC" else echo_error "EPC config file not found, exiting (searched for $SEARCHED_CONFIG_FILE_EPC)" exit 1 fi ####################################################### # SOURCE CONFIG FILE ####################################################### rm -f /tmp/source.txt VARIABLES=" PGW_INTERFACE_NAME_FOR_SGI\|\ PGW_IPV4_ADDR_FOR_SGI" VARIABLES=$(echo $VARIABLES | sed -e 's/\\r//g') VARIABLES=$(echo $VARIABLES | tr -d ' ') cat $CONFIG_FILE_EPC | grep -w "$VARIABLES"| tr -d " " | tr -d ";" > /tmp/source.txt source /tmp/source.txt declare PGW_IPV4_NETMASK_FOR_SGI=$( echo $PGW_IPV4_ADDR_FOR_SGI | cut -f2 -d '/') PGW_IPV4_ADDR_FOR_SGI=$( echo $PGW_IPV4_ADDR_FOR_SGI | cut -f1 -d '/') bash_exec "iptables -P INPUT ACCEPT" bash_exec "iptables -F INPUT" bash_exec "iptables -P OUTPUT ACCEPT" bash_exec "iptables -F OUTPUT" bash_exec "iptables -P FORWARD ACCEPT" bash_exec "iptables -F FORWARD" bash_exec "iptables -t nat -F" bash_exec "iptables -t mangle -F" bash_exec "iptables -t filter -F" bash_exec "iptables -t raw -F" bash_exec "iptables -A OUTPUT -o eth1 --protocol sctp -j DROP" create_sgi_vlans