Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-11-07 08:06:02 +04:00 committed by GitHub
commit c1e7ac7826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 384 additions and 870 deletions

View file

@ -9,12 +9,13 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=dahdi-linux PKG_NAME:=dahdi-linux
PKG_VERSION:=3.1.0 PKG_RELEASE:=1
PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/dahdi-linux/releases PKG_SOURCE_URL:=https://github.com/asterisk/dahdi-linux.git
PKG_HASH:=db5b758437d066a7edad34b54313f08a4ccdde28373492986b72c798e8561b4d PKG_SOURCE_DATE=2023-09-21
PKG_SOURCE_VERSION:=1bb9088f2baff8c4e3fec536044cc48072cf9905
PKG_MIRROR_HASH:=b32eb405d64c981f64922840f616cf362636ccc93506986c0b92bd4dcca5ab30
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE

View file

@ -1,6 +1,6 @@
--- a/drivers/dahdi/Kbuild --- a/drivers/dahdi/Kbuild
+++ b/drivers/dahdi/Kbuild +++ b/drivers/dahdi/Kbuild
@@ -54,9 +54,8 @@ obj-m += $(DAHDI_MODULES_EXTRA) @@ -64,9 +64,8 @@ obj-m += $(DAHDI_MODULES_EXTRA)
# If you want to build OSLEC, include the code in the standard location: # If you want to build OSLEC, include the code in the standard location:
# drivers/staging/echo . The DAHDI OSLEC echo canceller will be built as # drivers/staging/echo . The DAHDI OSLEC echo canceller will be built as
# well: # well:

View file

@ -6,11 +6,11 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE13XP) += wcte13xp.o obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE13XP) += wcte13xp.o
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_HFCS) += hfcs/ +obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_HFCS) += hfcs/
wcte13xp-objs := wcte13xp-base.o wcxb_spi.o wcxb.o wcxb_flash.o ifndef HOTPLUG_FIRMWARE
CFLAGS_wcte13xp-base.o += -I$(src)/oct612x -I$(src)/oct612x/include -I$(src)/oct612x/octdeviceapi -I$(src)/oct612x/octdeviceapi/oct6100api ifneq (,$(filter y m,$(CONFIG_FW_LOADER)))
--- a/drivers/dahdi/Kconfig --- a/drivers/dahdi/Kconfig
+++ b/drivers/dahdi/Kconfig +++ b/drivers/dahdi/Kconfig
@@ -223,4 +223,14 @@ config DAHDI_DYNAMIC_LOC @@ -235,4 +235,14 @@ config DAHDI_DYNAMIC_LOC
If unsure, say Y. If unsure, say Y.

View file

@ -1,13 +0,0 @@
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -59,8 +59,10 @@
#include <linux/poll.h>
#ifdef CONFIG_PCI
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
#include <linux/pci-aspm.h>
#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
#define HAVE_NET_DEVICE_OPS

View file

