Subversion Repositories ALCASAR

Rev

Rev 2184 | Rev 2249 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

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