[Pkg-voip-commits] [dahdi-tools] 186/285: xpp: dahdi_registration: force re-assignment

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit ffe36c63e0e2af7d92ef26a36a7151f97c972ea6
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun Mar 30 21:38:52 2014 +0300

    xpp: dahdi_registration: force re-assignment
    
    * The system state causing the bug:
      - DAHDI has auto_assign_spans==1
      - No /etc/dahdi/assigned-spans.conf
    
    * The bug scenario:
      - During initial device detection, they are assigned by
        DAHDI driver.
      - Later we run "dahdi_span_assignment remove"
      - Then, a "dahdi_registration on" would not assign any span.
    
    * The fix:
      - Using the '-R' option, force "dahdi_registration on" to also
        do "dahdi_span_assignment auto" on relevant devices.
      - This is the way it's called by /usr/share/dahdi/dahdi_auto_assign_compat
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Acked-by: Shaun Ruffell <sruffell at digium.com>
---
 xpp/dahdi_registration | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xpp/dahdi_registration b/xpp/dahdi_registration
index 32bd746..7202e76 100755
--- a/xpp/dahdi_registration
+++ b/xpp/dahdi_registration
@@ -41,6 +41,11 @@ my $span_types_config = $ENV{'SPAN_TYPES_CONF_FILE'} || '/etc/dahdi/span-types.c
 my $have_assigned_spans_config = -f $assigned_spans_config || 0;
 my $have_span_types_config = -f $span_types_config || 0;
 
+# Spans will be auto-assigned by default if either:
+# - Driver $auto_assign_spans them or
+# - Udev script see that we $have_span_types_config and it "add" them
+my $default_auto_assign = $auto_assign_spans || $have_assigned_spans_config;
+
 my $sorter;
 my $sort_order = $opts{'s'};
 if(defined $sort_order) {
@@ -100,11 +105,14 @@ foreach my $xbus (Dahdi::Xpp::xbuses($sorter)) {
 		}
 		myprintf "%3s ==> %3s\n", state2str($prev), state2str($on);
 	}
-	if (defined($on) && $on && ! $have_assigned_spans_config && ! $auto_assign_spans) {
+	next unless defined($on) && $on;
+	# Only assign if no default assignment, or forced by '-R' option
+	if ($opts{'R'} || ! $default_auto_assign) {
 		# Emulate /etc/dahdi/assigned-spans.conf:
 		#   - We iterate over $xbus according to /etc/dahdi/xpp_order
 		#   - We "auto" assign all spans of current $xbus
 		my $devpath = sprintf "/sys/bus/dahdi_devices/devices/astribanks:xbus-%02d", $xbus->num;
+		myprintf "auto-assign $devpath\n";
 		my @cmd = ('dahdi_span_assignments', 'auto', $devpath);
 		system @cmd;
 		warn "Failed '@cmd' (status=$?)\n" if $?;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list