Project

General

Profile

Download (1.55 KB) Statistics
| Branch: | Tag: | Revision:
1 7a012bff Renato Botelho
#!/bin/sh
2
#
3
# rc.gateway_alarm
4
#
5 38809d47 Renato Botelho do Couto
# Copyright (c) 2015-2016 Electric Sheep Fencing
6 a68f7a3d Luiz Otavio O Souza
# Copyright (c) 2015-2024 Rubicon Communications, LLC (Netgate)
7 f83416bd Renato Botelho do Couto
# All rights reserved.
8 7a012bff Renato Botelho
#
9 b12ea3fb Renato Botelho
# 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 7a012bff Renato Botelho
#
13 b12ea3fb Renato Botelho
# http://www.apache.org/licenses/LICENSE-2.0
14 7a012bff Renato Botelho
#
15 b12ea3fb Renato Botelho
# 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 7a012bff Renato Botelho
21
GW="$1"
22 48196bf0 PiBa-NL
alarm_addr="$2"
23
alarm_flag="$3"
24
alarm_rtt="$4"
25
alarm_rttsd="$5"
26
alarm_loss="$6"
27 7a012bff Renato Botelho
28
if [ -z "$GW" ]; then
29
	exit 1
30
fi
31
32 37be6b26 Stephen Jones
print_rtt() {
33 21daa13e Stephen Jones
	usec=$1
34
	usec_to_ms=$( echo "scale=3; ${usec}/1000" | bc -l )
35
	echo "${usec_to_ms}ms"
36 37be6b26 Stephen Jones
}
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 48196bf0 PiBa-NL
40 7a012bff Renato Botelho
/usr/local/sbin/pfSctl \
41
	-c "service reload dyndns ${GW}" \
42 8558539a Viktor G
	-c "service reload ipsec ${GW}" \
43 7a012bff Renato Botelho
	-c "service reload openvpn ${GW}" \
44
	-c "filter reload" >/dev/null 2>&1
45
46 48196bf0 PiBa-NL
# after above signal the check_reload_status process calls the following scripts simultaneously.:
47
# - "/etc/rc.dyndns.update", "dyndns=%s"
48 8558539a Viktor G
# - "/etc/rc.ipsec", "interface=%s"
49 48196bf0 PiBa-NL
# - "/etc/rc.openvpn", "interface=%s"
50
# - "/etc/rc.filter_configure_sync"
51
52 7a012bff Renato Botelho
exit $?