Subversion Repositories ALCASAR

Rev

Rev 2069 | Rev 2184 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log

#!/bin/sh

# alcasar-condown.sh
# by Rexy
# This script is distributed under the Gnu General Public License (GPL)

# This script is launched after each logout
# Ce script est lancé à chaque déconnexion d'usager

# Debug : show all the coova parse variables. There are declared in /src/chilli.c
#echo "------------------------------------------------------------" >> /tmp/debug-condown.txt
#echo `date` >> /tmp/debug-condown.txt
#for i in LAYER3 DEV NET MASK ADDR USER_NAME NAS_IP_ADDRESS SERVICE_TYPE FRAMED_IP_ADDRESS FILTER_ID STATE CLASS CUI SESSION_TIMEOUT IDLE_TIMEOUT CALLING_STATION_ID CALLED_STATION_ID NAS_ID NAS_PORT_TYPE ACCT_SESSION_ID ACCT_INTERIM_INTERVAL WISPR_LOCATION_ID WISPR_LOCATION_NAME WISPR_BANDWIDTH_MAX_UP WISPR_BANDWIDTH_MAX_DOWN WISPR-SESSION_TERMINATE_TIME CHILLISPOT_MAX_INPUT_OCTETS CHILLISPOT_MAX_OUTPUT_OCTETS CHILLISPOT_MAX_TOTAL_OCTETS INPUT_OCTETS OUTPUT_OCTETS SESSION_TIME IDLE_TIME LOCATION OLD_LOCATION TERMINATE_CAUSE
#do
#       echo "$i : ${!i}" >> /tmp/debug-condown.txt
#done

# Remove user from his IPSET (depending on FILTER_ID)

#FilterID : 12345678
#1-> profile1
#2-> profile2
#3-> profile3
#4-> warn_user (if imputability report has been generated)
#6-> WL
#7-> BL
#8-> HAVP

if [ ${FILTER_ID:7:1} -eq '1' ] #HAVP
then 
        set="havp"
        if [ ${FILTER_ID:0:1} -eq '1' ]
        then 
                set_proto="proto_1";
        fi

        if [ ${FILTER_ID:1:1} -eq '1' ]
        then 
                set_proto="proto_2";
        fi
        
        if [ ${FILTER_ID:2:1} -eq '1' ]
        then 
                set_proto="proto_3";
        fi

        if [ -z "$set_proto"  ]
        then 
                set_proto="proto_0";
        fi
fi

if [ ${FILTER_ID:6:1} -eq '1' ] #HAVP_BL
then 
        set="havp_bl"
        if [ ${FILTER_ID:0:1} -eq '1' ]
        then 
                set_proto="proto_1";
        fi

        if [ ${FILTER_ID:1:1} -eq '1' ]
        then 
                set_proto="proto_2";
        fi
        
        if [ ${FILTER_ID:2:1} -eq '1' ]
        then 
                set_proto="proto_3";
        fi

        if [ -z "$set_proto"  ]
        then 
                set_proto="proto_0";
        fi
fi

if [ ${FILTER_ID:5:1} -eq '1' ] #HAVP_WL
then 
        set="havp_wl"
        if [ ${FILTER_ID:0:1} -eq '1' ]
        then 
                set_proto="proto_1";
        fi

        if [ ${FILTER_ID:1:1} -eq '1' ]
        then 
                set_proto="proto_2";
        fi
        
        if [ ${FILTER_ID:2:1} -eq '1' ]
        then 
                set_proto="proto_3";
        fi

        if [ -z "$set_proto"  ]
        then 
                set_proto="proto_0";
        fi
fi



if [ -z "$set"  ] #NOT_FILTERED
then 
        set="not_filtered"
        if [ ${FILTER_ID:0:1} -eq '1' ]
        then 
                set_proto="proto_1";
        fi

        if [ ${FILTER_ID:1:1} -eq '1' ]
        then 
                set_proto="proto_2";
        fi
        
        if [ ${FILTER_ID:2:1} -eq '1' ]
        then 
                set_proto="proto_3";
        fi

        if [ -z "$set_proto"  ]
        then 
                set_proto="proto_0";
        fi
fi


ipset del $set $FRAMED_IP_ADDRESS
ipset del $set_proto $FRAMED_IP_ADDRESS