Commit Graph

292 Commits

Author SHA1 Message Date
Harald Welte 5255769504 Initial support for trunkdev
The 'trunkdev' is a virtual DAHDI device driver that exposes the
multiplexed E1 frames on a /dev/dahdi/trunkdev device.  This is useful
for all kinds of simulated setup, as well as in  the context of
using osmo-e1d for OCTOI (Osmocom TDMoIP).

In order for the dahdi_trunkdev utility to be built, you will need
to have installed dahdi header files of dahdi-linux with trunkdev
support, currently located at

Change-Id: Ie05100c80fd978e7ac6f5a028e0ef6c828e0bcc3
2023-07-29 17:49:17 +02:00
Harald Welte e9a4598c1f dahdi_pcap: Allow caller to specify network / user mode
A LAPD dissector (such as the one in wireshark) needs to know if
the local side is the user or the network in order to properly
decode/display the trace.  This is encoded in the sll_addr field
whose first octet indicates if the local (capturing) node serves
as the network or user side of ISDN.

Change-Id: Ief575bc4118fe5f20ef4b374d29eca442b04dabb
2022-02-21 21:20:59 +01:00
Harald Welte de9bd096c9 dahdi_pcap: Fix the use of the pkttype field
* pkttype is big-endian, so '3' is not valid, but htons(3)
* let's not use magic numbers but the actual #define PACKET_*
* differentiate PACKET_HOST (rx) from PACKET_OUTGOING (tx),
  which makes wireshark properly show rx/tx packets, allows coloring
  or filtering based on direction, etc.

Change-Id: I8c66a011a0fa0c5275bf3d5cf6b42064f02e28c0
2022-02-21 21:20:59 +01:00
Harald Welte 89b6df7593 dahdi_pcap: Fix LAPD pseudo header hardware address length
the 'halen' field is the length of the hardware address (8 bytes),
and not the length of the payload.

