blob: 320fb71f63e37cd40ac26af9a3e95353c4d587a3 (
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
71
72
73
74
75
|
help: SIP connection tracking settings
end: /bin/cli-shell-api exists system conntrack modules sip disable && exit 0
reload=0
sdm=2
defaultport=5060
portopt="ports="
portval=""
portpath="system conntrack modules sip port"
if [ -f /sys/module/nf_conntrack_sip/parameters/sip_direct_media ]; then
sdm=$(sudo cat /sys/module/nf_conntrack_sip/parameters/sip_direct_media)
fi
if [ -n "$VAR(./enable-indirect-media)" ]; then
indirectmedia='sip_direct_media=0'
if [ $sdm -ge 1 ]; then reload=1; fi
else
if [ $sdm -eq 0 ]; then reload=1; fi
fi
sds=2
if [ -f /sys/module/nf_conntrack_sip/parameters/sip_direct_signalling ]; then
sds=$(sudo cat /sys/module/nf_conntrack_sip/parameters/sip_direct_signalling)
fi
if [ -n "$VAR(./enable-indirect-signalling)" ]; then
indirectsignalling='sip_direct_signalling=0'
if [ $sds -ge 1 ]; then reload=1; fi
else
if [ $sds -eq 0 ]; then reload=1; fi
fi
if [ -n "$VAR(./port/@@)" ]; then
numports=0
for port in $VAR(./port/@@); do
if [ -z "$portval" ]; then
portval=$port
else
portval="${portval},$port"
fi
(( numports++ ))
done
if [ $numports -gt 8 ]; then
echo "Error: Can not specify more than 8 ports."
exit 1
fi
fi
if [ "$portval" != "" ]; then
portopt="${portopt}$portval"
else
portopt="${portopt}$defaultport"
fi
if [ "`cli-shell-api returnValues $portpath`" != "`cli-shell-api returnEffectiveValues $portpath`" ]; then
reload=1
fi
if [ -f /etc/modprobe.d/options ]; then
sudo sed -i '/nf_conntrack_sip/d' /etc/modprobe.d/options
fi
if [ -n "$indirectmedia" ] || [ -n "$indirectsignalling" ] || \
[ -n "$portopt" ]; then
sudo sh -c "echo \# Auto-generated by `whoami` at `date` > /etc/modprobe.d/vyatta_sip_options.conf"
sudo sh -c "echo options nf_conntrack_sip $indirectmedia $indirectsignalling $portopt >> /etc/modprobe.d/vyatta_sip_options.conf "
else
sudo rm -f /etc/modprobe.d/vyatta_sip_options.conf
fi
if [ $reload -eq 1 ]; then
sudo modprobe -r nf_nat_sip nf_conntrack_sip
sudo modprobe nf_conntrack_sip
sudo modprobe nf_nat_sip
fi
|