summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/firewall/conntrack-options/sip/node.def30
-rw-r--r--templates/firewall/conntrack-options/sip/port/node.def10
2 files changed, 36 insertions, 4 deletions
diff --git a/templates/firewall/conntrack-options/sip/node.def b/templates/firewall/conntrack-options/sip/node.def
index 494d75c..38add57 100644
--- a/templates/firewall/conntrack-options/sip/node.def
+++ b/templates/firewall/conntrack-options/sip/node.def
@@ -1,4 +1,5 @@
help: Set SIP conntrack options
+
end: reload=0
sdm=2
if [ -f /sys/module/nf_conntrack_sip/parameters/sip_direct_media ]; then
@@ -22,13 +23,34 @@ end: reload=0
if [ $sds -eq 0 ]; then reload=1; fi
fi
- options=$(grep -s "options nf_conntrack_sip $indirect-media $indirect-signalling" /etc/modprobe.d/options)
- if [ -z "$options" ] && [ -f /etc/modprobe.d/options ]; then
+ 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
+ portopt="ports=$portval"
+ if [ $numports -gt 8 ]; then
+ echo "Error: Can not specify more than 8 ports."
+ exit 1
+ fi
+ 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" ]; then
- sudo sh -c "echo options nf_conntrack_sip $indirectmedia $indirectsignalling >> /etc/modprobe.d/options "
+ if [ -n "$indirectmedia" ] || [ -n "$indirectsignalling" ] || \
+ [ -n "$portopt" ]; then
+ sudo sh -c "echo \# Auto-generated by `whoami` at `date` > /etc/modprobe.d/vyatta_sip_options"
+ sudo sh -c "echo options nf_conntrack_sip $indirectmedia $indirectsignalling $portopt >> /etc/modprobe.d/vyatta_sip_options "
+ else
+ sudo rm -f /etc/modprobe.d/vyatta_sip_options
fi
if [ $reload -eq 1 ]; then
diff --git a/templates/firewall/conntrack-options/sip/port/node.def b/templates/firewall/conntrack-options/sip/port/node.def
new file mode 100644
index 0000000..ef09321
--- /dev/null
+++ b/templates/firewall/conntrack-options/sip/port/node.def
@@ -0,0 +1,10 @@
+multi:
+
+help: Set port number that SIP traffic is carried on
+
+comp_help: Possible completions:
+ 1 - 65535\tSIP port number
+
+type: u32
+
+syntax:expression: ($VAR(@) >= 1 && $VAR(@) <=65535) ; "Port number must be in range 1 to 65535"