Change-Id: I72e009f40c8e9e295bc1e1f4a0951cd1236cdf43
2022-02-21 21:20:59 +01:00
Harald Welte 68395096f0 Fix compilation with gcc-10.2.0
/bin/sh ../libtool  --tag=CC   --mode=link gcc -I. -I./xtalk/include  -Wall  -g -O2 -lusb-1.0  -o astribank_tool astribank_tool-astribank_tool.o -lpthread -lm
libtool: link: gcc -I. -I./xtalk/include -Wall -g -O2 -o astribank_tool astribank_tool-astribank_tool.o  ./.libs/libastribank.a -lusb-1.0 -lpthread -lm
/usr/bin/ld: ./.libs/libastribank.a(libxtalk_la-xtalk_sync.o):/space/home/laforge/projects/git/dahdi-tools/xpp/xtalk/xtalk_sync.c:63: multiple definition of `members'; ./.libs/libastribank.a(libastribank_la-mpptalk.o):/space/home/laforge/projects/git/dahdi-tools/xpp/mpptalk.c:240: first defined here

Change-Id: I1d6f46874f74e1dfc70cabf7c4a8b8cdae9af4fa
2022-02-21 21:20:59 +01:00
Harald Welte 3b90fdbba1 add contrib/ for build verification
Change-Id: I47701be92476ba9adfdf9783747c6c511cec1903
2022-02-21 21:20:59 +01:00
Keith Morgan 31cca182bf Reported by Trent Creekmore
Changed the output to match the command needed for installing init scripts.
2018-09-20 17:54:03 +00:00
Tzafrir Cohen 75eedd6fa6 Ignore quilt .pc directory, used in deb packaging
Debian packaging uses quilt to manage patches. Book-keeping for them is
done using quilt (either directly, or in a compatible format), and
tracked in the directory .pc .

Signed-off-by: Tzafrir Cohen <>
2018-01-11 15:50:28 +02:00
Tzafrir Cohen b54ec6efd3 xpp: dahdi_registration: wait at end of assignments
Wait for assindments to end only after calling all of them.
Otherwise we are likely to get a timeout with multiple Astribanks.

Signed-off-by: Tzafrir Cohen <>
2017-12-24 18:02:29 +02:00
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
Oron Peled dc95a1164f dahdi_span_assignments: matched and unmatched
Add two new subcommands to dahdi_span_assignments:
* matched: list all spans that are in devices that have been registered
  and are matched by span_assignments.conf lines.
* unmatched: list all such existing spans that have not been matched
  by span_assignments.conf lines.
2017-08-31 18:56:33 +03:00
Tzafrir Cohen 9631938e90 dahdi_span_types: compare
This adds an extra subcommand: compare: shows span that have been
configured (in /etc/dahdi/span_types.conf) to a different value than
the one currently active on the system.

Signed-off-by: Tzafrir Cohen <>
2017-06-26 17:01:09 +03:00
Tzafrir Cohen 55679791b5 xpp_fxloader: Also look for udevadm in /bin
* udevadm is being moved to /bin. /sbin/udevadm will remain as a
  compatibility symlink.
* xpp_fxloader should also look for /bin/udevadm in addition to
  /sbin/udevadm and /sbin/udevsettle
* Reverse the order: look for newer ones first.

Signed-off-by: Tzafrir Cohen <>
2017-06-26 17:01:01 +03:00
Tzafrir Cohen ba09742a3f xpp: prevent dracut from loading Astribank drivers
Prevent an early load of the Astribank (xpp) drivers at initrd time, as
they require some files from the root filesystem.

This installs a file in the dracut configuration directory that will
take effect the next time dracut generates an initrd image.

This installs an configuration file for dracut which is ignored if
dracut is not installed and is a no-op if xpp_usb is not loaded on your

Signed-off-by: Tzafrir Cohen <>
2017-03-22 17:07:27 +02:00
Tzafrir Cohen e4197cc499 xpp: README: libusb1
Signed-off-by: Tzafrir Cohen <>
2017-03-21 18:46:05 +02:00
Tzafrir Cohen abd139ae91 xpp: README: hwid attribute of the xpd sysfs node
Signed-off-by: Tzafrir Cohen <>
2017-03-21 18:45:54 +02:00
Dima Stoliarov 6b2c6d72d8 xpp_fxloader: Also load PIC of FXS module type 6
Signed-off-by: Tzafrir Cohen <>
2017-03-21 13:42:35 +02: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 <>
2017-03-02 11:11:54 +02:00
Tzafrir Cohen 424157834d Don't install xtalk_send
xtalk_send is a helper tool for xtalk, a low-level libary used by some
Xorcom DAHDI userspace tools. It is hardly needed by most people.
2016-11-15 15:39:28 +02:00
Tzafrir Cohen 95d03118cb Typos. Mostly by Lintian
Signed-off-by: Tzafrir Cohen <>
2016-06-26 22:54:58 +02:00
Oron Peled 99e3c572d1 build fix: external CFLAGS are ignored
* When passing CFLAGS to ./configure, they are ignored.
* The reason is that in CFLAGS are clobbered.

Signed-off-by: Tzafrir Cohen <>
2016-03-13 14:05:46 +02:00
Tzafrir Cohen 6057ef25e9 xpp: perl man pages: Perl may be upper case
In file's output Perl scripts may be 'awk or perl script',
'/usr/bin/perl script' or 'Perl script' (with some minor variants). The
latter was not detected by current code and thus perld man pages were
not created.

Signed-off-by: Tzafrir Cohen <>
2016-02-17 17:40:54 +02:00
Oron Peled e1da7b5284 link libtonezone directly to libm
* Now we properly '-lm' to libtonezone itself.
  Tools that link with libtonezone get it automatically without having
  to individually link it.
  - dahdi_cfg historically needed -lm, but no longer does.

* Also use "autoscan" to refresh "":
  - Added missing tests
  - Move AC_CHECK_HEADERS() to their correct location (before testing
* Fixes the following (on Ubuntu-14.04):
      CCLD     dahdi_cfg
    ./.libs/ undefined reference to `sin'
    ./.libs/ undefined reference to `cos'
    ./.libs/ undefined reference to `pow'
    collect2: error: ld returned 1 exit status
    make[2]: *** [dahdi_cfg] Error 1

