Subversion Repositories ALCASAR

Rev

Rev 2079 | Rev 2234 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
1294 richard 1
#!/bin/sh
2
 
2068 richard 3
# alcasar-condown.sh
1294 richard 4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
2184 richard 7
# This script is launched by coova after each logout
8
# Ce script est lancé par coova à chaque déconnexion d'usager
1294 richard 9
 
2184 richard 10
if [ -z $FRAMED_IP_ADDRESS ]
11
then
12
	exit
13
fi
1294 richard 14
 
2069 richard 15
# Remove user from his IPSET (depending on FILTER_ID)
1364 richard 16
 
2184 richard 17
#FilterID Byte N° 0 to 7
18
#0-> profile1
19
#1-> profile2
20
#2-> profile3
21
#3-> warn_user (if imputability report has been generated)
22
#5-> WL
23
#6-> BL
24
#7-> HAVP
2006 raphael.pi 25
 
26
if [ ${FILTER_ID:7:1} -eq '1' ] #HAVP
27
then 
28
	set="havp"
29
	if [ ${FILTER_ID:0:1} -eq '1' ]
30
	then 
31
		set_proto="proto_1";
32
	fi
33
 
34
	if [ ${FILTER_ID:1:1} -eq '1' ]
35
	then 
36
		set_proto="proto_2";
37
	fi
38
 
39
	if [ ${FILTER_ID:2:1} -eq '1' ]
40
	then 
41
		set_proto="proto_3";
42
	fi
43
 
2184 richard 44
	if [ -z "$set_proto" ]
2006 raphael.pi 45
	then 
46
		set_proto="proto_0";
47
	fi
48
fi
49
 
50
if [ ${FILTER_ID:6:1} -eq '1' ] #HAVP_BL
51
then 
52
	set="havp_bl"
53
	if [ ${FILTER_ID:0:1} -eq '1' ]
54
	then 
55
		set_proto="proto_1";
56
	fi
57
 
58
	if [ ${FILTER_ID:1:1} -eq '1' ]
59
	then 
60
		set_proto="proto_2";
61
	fi
62
 
63
	if [ ${FILTER_ID:2:1} -eq '1' ]
64
	then 
65
		set_proto="proto_3";
66
	fi
67
 
2184 richard 68
	if [ -z "$set_proto" ]
2006 raphael.pi 69
	then 
70
		set_proto="proto_0";
71
	fi
72
fi
73
 
74
if [ ${FILTER_ID:5:1} -eq '1' ] #HAVP_WL
75
then 
76
	set="havp_wl"
77
	if [ ${FILTER_ID:0:1} -eq '1' ]
78
	then 
79
		set_proto="proto_1";
80
	fi
81
 
82
	if [ ${FILTER_ID:1:1} -eq '1' ]
83
	then 
84
		set_proto="proto_2";
85
	fi
86
 
87
	if [ ${FILTER_ID:2:1} -eq '1' ]
88
	then 
89
		set_proto="proto_3";
90
	fi
91
 
2184 richard 92
	if [ -z "$set_proto" ]
2006 raphael.pi 93
	then 
94
		set_proto="proto_0";
95
	fi
96
fi
97
 
98
 
99
 
100
if [ -z "$set"  ] #NOT_FILTERED
101
then 
102
	set="not_filtered"
103
	if [ ${FILTER_ID:0:1} -eq '1' ]
104
	then 
105
		set_proto="proto_1";
106
	fi
107
 
108
	if [ ${FILTER_ID:1:1} -eq '1' ]
109
	then 
110
		set_proto="proto_2";
111
	fi
112
 
113
	if [ ${FILTER_ID:2:1} -eq '1' ]
114
	then 
115
		set_proto="proto_3";
116
	fi
117
 
2184 richard 118
	if [ -z "$set_proto" ]
2006 raphael.pi 119
	then 
120
		set_proto="proto_0";
121
	fi
122
fi
123
 
124
 
1364 richard 125
ipset del $set $FRAMED_IP_ADDRESS
2006 raphael.pi 126
ipset del $set_proto $FRAMED_IP_ADDRESS
2184 richard 127
 
128
# Debug : show all the coova parse variables (+ $set + $set_proto).
129
# see "/src/chilli.c" for the complete list of parse variables
130
#echo "-----------------------------------------------" >> /tmp/debug-condown.txt
131
#echo `date` >> /tmp/debug-condown.txt
132
#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
133
#do
134
#	echo "$i : ${!i}" >> /tmp/debug-condown.txt
135
#done
136
#echo "set : $set" >> /tmp/debug-condown.txt
137
#echo "set_proto : $set_proto" >> /tmp/debug-condown.txt