Project

General

Profile

Download (1.55 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# rc.gateway_alarm
4
#
5
# Copyright (c) 2015-2016 Electric Sheep Fencing
6
# Copyright (c) 2015-2022 Rubicon Communications, LLC (Netgate)
7
# All rights reserved.
8
#
9
# Licensed under the Apache License, Version 2.0 (the "License");
10
# you may not use this file except in compliance with the License.
11
# You may obtain a copy of the License at
12
#
13
# http://www.apache.org/licenses/LICENSE-2.0
14
#
15
# Unless required by applicable law or agreed to in writing, software
16
# distributed under the License is distributed on an "AS IS" BASIS,
17
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
# See the License for the specific language governing permissions and
19
# limitations under the License.
20

    
21
GW="$1"
22
alarm_addr="$2"
23
alarm_flag="$3"
24
alarm_rtt="$4"
25
alarm_rttsd="$5"
26
alarm_loss="$6"
27

    
28
if [ -z "$GW" ]; then
29
	exit 1
30
fi
31

    
32
print_rtt() {
33
	usec=$1
34
	usec_to_ms=$( echo "scale=3; ${usec}/1000" | bc -l )
35
	echo "${usec_to_ms}ms"
36
}
37

    
38
echo ">>> Gateway alarm: ${GW} (Addr:${alarm_addr} Alarm:${alarm_flag} RTT:$( print_rtt ${alarm_rtt} ) RTTsd:$( print_rtt ${alarm_rttsd} ) Loss:${alarm_loss}%)" | /usr/bin/logger -p daemon.info -i -t rc.gateway_alarm
39

    
40
/usr/local/sbin/pfSctl \
41
	-c "service reload dyndns ${GW}" \
42
	-c "service reload ipsec ${GW}" \
43
	-c "service reload openvpn ${GW}" \
44
	-c "filter reload" >/dev/null 2>&1
45

    
46
# after above signal the check_reload_status process calls the following scripts simultaneously.:
47
# - "/etc/rc.dyndns.update", "dyndns=%s"
48
# - "/etc/rc.ipsec", "interface=%s"
49
# - "/etc/rc.openvpn", "interface=%s"
50
# - "/etc/rc.filter_configure_sync"
51

    
52
exit $?
(37-37/85)