siproxd: use standard interface names by default
authorguidosarducci <guidosarducci@users.noreply.github.com>
Sun, 18 Jun 2017 23:04:15 +0000 (16:04 -0700)
committerguidosarducci <guidosarducci@users.noreply.github.com>
Tue, 20 Jun 2017 10:18:27 +0000 (03:18 -0700)
Support using standard interface names and make "lan"/"wan" the defaults
for inbound/outbound SIP traffic. This change makes siproxd more portable
but preserves backwards compatibility for upgrades.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
net/siproxd/files/siproxd.config
net/siproxd/files/siproxd.init

index b65148c7edb4cb69a8cda94ceea4e1fc134cd4e3..be953eb854a2072595bad3c29e88c8485f6b2878 100644 (file)
@@ -1,3 +1,3 @@
 config siproxd general
-       option if_inbound       lan
-       option if_outbound      wan
+       option interface_inbound lan
+       option interface_outbound wan
index 1ad6e0fa4ca454e03e478767094194fbf38f1c84..0dbdeb0a6bf442aed540091e0be5d0bbfbee7c07 100644 (file)
@@ -18,9 +18,22 @@ deal_with_lists () {
 
 start_instance() {
        local cfg="$1"
+       local _int_inbound
+       local _int_outbound
+       local _dev_inbound
+       local _dev_outbound
+
+       config_get _int_inbound "$cfg" interface_inbound
+       config_get _int_outbound "$cfg" interface_outbound
+
+       scan_interfaces
+       network_get_physdev _dev_inbound $_int_inbound
+       network_get_physdev _dev_outbound $_int_outbound
+
+       config_load 'siproxd'
+       config_get if_inbound "$cfg" if_inbound $_dev_inbound
+       config_get if_outbound "$cfg" if_outbound $_dev_outbound
 
-       config_get if_inbound "$cfg" if_inbound
-       config_get if_outbound "$cfg" if_outbound
        config_get host_outbound "$cfg" host_outbound
        config_get hosts_allow_reg "$cfg" hosts_allow_reg
        config_get hosts_allow_sip "$cfg" hosts_allow_sip
@@ -225,6 +238,8 @@ start() {
                chown nobody:nogroup "$siproxd_pid_dir"
        }
 
+       include /lib/network
+       . /lib/functions/network.sh
        config_load 'siproxd'
        config_foreach start_instance 'siproxd'
 }