Signed-off-by: Tzafrir Cohen <>
2016-02-15 17:22:21 +02:00
Tzafrir Cohen f105a09eda Remove rcsid: Unused since move to Git
* While technically Git can support $ID keywords, in practice they are not
* GCC now give a warning about ''rcsid' defined but not used' for some
  of those.

Let's just remove the unused rcsid.
2016-02-15 17:22:21 +02:00
Oron Peled 212b247e68 xpp: move tools man-pages into PBX_USB conditional
* Otherwise, they pull compilation of xpp tools via implicit rules.
* This breaks build without libusb/libusbx
* To test this scenario:
    ./configure .... --without-libusb --without-libusbx

Signed-off-by: Oron Peled <>
Signed-off-by: Russ Meyerriecks <>
2015-12-22 11:24:52 -06:00
Oron Peled f225a5692c remove unused PKG_CONFIG_LIBUSB
Signed-off-by: Oron Peled <>
Signed-off-by: Russ Meyerriecks <>
2015-12-22 11:24:52 -06:00
Tzafrir Cohen cffc5158cc dahdi_cfg: -S has assumtions on system.conf order
dahdi_cfg's -S (apply only to a specific span) uses the array chan2span
to map channel numbers to span numbers.

The problem is that it assumes that channels first appear in system.conf
immediately after the span line of a specific span. Thus the following
configuration breaks it:


The best fix for that is to require -C to be used when -S is used (which
is already the case in our udev hooks).

Fixes DAHTOOL-69.

Signed-off-by: Tzafrir Cohen <>
2015-11-16 15:54:23 +02:00
Oron Peled 42850dba35 xpp: refactor manual pages out of conditionals
* So they are always included in 'make dist' even if PBX_USB is false.

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:06:25 +02:00
Oron Peled 06ae8473d7 xpp: Move astribank_license to libastribank
* So it's available to all utilities

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:06:06 +02:00
Oron Peled dbb5ba6db6 xpp: allow XTALK_OPTIONS from a file
* The file is defined as XTALK_OPTIONS_FILE (/etc/dahdi/xpp.conf):
  - Lines beginning with '#' are skipped.
  - Line beginning with "XTALK_OPTIONS" are used.
  - Anything after whitespaces (with optional "=" characters) is part
    of the value.

* An environment variable named "XTALK_OPTIONS" may override file contents.

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:05:44 +02:00
Oron Peled 2097f1adc5 xpp: now libusbx is the default
* Fallback to old libusb-0.1 if libusbx isn't found.
* Can force either: --{with,without}-{libusb,libusbx}

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:05:21 +02:00
Oron Peled d02361e99f xpp: strict compilation flags in oct612x/
Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:04:49 +02:00
Oron Peled 77a3d8b0a7 xpp: don't use USB "clear-halt" by default
* Problematic with USB3 controllers

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:04:41 +02:00
Oron Peled bd49fc9d95 xpp: xtalk -- no private status range
Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:04:13 +02:00
Oron Peled 0e6b068e89 xpp: migrate everything to libxtalk
* Build new libxtalk as local convenience library
 * Have new mpptalk.[ch] and astribank.[ch] wrap the new API
 * Modify all tools to use the new API

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:04:04 +02:00
Oron Peled 9c61e40187 xpp: add all base libxtalk files
* Do not remove yet the old ones.
* So new files are built, but not used yet.
* Build as a "noinst_" convenience library.
* Also, compile with '-Wno-unknown-pragmas' because we use some pragmas.

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:03:43 +02:00
Oron Peled 5ee15a2337 add libusb/libusbx support (for xpp)
* Use pkg-config
* For tight control have: --with-libusbx, --with-libusb
  - For now, we choose libusb (AKA libusb-0.1)
  - After committing support for libusbx (AKA libusb-1.0)
    we'll change the default.

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:00:54 +02:00
Oron Peled 01faf597d6 xpp: automake: cleanup $man_MANS handling
Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-11-05 18:00:14 +02:00
Tzafrir Cohen 48b25e849f xpp.rules: increase xpp_fxloader timeout to 180s
Allow firmware loading to take much longer (up to 180 seconds) before
it is killed. The default timeout is 30 seconds.

