Commit Graph

12 Commits

Author SHA1 Message Date
Oron Peled 754d981621 Avoid a race between /etc/init.d/dahdi and hotplug scripts:
* 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.
2017-08-31 19:00:02 +03:00
Tzafrir Cohen f64500c986 xpp: run xpp_sync when an Astribank is connected
This was originally done in the init script after all Astribanks were
connected. But now there is no single point in the startup sequence
where we can guarantee all of them were loaded.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-02 11:11:54 +02:00
Oron Peled af920cd079
automake: bugfix: fix installation paths
* Install to $datadir/dahdi and not $datadir/dahdi-tools
* Install to $includedir/dahdi and not $includedir/dahdi-tools

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-05-26 12:18:30 +03:00
Oron Peled 0090086bce automake: handle "make dist"
* "make distcheck" still fails

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-05-19 19:54:11 +03:00
Oron Peled 1292ea9078 registration-order: Added dahdi_auto_assign_compat
Maintains the original registration order as was before span
assignments. Should allow seemless trannsition to
dahdi.auto_assign_spans=0

* The idea:
  - We stop handling in udev the case of missing
    /etc/dahdi/assigned-spans.conf
  - Instead we rely on "registration_time" dahdi_device attribute from
    DAHDI-linux
  - Then, we can sort the devices and assign their spans in
    /etc/init.d/dahdi
* Mechanics:
  - From /etc/init.d/dahdi, we run a new 'dahdi_auto_assign_compat'
    script (after "waitfor_xpds" etc.)
  - In this script we "auto" assign spans of non-Astribank devices
  - In the end of the script we run "dahdi_registration" which
    does the same for Astribank devices.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-03-25 14:51:29 +02:00
Oron Peled cfee27106b hotplug: call handle_device.d/ actions for remove
* Original actions didn't care about remove (10-span-types, 20-span-assignments)
* But others need to know about removals too.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-03-25 14:48:09 +02:00
Tzafrir Cohen dd752529f0 auto_assign_spans may be true even if not '1'
auto_assign_spans is an int and may have legal values other than 1. It
is legal (though pointless) to use: modprobe dahdi auto_assign_spans=3.
Any value != 0 is true.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-02-07 14:22:49 +02:00
Shaun Ruffell 27d07446ef hotplug: Check for auto_assign_spans only when ACTION is add.
Removes a potentially confusing error message. This is a reapplication of
(4f259cd569 "dahdi_handle_device, dahdi_span_config: Check for
auto_assign_spans only when ACTION is add.") which appears to have been
accidentally removed when moving the hotplug scripts into a subdirectory.

From the original commit:

When dahdi.ko is unloaded, it may be possible for the driver to be removed from
the kernel before the udev scripts are run.  When this happens, you'll see
messages like the following which are not accurate:

    'dahdi_handle_device'[24567]: Old driver (no auto_assign_spans parameter). Skip /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0

Now instead you will see:

    'dahdi_handle_device'[28008]: remove: /devices/pci0000:00/0000:00:1e.0/0000:11:01.0/pci:0000:11:01.0

Also, all the udev events will be logged in the system log even when they are
ignored because of legacy auto span assignment. This will help show what is
going on during the transition period to full udev configuration of spans.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2014-01-31 16:08:21 -06:00
Shaun Ruffell 8e2a5def27 hotplug: Do not run auto span configuration if spans are auto assigned.
This reapplies the change made in commit (6ed0adc08 "dahdi_span_config: Do not run auto
span configuration if spans are auto assigned.") which appears to have been
accidentally removed in (7f826a7d35 "hotplug modularization: split logic to
scriptlets").

To rationale from commit 6ed0adc08:

I have seen cases were users run:

  # modprobe <driver>; dahdi_cfg -c <custom config file>

and the spans end up misconfigured because dahdi_span_assignments ends up
running, via udev, after the user configured the span the way it wanted.

dahdi_span_assignments now looks at auto_assign_spans module parameter on
dahdi.ko, like dahdi_handle_device already does, to determine if legacy or udev
based configuration is being done.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-01-31 11:16:08 -06:00
Tzafrir Cohen d1fb614ac8 hotplug: document asterisk scriptlet
A well-behaving distribution may choose not to install
span_config.d/50-asterisk as part of dahdi-tools, as it belongs in
asterisk. Still, it would be nice to be able to keep it as a documented
usage example. So just writ where this file needs to go and what it
does.

No other change: it is still installed by default.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-01-28 11:32:31 +02:00
Oron Peled 7f826a7d35 hotplug modularization: split logic to scriptlets
* Device related operations are ordered in /usr/share/dahdi/handle_device.d/
* Span related operations are ordered in /usr/share/dahdi/span_config.d/
* In the future, span_config.d/50-asterisk should be moved to Asterisk.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 12:35:59 +02:00
Oron Peled cdedf024ae hotplug modularization: move sources to a subdir
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-23 12:35:59 +02:00