blob: 0979e4a68e212750b9b24486ed862b6914431ea8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
#
# Module: vyatta-clear-conntrack
#
# **** License ****
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program 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.
#
# This code was originally developed by Vyatta, Inc.
# Portions created by Vyatta are Copyright (C) 2006-2009 Vyatta, Inc.
# All Rights Reserved.
#
# Author: Mohit Mehta
# Date: February 2010
# Description: Script to flush all conntrack entries
#
# **** End License ****
#
# picked up from install-system script
get_response () {
ldefault=$(echo "$1" | tr [:upper:] [:lower:])
loptions=$(echo "$2" | tr [:upper:] [:lower:])
# get the response from the user
read myresponse
myresponse=$(echo "$myresponse" | tr [:upper:] [:lower:])
# Check to see if the user accepts the default
if [ -z "$myresponse" ]; then
echo -n $ldefault
# if we are passing in options to check, make sure response is a valid option
elif [ -n "$loptions" ]; then
for token in $loptions
do
if [ "$token" == "$myresponse" ]; then
echo -n "$myresponse"
return 0
fi
done
return 1
else
echo -n "$myresponse"
fi
return 0
}
response=''
while [ -z "$response" ]
do
if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ]; then
response="y"
else
echo -ne "\nThis will clear all currently tracked and expected connections. Continue? (Y/N) [N]: "
response=$(get_response "N" "Y N")
fi
if [ "$response" == "n" ]; then
exit 1
else
sudo /usr/sbin/conntrack -F >&/dev/null
sudo /usr/sbin/conntrack -F expect >&/dev/null
fi
done
|