@ -8,7 +8,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
@@ -1754,11 +1755,13 @@ out: @@ -1768,11 +1769,13 @@ out:
static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q) static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
{ {
@ -127,7 +127,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#include <asm/uaccess.h> #include <asm/uaccess.h>
#else #else
@@ -886,7 +887,7 @@ static void xpp_send_callback(struct urb @@ -891,7 +892,7 @@ static void xpp_send_callback(struct urb
usec = 0; /* System clock jumped */ usec = 0; /* System clock jumped */
if (usec > xusb->max_tx_delay) if (usec > xusb->max_tx_delay)
xusb->max_tx_delay = usec; xusb->max_tx_delay = usec;

View file

@ -1,478 +0,0 @@
From 34b9c77c9ab2794d4e912461e4c1080c4b1f6184 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Sun, 23 Feb 2020 19:39:24 -0600
Subject: [PATCH 05/12] Use proc_ops on kernels >= 5.6
In commit (d56c0d45f0e27 "proc: decouple proc from VFS with "struct proc_ops"")
[1], proc_create_data no longer takes a file_operations structure, but instead
takes a struct proc_ops in order to conserve memory in the kernel.
This change is necessary for DAHDI to work with kernels >= 5.6
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d56c0d45f0e27f814e87a1676b6bd
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 9 +++++
drivers/dahdi/dahdi_dynamic_ethmf.c | 18 +++++++--
drivers/dahdi/xpp/card_bri.c | 23 ++++++++---
drivers/dahdi/xpp/card_fxo.c | 25 +++++++++---
drivers/dahdi/xpp/card_fxs.c | 35 +++++++++++++---
drivers/dahdi/xpp/xbus-core.c | 62 ++++++++++++++++++++++++-----
drivers/dahdi/xpp/xpp_dahdi.c | 23 ++++++++---
drivers/dahdi/xpp/xpp_usb.c | 26 +++++++++---
include/dahdi/kernel.h | 11 +++--
9 files changed, 187 insertions(+), 45 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -1015,6 +1015,14 @@ static int dahdi_proc_open(struct inode
return single_open(file, dahdi_seq_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops dahdi_proc_ops = {
+ .proc_open = dahdi_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations dahdi_proc_ops = {
.owner = THIS_MODULE,
.open = dahdi_proc_open,
@@ -1022,6 +1030,7 @@ static const struct file_operations dahd
.llseek = seq_lseek,
.release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -733,12 +733,22 @@ static int ztdethmf_proc_open(struct ino
return single_open(file, ztdethmf_proc_show, NULL);
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops ztdethmf_proc_fops = {
+ .proc_open = ztdethmf_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+};
+#else
static const struct file_operations ztdethmf_proc_fops = {
- .open = ztdethmf_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
+ .owner = THIS_MODULE,
+ .open = ztdethmf_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int __init ztdethmf_init(void)
--- a/drivers/dahdi/xpp/card_bri.c
+++ b/drivers/dahdi/xpp/card_bri.c
@@ -153,8 +153,12 @@ static int write_state_register(xpd_t *x
static bool bri_packet_is_valid(xpacket_t *pack);
static void bri_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_bri_info_ops;
+#else
static const struct file_operations proc_bri_info_ops;
#endif
+#endif
static int bri_spanconfig(struct file *file, struct dahdi_span *span,
struct dahdi_lineconfig *lc);
static int bri_chanconfig(struct file *file, struct dahdi_chan *chan,
@@ -1740,13 +1744,22 @@ static int proc_bri_info_open(struct ino
return single_open(file, proc_bri_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_bri_info_ops = {
+ .proc_open = proc_bri_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_bri_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_bri_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_bri_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int bri_xpd_probe(struct device *dev)
--- a/drivers/dahdi/xpp/card_fxo.c
+++ b/drivers/dahdi/xpp/card_fxo.c
@@ -107,9 +107,13 @@ enum fxo_leds {
static bool fxo_packet_is_valid(xpacket_t *pack);
static void fxo_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxo_info_ops;
+#else
static const struct file_operations proc_fxo_info_ops;
+#endif
#ifdef WITH_METERING
-static const struct file_operations proc_xpd_metering_ops;
+static const struct proc_ops proc_xpd_metering_ops;
#endif
#endif
static void dahdi_report_battery(xpd_t *xpd, lineno_t chan);
@@ -1484,13 +1488,22 @@ static int proc_fxo_info_open(struct ino
return single_open(file, proc_fxo_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxo_info_ops = {
+ .proc_open = proc_fxo_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_fxo_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_fxo_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_fxo_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#ifdef WITH_METERING
static int proc_xpd_metering_show(struct seq_file *sfile, void *not_used)
--- a/drivers/dahdi/xpp/card_fxs.c
+++ b/drivers/dahdi/xpp/card_fxs.c
@@ -160,11 +160,19 @@ enum neon_state {
static bool fxs_packet_is_valid(xpacket_t *pack);
static void fxs_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxs_info_ops;
+#else
static const struct file_operations proc_fxs_info_ops;
+#endif
#ifdef WITH_METERING
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xpd_metering_ops;
+#else
static const struct file_operations proc_xpd_metering_ops;
#endif
#endif
+#endif
static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos);
#define PROC_FXS_INFO_FNAME "fxs_info"
@@ -2115,13 +2123,22 @@ static int proc_fxs_info_open(struct ino
return single_open(file, proc_fxs_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxs_info_ops = {
+ .proc_open = proc_fxs_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_fxs_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_fxs_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_fxs_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#ifdef WITH_METERING
static ssize_t proc_xpd_metering_write(struct file *file,
@@ -2165,12 +2182,20 @@ static int proc_xpd_metering_open(struct
file->private_data = PDE_DATA(inode);
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xpd_metering_ops = {
+ .proc_open = proc_xpd_metering_open,
+ .proc_write = proc_xpd_metering_write,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_xpd_metering_ops = {
.owner = THIS_MODULE,
.open = proc_xpd_metering_open,
.write = proc_xpd_metering_write,
.release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
#endif
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -51,8 +51,15 @@ static const char rcsid[] = "$Id$";
#ifdef PROTOCOL_DEBUG
#ifdef CONFIG_PROC_FS
#define PROC_XBUS_COMMAND "command"
+
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xbus_command_ops;
+#else
static const struct file_operations proc_xbus_command_ops;
+#endif /* DAHDI_HAVE_PROC_OPS */
+
#endif
+
#endif
/* Command line parameters */
@@ -66,8 +73,15 @@ static DEF_PARM_BOOL(dahdi_autoreg, 0, 0
"Register devices automatically (1) or not (0). UNUSED.");
#ifdef CONFIG_PROC_FS
+
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xbus_read_proc_ops;
+#else
static const struct file_operations xbus_read_proc_ops;
-#endif
+#endif /* DAHDI_HAVE_PROC_OPS */
+
+#endif /* CONFIG_PROC_FS */
+
static void transport_init(xbus_t *xbus, struct xbus_ops *ops,
ushort max_send_size,
struct device *transport_device, void *priv);
@@ -1831,13 +1845,22 @@ static int xbus_read_proc_open(struct in
return single_open(file, xbus_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xbus_read_proc_ops = {
+ .proc_open = xbus_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xbus_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xbus_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xbus_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#ifdef PROTOCOL_DEBUG
static ssize_t proc_xbus_command_write(struct file *file,
@@ -1930,11 +1953,19 @@ static int proc_xbus_command_open(struct
return 0;
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xbus_command_ops = {
+ .proc_open = proc_xbus_command_open,
+ .proc_write = proc_xbus_command_write,
+};
+#else
static const struct file_operations proc_xbus_command_ops = {
.owner = THIS_MODULE,
.open = proc_xbus_command_open,
.write = proc_xbus_command_write,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
+
#endif
static int xpp_proc_read_show(struct seq_file *sfile, void *data)
@@ -1964,13 +1995,22 @@ static int xpp_proc_read_open(struct ino
return single_open(file, xpp_proc_read_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpp_proc_read_ops = {
+ .proc_open = xpp_proc_read_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xpp_proc_read_ops = {
- .owner = THIS_MODULE,
- .open = xpp_proc_read_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xpp_proc_read_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
--- a/drivers/dahdi/xpp/xpp_dahdi.c
+++ b/drivers/dahdi/xpp/xpp_dahdi.c
@@ -103,8 +103,12 @@ int total_registered_spans(void)
}
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpd_read_proc_ops;
+#else
static const struct file_operations xpd_read_proc_ops;
#endif
+#endif
/*------------------------- XPD Management -------------------------*/
@@ -392,13 +396,22 @@ static int xpd_read_proc_open(struct ino
return single_open(file, xpd_read_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpd_read_proc_ops = {
+ .proc_open = xpd_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xpd_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xpd_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xpd_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#endif
--- a/drivers/dahdi/xpp/xpp_usb.c
+++ b/drivers/dahdi/xpp/xpp_usb.c
@@ -232,9 +232,14 @@ static void xpp_receive_callback(struct
static int xusb_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void xusb_disconnect(struct usb_interface *interface);
-#ifdef CONFIG_PROC_FS
+
+#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xusb_read_proc_ops;
+#else
static const struct file_operations xusb_read_proc_ops;
#endif
+#endif
/*------------------------------------------------------------------*/
@@ -1113,13 +1118,22 @@ static int xusb_read_proc_open(struct in
return single_open(file, xusb_read_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xusb_read_proc_ops = {
+ .proc_open = xusb_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xusb_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xusb_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xusb_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#endif
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -68,6 +68,8 @@
#define HAVE_NET_DEVICE_OPS
#endif
+#define DAHDI_HAVE_PROC_OPS
+
/* __dev* were removed in 3.8. They still have effect in 2.6.18. */
#ifndef __devinit
# define __devinit
@@ -1375,6 +1377,10 @@ static inline short dahdi_txtone_nextsam
/*! Maximum audio mask */
#define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
+
+#undef DAHDI_HAVE_PROC_OPS
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#ifndef TIMER_DATA_TYPE
@@ -1485,14 +1491,13 @@ static inline void *PDE_DATA(const struc
#endif /* 4.10.0 */
#endif /* 4.11.0 */
#endif /* 4.13.0 */
-#else /* >= 4.15.0 */
+#endif /* 4.15.0 */
+#endif /* 5.6 */
#ifndef TIMER_DATA_TYPE
#define TIMER_DATA_TYPE struct timer_list *
#endif
-#endif /* 4.15.0 */
-
#ifndef dahdi_ktime_equal
static inline int dahdi_ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
{

View file

@ -1,89 +0,0 @@
From 4df746fe3ffd6678f36b16c9b0750fa552da92e4 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Mon, 16 Nov 2020 22:01:21 -0600
Subject: [PATCH 09/12] Remove support for 32-bit userspace with 64-bit kernel
I am not aware of anyone who tests in this configuration, and I'm not
sure if it currently works. I'll remove any support for the time being
and can add it back in if someone comes forward needing support for it.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 34 ----------------------------------
1 file changed, 34 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -7019,17 +7019,6 @@ static int dahdi_ioctl(struct inode *ino
}
#endif
-#ifdef HAVE_COMPAT_IOCTL
-static long dahdi_ioctl_compat(struct file *file, unsigned int cmd,
- unsigned long data)
-{
- if (cmd == DAHDI_SFCONFIG)
- return -ENOTTY; /* Not supported yet */
-
- return dahdi_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
/**
* _get_next_channo - Return the next taken channel number from the span list.
* @span: The span with which to start the search.
@@ -10285,9 +10274,6 @@ static const struct file_operations dahd
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_ioctl_compat,
-#endif
#else
.ioctl = dahdi_ioctl,
#endif
@@ -10301,9 +10287,6 @@ static const struct file_operations dahd
.release = dahdi_timer_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_timer_unlocked_ioctl,
-#endif
#else
.ioctl = dahdi_timer_ioctl,
#endif
@@ -10377,24 +10360,10 @@ static int nodev_ioctl(struct inode *ino
}
#endif
-#ifdef HAVE_COMPAT_IOCTL
-static long nodev_ioctl_compat(struct file *file, unsigned int cmd,
- unsigned long data)
-{
- if (cmd == DAHDI_SFCONFIG)
- return -ENOTTY; /* Not supported yet */
-
- return nodev_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static const struct file_operations nodev_fops = {
.owner = THIS_MODULE,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = nodev_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = nodev_ioctl_compat,
-#endif
#else
.ioctl = nodev_ioctl,
#endif
@@ -10409,9 +10378,6 @@ static const struct file_operations dahd
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_ioctl_compat,
-#endif
#else
.ioctl = dahdi_ioctl,
#endif

View file

@ -1,148 +0,0 @@
From 6d4c748e0470efac90e7dc4538ff3c5da51f0169 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Mon, 16 Nov 2020 22:01:22 -0600
Subject: [PATCH 10/12] Remove checks for HAVE_UNLOCKED_IOCTL for kernel >= 5.9
In upstream commit (4e24566a134ea1674 "fs: remove the HAVE_UNLOCKED_IOCTL and
HAVE_COMPAT_IOCTL defines") [1] the kernel removed these defines.
All supported kernels include support for the unlocked_ioctl now, so
DAHDI can also remove these checks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4e24566a134ea167441a1ffa3d439a27c
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 44 ---------------------------------
drivers/dahdi/dahdi_transcode.c | 11 ---------
2 files changed, 55 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -53,10 +53,6 @@
#include <linux/ktime.h>
#include <linux/slab.h>
-#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
-#include <linux/smp_lock.h>
-#endif
-
#include <linux/ppp_defs.h>
#include <asm/atomic.h>
@@ -4069,14 +4065,6 @@ dahdi_timer_unlocked_ioctl(struct file *
return 0;
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_timer_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return dahdi_timer_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static int dahdi_ioctl_getgains(struct file *file, unsigned long data)
{
int res = 0;
@@ -7011,14 +6999,6 @@ exit:
return ret;
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return dahdi_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
/**
* _get_next_channo - Return the next taken channel number from the span list.
* @span: The span with which to start the search.
@@ -10272,11 +10252,7 @@ static const struct file_operations dahd
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#else
- .ioctl = dahdi_ioctl,
-#endif
.poll = dahdi_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10285,11 +10261,7 @@ static const struct file_operations dahd
static const struct file_operations dahdi_timer_fops = {
.owner = THIS_MODULE,
.release = dahdi_timer_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
-#else
- .ioctl = dahdi_timer_ioctl,
-#endif
.poll = dahdi_timer_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10352,21 +10324,9 @@ nodev_unlocked_ioctl(struct file *file,
return nodev_common("ioctl");
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int nodev_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return nodev_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static const struct file_operations nodev_fops = {
.owner = THIS_MODULE,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = nodev_unlocked_ioctl,
-#else
- .ioctl = nodev_ioctl,
-#endif
.read = nodev_chan_read,
.write = nodev_chan_write,
.poll = nodev_chan_poll,
@@ -10376,11 +10336,7 @@ static const struct file_operations dahd
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#else
- .ioctl = dahdi_ioctl,
-#endif
.read = dahdi_chan_read,
.write = dahdi_chan_write,
.poll = dahdi_chan_poll,
--- a/drivers/dahdi/dahdi_transcode.c
+++ b/drivers/dahdi/dahdi_transcode.c
@@ -397,13 +397,6 @@ static long dahdi_tc_unlocked_ioctl(stru
};
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
-{
- return (int)dahdi_tc_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static unsigned int dahdi_tc_poll(struct file *file, struct poll_table_struct *wait_table)
{
int ret;
@@ -427,11 +420,7 @@ static struct file_operations __dahdi_tr
.owner = THIS_MODULE,
.open = dahdi_tc_open,
.release = dahdi_tc_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_tc_unlocked_ioctl,
-#else
- .ioctl = dahdi_tc_ioctl,
-#endif
.read = dahdi_tc_read,
.write = dahdi_tc_write,
.poll = dahdi_tc_poll,

View file

@ -15,16 +15,16 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/drivers/dahdi/dahdi-base.c --- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c
@@ -7921,7 +7921,7 @@ static inline void __dahdi_process_getau @@ -7930,7 +7930,7 @@ static inline void __dahdi_process_getau
memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short)); memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short));
txb[0] = DAHDI_LIN2X(0, ms); txb[0] = DAHDI_LIN2X(0, ms);
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1); memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
- /* fall through to normal conf mode */ - /* fallthrough */
+ fallthrough; + fallthrough;
case DAHDI_CONF_CONF: /* Normal conference mode */ case DAHDI_CONF_CONF: /* Normal conference mode */
if (is_pseudo_chan(ms)) /* if pseudo-channel */ if (is_pseudo_chan(ms)) /* if pseudo-channel */
{ {
@@ -7945,7 +7945,7 @@ static inline void __dahdi_process_getau @@ -7954,7 +7954,7 @@ static inline void __dahdi_process_getau
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1); memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
break; break;
} }
@ -33,25 +33,25 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
case DAHDI_CONF_CONFMON: /* Conference monitor mode */ case DAHDI_CONF_CONFMON: /* Conference monitor mode */
if (ms->confmode & DAHDI_CONF_LISTENER) { if (ms->confmode & DAHDI_CONF_LISTENER) {
/* Subtract out last sample written to conf */ /* Subtract out last sample written to conf */
@@ -8484,7 +8484,7 @@ static void __dahdi_hooksig_pvt(struct d @@ -8493,7 +8493,7 @@ static void __dahdi_hooksig_pvt(struct d
break; break;
} }
#endif #endif
- /* fall through intentionally */ - /* fallthrough */
+ fallthrough; + fallthrough;
case DAHDI_SIG_FXSGS: /* FXS Groundstart */ case DAHDI_SIG_FXSGS: /* FXS Groundstart */
if (rxsig == DAHDI_RXSIG_ONHOOK) { if (rxsig == DAHDI_RXSIG_ONHOOK) {
chan->ringdebtimer = RING_DEBOUNCE_TIME; chan->ringdebtimer = RING_DEBOUNCE_TIME;
@@ -8503,7 +8503,7 @@ static void __dahdi_hooksig_pvt(struct d @@ -8512,7 +8512,7 @@ static void __dahdi_hooksig_pvt(struct d
chan->gotgs = 1; chan->gotgs = 1;
} }
} }
- /* fall through intentionally */ - /* fallthrough */
+ fallthrough; + fallthrough;
case DAHDI_SIG_FXOLS: /* FXO Loopstart */ case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */ case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
switch(rxsig) { switch(rxsig) {
@@ -8603,7 +8603,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch @@ -8612,7 +8612,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START); __dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START);
break; break;
} }
@ -60,7 +60,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
case DAHDI_SIG_EM_E1: case DAHDI_SIG_EM_E1:
case DAHDI_SIG_FXOLS: /* FXO Loopstart */ case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */ case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
@@ -8621,7 +8621,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch @@ -8630,7 +8630,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
break; break;
case DAHDI_SIG_FXSKS: /* FXS Kewlstart */ case DAHDI_SIG_FXSKS: /* FXS Kewlstart */
case DAHDI_SIG_FXSGS: /* FXS Groundstart */ case DAHDI_SIG_FXSGS: /* FXS Groundstart */
@ -69,7 +69,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
case DAHDI_SIG_FXSLS: case DAHDI_SIG_FXSLS:
if (!(cursig & DAHDI_BBIT)) { if (!(cursig & DAHDI_BBIT)) {
/* Check for ringing first */ /* Check for ringing first */
@@ -9050,7 +9050,7 @@ static inline void __dahdi_process_putau @@ -9059,7 +9059,7 @@ static inline void __dahdi_process_putau
memcpy(ss->putlin, putlin, DAHDI_CHUNKSIZE * sizeof(short)); memcpy(ss->putlin, putlin, DAHDI_CHUNKSIZE * sizeof(short));
break; break;
} }
@ -80,38 +80,42 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* Store temp value */ /* Store temp value */
--- a/drivers/dahdi/wcaxx-base.c --- a/drivers/dahdi/wcaxx-base.c
+++ b/drivers/dahdi/wcaxx-base.c +++ b/drivers/dahdi/wcaxx-base.c
@@ -1446,6 +1446,7 @@ wcaxx_check_battery_lost(struct wcaxx *w @@ -1456,7 +1456,7 @@ wcaxx_check_battery_lost(struct wcaxx *w
break; break;
case BATTERY_UNKNOWN: case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK); mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
- /* fallthrough */
+ fallthrough; + fallthrough;
case BATTERY_PRESENT: case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST; fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce; fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -1554,6 +1555,7 @@ wcaxx_check_battery_present(struct wcaxx @@ -1567,7 +1567,7 @@ wcaxx_check_battery_present(struct wcaxx
break; break;
case BATTERY_UNKNOWN: case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK); mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
- /* fallthrough */
+ fallthrough; + fallthrough;
case BATTERY_LOST: /* intentional drop through */ case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT; fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce; fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/wctdm24xxp/base.c --- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -1955,6 +1955,7 @@ wctdm_check_battery_lost(struct wctdm *w @@ -1964,7 +1964,7 @@ wctdm_check_battery_lost(struct wctdm *w
break; break;
case BATTERY_UNKNOWN: case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK); mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
- /* fallthrough */
+ fallthrough; + fallthrough;
case BATTERY_PRESENT: case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST; fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce; fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -2063,6 +2064,7 @@ wctdm_check_battery_present(struct wctdm @@ -2074,7 +2074,7 @@ wctdm_check_battery_present(struct wctdm
break; break;
case BATTERY_UNKNOWN: case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK); mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
- /* fallthrough */
+ fallthrough; + fallthrough;
case BATTERY_LOST: /* intentional drop through */ case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT; fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce; fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/xpp/card_global.c --- a/drivers/dahdi/xpp/card_global.c

View file

@ -15,7 +15,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/drivers/dahdi/dahdi-base.c --- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c
@@ -923,9 +923,9 @@ static int dahdi_seq_show(struct seq_fil @@ -928,9 +928,9 @@ static int dahdi_seq_show(struct seq_fil
if (!s) if (!s)
return -ENODEV; return -ENODEV;
@ -27,7 +27,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
seq_printf(sfile, "\"%s\"", s->desc); seq_printf(sfile, "\"%s\"", s->desc);
else else
seq_printf(sfile, "\"\""); seq_printf(sfile, "\"\"");
@@ -964,7 +964,7 @@ static int dahdi_seq_show(struct seq_fil @@ -969,7 +969,7 @@ static int dahdi_seq_show(struct seq_fil
for (x = 0; x < s->channels; x++) { for (x = 0; x < s->channels; x++) {
struct dahdi_chan *chan = s->chans[x]; struct dahdi_chan *chan = s->chans[x];

View file

@ -1,23 +0,0 @@
From be9cab7860ef0872e9fa0a0bc42f1a391d7ac8da Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:20:42 +0200
Subject: [PATCH 4/6] wcte13xp: fix missing break in t13x_set_linemode
Fix missing break in t13x_set_linemode as currently it does uncorrectly
fallthrough.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/wcte13xp-base.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c
@@ -1875,6 +1875,7 @@ static int t13x_set_linemode(struct dahd
"Changing from %s to E1 line mode.\n",
dahdi_spantype2str(wc->span.spantype));
res = t13x_software_init(wc, J1);
+ break;
default:
dev_err(&wc->xb.pdev->dev,
"Got invalid linemode '%s' from dahdi\n",

View file

@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/drivers/dahdi/wcte13xp-base.c --- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c +++ b/drivers/dahdi/wcte13xp-base.c
@@ -2702,8 +2702,7 @@ static int __devinit te13xp_init_one(str @@ -2707,8 +2707,7 @@ static int __devinit te13xp_init_one(str
return 0; return 0;
fail_exit: fail_exit:
@ -26,7 +26,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
return res; return res;
--- a/drivers/dahdi/wcte43x-base.c --- a/drivers/dahdi/wcte43x-base.c
+++ b/drivers/dahdi/wcte43x-base.c +++ b/drivers/dahdi/wcte43x-base.c
@@ -3515,8 +3515,7 @@ static int __devinit t43x_init_one(struc @@ -3521,8 +3521,7 @@ static int __devinit t43x_init_one(struc
return 0; return 0;
fail_exit: fail_exit:

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=rtpengine PKG_NAME:=rtpengine
PKG_VERSION:=10.5.2.6 PKG_VERSION:=11.5.1.12
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-mr$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-mr$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/sipwise/rtpengine/tar.gz/mr$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/sipwise/rtpengine/tar.gz/mr$(PKG_VERSION)?
PKG_HASH:=6f6d5cc2ebf27b6361ed2bd2f86a0ca74103503fd1a14af69ed423dba8340bc4 PKG_HASH:=76a16d00926838cdb16b0004043c2476115b8481f85eff454d5134204c780d47
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-mr$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-mr$(PKG_VERSION)
@ -48,8 +48,9 @@ ENGINE_DEPENDS := \
+libmosquitto \ +libmosquitto \
+libopenssl \ +libopenssl \
+libpcap \ +libpcap \
+libpcre \ +libpcre2 \
+libwebsockets-openssl \ +libwebsockets-openssl \
+libopus \
+xmlrpc-c-client \ +xmlrpc-c-client \
+zlib +zlib
@ -65,7 +66,8 @@ RECORDING_DEPENDS := \
+glib2 \ +glib2 \
+libffmpeg-full \ +libffmpeg-full \
+libmariadb \ +libmariadb \
+libopenssl +libopenssl \
+libcurl
RTPENGINE_USERID:=378 RTPENGINE_USERID:=378
RTPENGINE_GROUPID:=$(RTPENGINE_USERID) RTPENGINE_GROUPID:=$(RTPENGINE_USERID)

View file

@ -1,20 +1,20 @@
--- a/daemon/Makefile --- a/daemon/Makefile
+++ b/daemon/Makefile +++ b/daemon/Makefile
@@ -30,7 +30,7 @@ CFLAGS+= $(shell pkg-config --cflags lib @@ -32,7 +32,7 @@ CFLAGS+= $(shell pkg-config --cflags lib
CFLAGS+= $(shell pkg-config --cflags libavutil) CFLAGS+= $(shell pkg-config --cflags libavutil)
CFLAGS+= $(shell pkg-config --cflags libswresample) CFLAGS+= $(shell pkg-config --cflags libswresample)
CFLAGS+= $(shell pkg-config --cflags libavfilter) CFLAGS+= $(shell pkg-config --cflags libavfilter)
-CFLAGS+= $(shell pkg-config --cflags spandsp) -CFLAGS+= $(shell pkg-config --cflags spandsp)
+CFLAGS+= $(shell pkg-config --cflags spandsp3) +CFLAGS+= $(shell pkg-config --cflags spandsp3)
CFLAGS+= $(shell pkg-config --cflags opus)
CFLAGS+= -DWITH_TRANSCODING CFLAGS+= -DWITH_TRANSCODING
CFLAGS+= $(shell mysql_config --cflags) CFLAGS+= $(shell mysql_config --cflags)
else @@ -68,7 +68,7 @@ LDLIBS+= $(shell pkg-config --libs libav
@@ -65,7 +65,7 @@ LDLIBS+= $(shell pkg-config --libs libav
LDLIBS+= $(shell pkg-config --libs libavutil) LDLIBS+= $(shell pkg-config --libs libavutil)
LDLIBS+= $(shell pkg-config --libs libswresample) LDLIBS+= $(shell pkg-config --libs libswresample)
LDLIBS+= $(shell pkg-config --libs libavfilter) LDLIBS+= $(shell pkg-config --libs libavfilter)
-LDLIBS+= $(shell pkg-config --libs spandsp) -LDLIBS+= $(shell pkg-config --libs spandsp)
+LDLIBS+= $(shell pkg-config --libs spandsp3) +LDLIBS+= $(shell pkg-config --libs spandsp3)
LDLIBS+= $(shell pkg-config --libs opus)
LDLIBS+= $(shell mysql_config --libs) LDLIBS+= $(shell mysql_config --libs)
endif endif

View file

@ -1,30 +0,0 @@
From 2a6d5cd2cbb58c1cab271a65a76decfdbc11dcd7 Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Wed, 8 Jun 2022 09:30:44 +0200
Subject: [PATCH] fix compilation with iptables 1.8.8
The extension handling changed [0,1]. Fix compilation with iptables
1.8.8 [2].
[0] - https://git.netfilter.org/iptables/commit/?id=ef108943f69a6e20533d58823740d3f0534ea8ec
[1] - https://git.netfilter.org/iptables/commit/?id=6c689b639cf8e2aeced8685eca2915892d76ad86
[2] - openwrt/openwrt#9886
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
iptables-extension/libxt_RTPENGINE.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/iptables-extension/libxt_RTPENGINE.c
+++ b/iptables-extension/libxt_RTPENGINE.c
@@ -5,6 +5,10 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#ifndef _init
+#define _init __attribute__((constructor)) _INIT
+#endif
+
#if defined(__ipt)
#include <iptables.h>
#elif defined(__ip6t)

View file

@ -1,36 +1,46 @@
--- a/kernel-module/xt_RTPENGINE.c --- a/kernel-module/xt_RTPENGINE.c
+++ b/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c
@@ -3455,14 +3455,11 @@ static inline ssize_t proc_control_read_ @@ -3781,7 +3781,6 @@ static inline ssize_t proc_control_read_
struct inode *inode;
uint32_t id;
struct rtpengine_table *t; struct rtpengine_table *t;
- struct rtpengine_message msgbuf;
struct rtpengine_message *msg;
int err; int err;
enum rtpengine_command cmd;
- char scratchbuf[512];
size_t readlen, writelen, writeoffset;
int i;
if (buflen < sizeof(*msg)) @@ -3823,13 +3822,9 @@ static inline ssize_t proc_control_read_
return -EIO; return -ERANGE;
- if (buflen == sizeof(*msg))
- msg = &msgbuf; // do we need an extra large storage buffer?
else { /* > */ - if (buflen > sizeof(scratchbuf)) {
msg = kmalloc(buflen, GFP_KERNEL); - msg.storage = kmalloc(buflen, GFP_KERNEL);
if (!msg) - if (!msg.storage)
@@ -3559,16 +3556,14 @@ static inline ssize_t proc_control_read_ - return -ENOMEM;
goto out; - }
- else
- msg.storage = scratchbuf;
+ msg.storage = kmalloc(buflen, GFP_KERNEL);
+ if (!msg.storage)
+ return -ENOMEM;
// get our table
inode = file->f_path.dentry->d_inode;
@@ -3942,16 +3937,14 @@ static inline ssize_t proc_control_read_
goto err_free;
} }
- if (msg != &msgbuf) - if (msg.storage != scratchbuf)
- kfree(msg); - kfree(msg.storage);
+ kfree(msg); + kfree(msg.storage);
return buflen; return buflen;
err: err_table_free:
table_put(t); table_put(t);
out: err_free:
- if (msg != &msgbuf) - if (msg.storage != scratchbuf)
- kfree(msg); - kfree(msg.storage);
+ kfree(msg); + kfree(msg.storage);
return err; return err;
} }
static ssize_t proc_control_write(struct file *file, const char __user *ubuf, size_t buflen, loff_t *off) { static ssize_t proc_control_write(struct file *file, const char __user *ubuf, size_t buflen, loff_t *off) {

View file

@ -0,0 +1,43 @@
--- a/lib/common.Makefile
+++ b/lib/common.Makefile
@@ -34,12 +34,6 @@ $(DAEMONSRCS) $(HASHSRCS): $(patsubst %,
echo '#line 1' && \
cat ../daemon/"$@" ) > "$@"
-%.8: ../docs/%.md
- cat "$<" | sed '/^# /d; s/^##/#/' | \
- pandoc -s -t man \
- -M "footer:$(RTPENGINE_VERSION)" \
- -M "date:$(BUILD_DATE)" \
- -o "$@"
resample.c codeclib.strhash.c mix.c packet.c: fix_frame_channel_layout.h
--- a/daemon/Makefile
+++ b/daemon/Makefile
@@ -93,11 +93,8 @@ LIBASM= mvr2s_x64_avx2.S mvr2s_x64_avx5
endif
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
-MDS= rtpengine.ronn
-MANS= $(MDS:.ronn=.8)
include ../lib/common.Makefile
install: $(TARGET) $(MANS)
install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
- install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8
--- a/recording-daemon/Makefile
+++ b/recording-daemon/Makefile
@@ -39,11 +39,8 @@ LIBSRCS= loglib.c auxlib.c rtplib.c code
LIBASM= mvr2s_x64_avx2.S mvr2s_x64_avx512.S mix_in_x64_avx2.S mix_in_x64_avx512bw.S mix_in_x64_sse2.S
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
-MDS= rtpengine-recording.ronn
-MANS= $(MDS:.ronn=.8)
include ../lib/common.Makefile
install: $(TARGET) $(MANS)
install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)
- install -m 0644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8

View file

@ -17,7 +17,7 @@ PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/sipcapture/sipgrep.git PKG_SOURCE_URL:=https://github.com/sipcapture/sipgrep.git
PKG_SOURCE_VERSION:=1cc00079cd80310f7e8b1a696e9a02b8a2b25e04 PKG_SOURCE_VERSION:=1cc00079cd80310f7e8b1a696e9a02b8a2b25e04
PKG_SOURCE_DATE=2019-06-27 PKG_SOURCE_DATE=2019-06-27
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_MIRROR_HASH:=3480f83a4af2a2972f3aa981343b067fa35ddc74f42c3e459630f31aba8f2d91 PKG_MIRROR_HASH:=3480f83a4af2a2972f3aa981343b067fa35ddc74f42c3e459630f31aba8f2d91
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
@ -33,7 +33,7 @@ define Package/sipgrep
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=Telephony SUBMENU:=Telephony
DEPENDS:=+libpcap +libpcre DEPENDS:=+libpcap +libpcre2
TITLE:=Command line tool to sniff, capture, display SIP messages TITLE:=Command line tool to sniff, capture, display SIP messages
URL:=https://github.com/sipcapture/sipgrep URL:=https://github.com/sipcapture/sipgrep
endef endef

View file

@ -0,0 +1,199 @@
From fea1a27f5fbef28243620fa66909d2d04c81e140 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Thu, 2 Nov 2023 21:16:07 +0100
Subject: [PATCH] Move to PCRE2 from PCRE
Move to PCRE2 as PCRE is EOL and won't receive any security updates
anymore.
Convert each function to PCRE2 equivalent and update configure.ac to
USE_PCRE2.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
configure.ac | 20 +++++++++---------
src/config.h.in | 4 ++--
src/sipgrep.c | 56 ++++++++++++++++++++++++++++++-------------------
3 files changed, 47 insertions(+), 33 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ AC_ARG_ENABLE(ssl,
AC_MSG_RESULT([$SSL])
AC_SUBST([SSL])
-usePCRE=yes
-AC_SUBST([PCRE])
+usePCRE2=yes
+AC_SUBST([PCRE2])
useNCURSES=no
AC_MSG_CHECKING([whether to use ncurses])
@@ -169,15 +169,15 @@ AC_SUBST(PCAP_LIBS)
dnl
-dnl check for pcre library
+dnl check for pcre2 library
dnl
-# Checks for libpcre
-AC_CHECKING([for pcre Library and Header files])
-AC_CHECK_HEADER([pcre.h], ,AC_MSG_ERROR([Could not find pcre headers !]))
-AC_CHECK_LIB([pcre], [pcre_compile], ,[AC_MSG_ERROR([libpcre required])])
-AC_DEFINE(USE_PCRE, 1, [Use PCRE library])
-AC_SUBST(PCRE_LIBS)
+# Checks for libpcre2
+AC_CHECKING([for pcre2 Library and Header files])
+AC_CHECK_HEADER([pcre2.h], ,AC_MSG_ERROR([Could not find pcre2 headers !]), [#define PCRE2_CODE_UNIT_WIDTH 8])
+AC_CHECK_LIB([pcre2-8], [pcre2_compile_8], ,[AC_MSG_ERROR([libpcre2 required])])
+AC_DEFINE(USE_PCRE2, 1, [Use PCRE2 library])
+AC_SUBST(PCRE2_LIBS)
dnl
@@ -271,6 +271,6 @@ echo Ncurses support............. : $use
echo
echo Build with REDIS............ : $useRedis
-echo Build with PCRE............. : $usePCRE
+echo Build with PCRE............. : $usePCRE2
echo
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -152,8 +152,8 @@
/* Use NCURSES library */
#undef USE_NCURSES
-/* Use PCRE library */
-#undef USE_PCRE
+/* Use PCRE2 library */
+#undef USE_PCRE2
/* Use REDIS library */
#undef USE_REDIS
--- a/src/sipgrep.c
+++ b/src/sipgrep.c
@@ -88,7 +88,8 @@
#include <netdb.h>
-#include <pcre.h>
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
/* reasambling */
#include "include/ipreasm.h"
@@ -149,17 +150,18 @@ struct statistics_table *statstable = NU
* GNU PCRE
*/
-int32_t err_offset;
-char *re_err = NULL;
+PCRE2_UCHAR re_err[128];
+PCRE2_SIZE err_offset;
+uint32_t err_code;
-pcre *pattern = NULL;
-pcre_extra *pattern_extra = NULL;
+pcre2_code *pattern = NULL;
/*
* Matching
*/
-char *match_data = NULL, *bin_data = NULL;
+PCRE2_SPTR match_data = NULL;
+char *bin_data = NULL;
uint16_t match_len = 0;
int8_t (*match_func) () = &blank_match_func;
@@ -550,13 +552,13 @@ main (int argc, char **argv)
if (match_data) {
- uint32_t pcre_options = PCRE_UNGREEDY;
+ uint32_t pcre2_options = PCRE2_UNGREEDY;
if (re_ignore_case)
- pcre_options |= PCRE_CASELESS;
+ pcre2_options |= PCRE2_CASELESS;
if (re_multiline_match)
- pcre_options |= PCRE_DOTALL;
+ pcre2_options |= PCRE2_DOTALL;
if (re_match_word) {
char *word_regex = malloc (strlen (match_data) * 3 + strlen (WORD_REGEX));
@@ -564,14 +566,21 @@ main (int argc, char **argv)
match_data = word_regex;
}
- pattern = pcre_compile (match_data, pcre_options, (const char **) &re_err, &err_offset, 0);
+ pattern = pcre2_compile (match_data, PCRE2_ZERO_TERMINATED, pcre2_options, &err_code, &err_offset, NULL);
if (!pattern) {
+ pcre2_get_error_message (err_code, re_err, 128);
fprintf (stderr, "compile failed: %s\n", re_err);
clean_exit (-1);
}
- pattern_extra = pcre_study (pattern, 0, (const char **) &re_err);
+ err_code = pcre2_jit_compile (pattern, PCRE2_JIT_COMPLETE);
+
+ if (err_code < 0) {
+ pcre2_get_error_message(err_code, re_err, 128);
+ fprintf (stderr, "compile failed: %s\n", re_err);
+ clean_exit (-1);
+ }
match_func = &re_match_func;
@@ -1653,21 +1662,28 @@ dump_packet (struct pcap_pkthdr *h, u_ch
int8_t
re_match_func (unsigned char *data, uint32_t len)
{
+ pcre2_match_data *match_data;
+
+ match_data = pcre2_match_data_create_from_pattern(pattern, NULL);
- switch (pcre_exec (pattern, 0, (char *)data, (int32_t) len, 0, 0, 0, 0)) {
- case PCRE_ERROR_NULL:
- case PCRE_ERROR_BADOPTION:
- case PCRE_ERROR_BADMAGIC:
- case PCRE_ERROR_UNKNOWN_NODE:
- case PCRE_ERROR_NOMEMORY:
+ switch (pcre2_match (pattern, (PCRE2_SPTR)data, len, 0, 0, match_data, 0)) {
+ case PCRE2_ERROR_NULL:
+ case PCRE2_ERROR_BADOPTION:
+ case PCRE2_ERROR_BADMAGIC:
+ case PCRE2_ERROR_INTERNAL:
+ case PCRE2_ERROR_NOMEMORY:
+ pcre2_match_data_free(match_data);
perror ("she's dead, jim\n");
clean_exit (-2);
break;
- case PCRE_ERROR_NOMATCH:
+ case PCRE2_ERROR_NOMATCH:
+ pcre2_match_data_free(match_data);
return 0;
}
+ pcre2_match_data_free(match_data);
+
if (max_matches)
matches++;
@@ -2125,9 +2141,7 @@ clean_exit (int32_t sig)
printf ("exit\n");
if (pattern)
- pcre_free (pattern);
- if (pattern_extra)
- pcre_free (pattern_extra);
+ pcre2_code_free (pattern);
if (bin_data)
free (bin_data);

View file

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=yate PKG_NAME:=yate
PKG_VERSION:=6.4.0-1 PKG_VERSION:=6.4.0-1
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://yate.null.ro/tarballs/yate6/ PKG_SOURCE_URL:=http://yate.null.ro/tarballs/yate6/

View file

@ -1,21 +1,43 @@
#!/usr/bin/perl #!/usr/bin/perl
# This yate module will monitor failed authentications and send the source # This yate script will monitor authentication requests and update an
# IP addresses of users who fail to authenticate to the iptables extension # nftables set with IP addresses of users who consistently fail to
# "recent" for filtering. # authenticate. The nftables set can then be used in OpenWrt's
# firewall configuration to block these IP addresses.
# #
# You have to have the iptables extension "recent" installed and you need to # The nftables set has to exist before launching yate.
# create and reference a "recent" list in your firewall configuration.
# For most people it's probably enough to add this custom firewall rule
# to /etc/firewall.user:
# #
# iptables -A input_rule -m recent --name yate_auth_failures --rcheck --seconds 3600 --hitcount 5 -j DROP # Here's an example configuration that creates an nftables set, where
# entries expire after 12 hours, and configures the OpenWrt firewall
# to drop packets where the source IP address is in the set. Put this
# in /etc/nftables.d/99-yate.nft:
# #
# This line will drop all incoming traffic from users who have failed to # set yate_denylist {
# authenticate 5 consecutive times within the last hour. # type ipv4_addr
# timeout 12h
# }
# #
# To enable this script in yate, add this script to the [scripts] section # chain yate_filter {
# in /etc/yate/extmodule.conf. # type filter hook input priority -1; policy accept;
# ip saddr @yate_denylist counter drop comment "Drop packets from bad SIP clients"
# }
#
#
# To enable this script in yate, add it to the [scripts] section in
# /etc/yate/extmodule.conf.
#
# You can tweak how tolerant this script should be by modifying the
# constants below.
# A user's IP address will be added to the nftables set if there are
# more than MAX_AUTH_FAILURES consecutive authentication failures in
# MAX_AUTH_FAILURES_TIME_PERIOD seconds.
my $MAX_AUTH_FAILURES = 5;
my $MAX_AUTH_FAILURES_TIME_PERIOD = 3600; # seconds
# The name of the nftables table and set where IP addresses are added.
my $NFTABLES_TABLE = 'inet fw4';
my $NFTABLES_SET = 'yate_denylist';
use strict; use strict;
@ -23,28 +45,42 @@ use warnings;
use lib '/usr/share/yate/scripts'; use lib '/usr/share/yate/scripts';
use Yate; use Yate;
my $RECENT_LIST_NAME = '/proc/net/xt_recent/yate_auth_failures'; my %ip_auth_failures = ();
sub OnAuthenticationRequest($) { sub OnAuthenticationRequest($) {
my $yate = shift; my $yate = shift;
# Forget any expired failed authentications
foreach my $ip (keys(%ip_auth_failures)) {
my $failures = \@{$ip_auth_failures{$ip}};
while (@$failures &&
time() - @$failures[0] > $MAX_AUTH_FAILURES_TIME_PERIOD) {
shift(@$failures);
}
if (!@$failures) {
delete $ip_auth_failures{$ip};
}
}
my $remote_ip = $yate->param('ip_host'); my $remote_ip = $yate->param('ip_host');
my $remote_device = $yate->param('device') || '<unknown>';
if ($yate->header('processed') eq 'true') { if ($yate->header('processed') eq 'true') {
# Successful authentication, forget previous failures $yate->output("banbrutes: Successful authentication from $remote_ip");
`echo -$remote_ip > $RECENT_LIST_NAME`; delete $ip_auth_failures{$remote_ip};
return; return;
} }
`echo +$remote_ip > $RECENT_LIST_NAME`; $yate->output("banbrutes: Failed authentication from $remote_ip");
push(@{$ip_auth_failures{$remote_ip}}, time());
if (scalar(@{$ip_auth_failures{$remote_ip}}) > $MAX_AUTH_FAILURES) {
$yate->output("banbrutes: Adding $remote_ip to nftables set $NFTABLES_SET (remote device: $remote_device)");
`nft add element $NFTABLES_TABLE $NFTABLES_SET { $remote_ip }`;
delete $ip_auth_failures{$remote_ip};
}
} }
my $yate = new Yate(); my $yate = new Yate();
$yate->install_watcher("user.auth", \&OnAuthenticationRequest);
if (! -f $RECENT_LIST_NAME) {
$yate->output("iptables recent list $RECENT_LIST_NAME does not exist");
exit 1;
}
$yate->install_watcher('user.auth', \&OnAuthenticationRequest);
$yate->listen(); $yate->listen();