Signed-off-by: Tzafrir Cohen <>
2015-11-05 17:59:42 +02:00
Tzafrir Cohen d239b8dc4d ignore: dahdi_pcap and .version
.version is generated in the git tree.

Signed-off-by: Tzafrir Cohen <>
Acked-by: Russ Meyerriecks <>
2015-11-05 17:53:40 +02:00
Tzafrir Cohen 4676ad6671 make_version: cut off slashes in git
If we are based on a git tag with a name (such as 'upstream/2.10.2'),
remove everything up to the slash.

While we're at it, remove a leading '1%' that gets into the version
string as part of the version tag (a Debian version with an epoch: '1:'
is converted to '1%').

Signed-off-by: Tzafrir Cohen <>
Acked-by: Russ Meyerriecks <>
2015-11-05 17:53:25 +02:00
Tzafrir Cohen b471526700 Makefile: build asciidoc with TZ=UTC
In order to support a reproducable build, always run asciidoc with the
timezone UTC. This makes sure that the time shown in the file will be
the same, regardless of the location from which it is run.

Signed-off-by: Tzafrir Cohen <>
2015-11-02 10:27:08 +02:00
Russ Meyerriecks 855772135c wcb4xxp: Adds support for b43x/b23x products
Signed-off-by: Russ Meyerriecks <>
2015-10-26 16:51:50 -05:00
Oron Peled ec1ebffa89 xpp: bugfix: waitfor_xpds twinstar, auto_assign_spans
Exposed in twinstar setups where dahdi has auto_assign_spans=1:
* We start configuration with an empty /etc/dahdi/xpp_order
* If "XPP_HOTPLUG_DAHDI=yes", the astribank_hook removes
  the asterisk_is_starting semaphore too early.
* There's no point in waiting for non-existant or empty /etc/dahdi/xpp_order

Signed-off-by: Oron Peled <>
Signed-off-by: Tzafrir Cohen <>
2015-07-19 13:15:01 +03:00
Tzafrir Cohen 9afcde3f1e README: document the need for autoreconf
Signed-off-by: Tzafrir Cohen <>
2015-06-27 01:56:02 +03:00
Russ Meyerriecks 9a181ccfbc xpp: Fix a logical not being applied to the wrong operand
gcc 5 found this with the new -Werror=logical-not-parenthesis warning. Since we
have -Wall by default, it would also fail the compile.

Internal-Issue-ID: DAHLIN-347

Signed-off-by: Russ Meyerriecks <>
Acked-by: Shaun Ruffell <>
2015-06-22 13:45:54 -05:00
Tzafrir Cohen 10c1cd196e Force-link on make install
Use ln -sf to create on the install target

Signed-off-by: Tzafrir Cohen <>
2015-06-14 16:29:30 +03:00
Tzafrir Cohen 65ba28fe4a A placeholder for the m4 directory
The m4/ directory needs to exist
2015-06-02 14:41:34 +03:00
Oron Peled 66e2c3ba11
autotools: now "make distcheck" also works.
* Fix distcheck by having all the targets installed under $prefix
* But by default (no prefix or prefix=/usr), revert to older pathes:
  - /etc/dahdi
  - udev rules in /etc/udev/rules.d
  - perl in perl sitelib
  - man pages in /usr/share/man
* Add configure options:
  --with-udevrules= (e.g.: /lib/udev/rules.d)
  --with-perllib= (e.g.: `perl -V:vendorlib)

Signed-off-by: Tzafrir Cohen <>
2015-05-26 13:57:36 +03:00
Oron Peled 94ca4a1bb4
automake: remove unused stuff from Makefile.legacy
Signed-off-by: Tzafrir Cohen <>
2015-05-26 12:19:35 +03:00