From: Oron Peled <[email protected]>

* On some systems/configurations, dahdi init script may kick in
  during the time that hotplug scripts are configuring spans.

* It may lead to a race since the init script runs "dahdi_auto_assign_compat"
  which calls "dahdi_registration" and that tries to run
  "dahdi_span_assignments auto ..."

* Use the newly-added "dahdi_span_assignments" "unmatched" operation.

* Now the "dahdi_auto_assign_compat" script only runs "dahdi_registration"
  if there are no "unmatched" Astribanks.

* This prevents the race in fully configured systems.
  The race may still exist on partially-configured systems.
---
 hotplug/dahdi_auto_assign_compat | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hotplug/dahdi_auto_assign_compat b/hotplug/dahdi_auto_assign_compat
index 96f90dd..23fa5a8 100755
--- a/hotplug/dahdi_auto_assign_compat
+++ b/hotplug/dahdi_auto_assign_compat
@@ -22,4 +22,9 @@ devices_by_registration_time | \
        done
 
 # Now handle Astribanks
-LC_ALL=C dahdi_registration -Rv on
+unmatched="`dahdi_span_assignments unmatched`"
+if [ -n "$unmatched" ]; then
+       # Only if astribanks are not matched in span-assignments.conf
+       # TODO: have dahdi_registration run only on "$unmatched"
+       LC_ALL=C dahdi_registration -Rv on
+fi
-- 
2.11.0


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to