1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add option to enable/disable SIP ALG

This commit is contained in:
Ycarus (Yannick Chabanois) 2022-05-18 21:06:09 +02:00
parent b174b3ba3e
commit eedbfc56b7
4 changed files with 42 additions and 0 deletions

View file

@ -843,6 +843,19 @@ _set_vpn_ip() {
fi
}
_set_sipalg() {
local settings
sipalg="$(uci -q get openmptcprouter.settings.sipalg)"
if [ "$sipalg" = "1" ]; then
sipalg="true"
else
sipalg="false"
fi
settings='{"enable" : "'$sipalg'"}'
result=$(_set_json "sipalg" "$settings")
}
_delete_client2client() {
if [ -n "$(echo $1 | grep omr_client2client)" ]; then
uci -q delete network.$1
@ -1882,6 +1895,7 @@ _config_service() {
lanips=""
config_foreach _get_lan_ip interface
_set_lan_ip
_set_sipalg
config_foreach _delete_client2client route
if [ "$(uci -q get openmptcprouter.settings.vpn)" != "openvpn" ] && [ "$(echo "$vps_config" | jsonfilter -q -e '@.client2client.enabled')" == "true" ]; then
_set_client2client

View file

@ -240,6 +240,15 @@ uci -q batch <<-EOF >/dev/null
set firewall.@include[0].reload='1'
commit firewall
EOF
if [ "$(uci -q get openmptcprouter.settings.sipalg)" != "1" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.zone_lan.auto_helper='0'
set firewall.zone_wan.auto_helper='0'
commit firewall
EOF
rmmod nf_nat_sip 2>&1 >/dev/null
rmmod nf_conntrack_sip 2>&1 >/dev/null
fi
rm -f /tmp/luci-indexcache