-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathudm-sarp.sh
executable file
·46 lines (34 loc) · 1.21 KB
/
udm-sarp.sh
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
#!/bin/bash
######################################################################################
#
# Description:
# ------------
# Set static ARP entries defined in UDM Pro ARP table.
#
######################################################################################
######################################################################################
#
# Configuration
#
# directory with sarp config files. All *.conf files in the directory will be considered
# as valid static arp entries.
conf_dir="/data/custom/sarp/"
#
# No further changes should be necessary beyond this line.
#
######################################################################################
# set scriptname
me=$(basename $0)
echo "$(dirname $0)/${me%.*}.conf"
# include local configuration if available
[ -e "$(dirname $0)/${me%.*}.conf" ] && source "$(dirname $0)/${me%.*}.conf"
for conf_file in ${conf_dir}/*.conf; do
if [ $(basename $conf_file) != "${me%.*}.conf" ]; then
while read a; do
[[ $a =~ ^#.* ]] && continue
arp -s $a &&
logger "$me: added static arp entry: ${a}" ||
logger "$me: failed to add arp entry: ${a}"
done <$conf_file
fi
done