diff --git a/daemon/call.c b/daemon/call.c index 1a773a3f9..c23d22bd9 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -39,7 +39,7 @@ #include "audio_player.h" #include "bufferpool.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" struct iterator_helper { uint64_t count; diff --git a/daemon/crypto.c b/daemon/crypto.c index 4c3efe96c..b8240cd26 100644 --- a/daemon/crypto.c +++ b/daemon/crypto.c @@ -16,7 +16,7 @@ #include "ssllib.h" #include "types.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" static int aes_cm_encrypt_rtp(struct crypto_context *, const struct rtp_header *, str *, uint32_t); static int aes_cm_encrypt_rtcp(struct crypto_context *, const struct rtcp_packet *, str *, uint32_t); diff --git a/daemon/kernel.c b/daemon/kernel.c index f1b431ae4..7ea82afe0 100644 --- a/daemon/kernel.c +++ b/daemon/kernel.c @@ -16,7 +16,7 @@ #include "main.h" #include "statistics.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #define PREFIX "/proc/rtpengine" diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 9c749762e..db76be5ed 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -33,7 +33,7 @@ #include "janus.h" #include "bufferpool.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #ifndef PORT_RANDOM_MIN #define PORT_RANDOM_MIN 6 diff --git a/daemon/nftables.c b/daemon/nftables.c index 23c6c6af4..58d5300f4 100644 --- a/daemon/nftables.c +++ b/daemon/nftables.c @@ -17,7 +17,7 @@ #include "netfilter_api.h" #include "helpers.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #define HANDLER_COMMENT "rtpengine UDP handler" diff --git a/daemon/recording.c b/daemon/recording.c index 13ea76603..68bf1fe59 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -23,7 +23,7 @@ #include "call_interfaces.h" #include "media_player.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" struct rec_pcap_format { int linktype; diff --git a/debian/ngcp-rtpengine-daemon.postinst b/debian/ngcp-rtpengine-daemon.postinst index e4b04a109..c3e8b0fa8 100644 --- a/debian/ngcp-rtpengine-daemon.postinst +++ b/debian/ngcp-rtpengine-daemon.postinst @@ -3,7 +3,7 @@ set -e default=/etc/default/ngcp-rtpengine-daemon -modname=xt_RTPENGINE +modname=nft_rtpengine if [ -x "$(which ngcp-virt-identify)" ]; then if ngcp-virt-identify --type container; then @@ -52,7 +52,7 @@ if [ "$1" = configure ]; then # set up modprobe.d fragment for auto-load usage if ! [ -f /etc/modprobe.d/rtpengine.conf ] || grep -q DPKG-GENERATED /etc/modprobe.d/rtpengine.conf; then - OPTIONS="options xt_RTPENGINE proc_mask=0x7" + OPTIONS="options nft_rtpengine proc_mask=0x7" PUID=$(id -u rtpengine 2> /dev/null) test -z "$PUID" || OPTIONS="$OPTIONS proc_uid=$PUID" diff --git a/debian/ngcp-rtpengine-kernel-dkms.dkms b/debian/ngcp-rtpengine-kernel-dkms.dkms index 1e46051c6..750857198 100644 --- a/debian/ngcp-rtpengine-kernel-dkms.dkms +++ b/debian/ngcp-rtpengine-kernel-dkms.dkms @@ -6,5 +6,5 @@ BUILD_EXCLUSIVE_KERNEL_MIN="4.4" MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"${PACKAGE_VERSION}\"" CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" AUTOINSTALL=yes -BUILT_MODULE_NAME[0]="xt_RTPENGINE" +BUILT_MODULE_NAME[0]="nft_rtpengine" DEST_MODULE_LOCATION[0]=/extra diff --git a/debian/ngcp-rtpengine-kernel-dkms.prerm b/debian/ngcp-rtpengine-kernel-dkms.prerm index 0326afe76..e84f520f0 100644 --- a/debian/ngcp-rtpengine-kernel-dkms.prerm +++ b/debian/ngcp-rtpengine-kernel-dkms.prerm @@ -14,7 +14,7 @@ else # make sure it's not running if [ -x /etc/init.d/ngcp-rtpengine-daemon ] ; then invoke-rc.d ngcp-rtpengine-daemon stop || true - rmmod "xt_RTPENGINE" 2>/dev/null || true + rmmod "nft_rtpengine" 2>/dev/null || true fi fi diff --git a/docs/architecture.md b/docs/architecture.md index 2f867f211..a2bf7bd25 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -220,7 +220,7 @@ This allows packet handling on multiple ports and streams belonging to the same Kernel forwarding ----------------- -The kernel forwarding of RTP/RTCP packets is handled in the `xt_RTPENGINE.c` / `xt_RTPENGINE.h`. +The kernel forwarding of RTP/RTCP packets is handled in the `nft_rtpengine.c` / `nft_rtpengine.h`. The linkage between user-space and kernel module is in the `kernelize_one()` (`media_socket.c`),\ which populates the struct that is passed to the kernel module. diff --git a/docs/compiling_and_installing.md b/docs/compiling_and_installing.md index 5fc8e3ffe..1995b3366 100644 --- a/docs/compiling_and_installing.md +++ b/docs/compiling_and_installing.md @@ -110,11 +110,11 @@ test suite. must be present in `/lib/modules/4.19-1-amd64/build/`. The last component of this path (`build`) is usually a symlink somewhere into `/usr/src/`, which is fine. - Successful compilation of the module will produce the file `xt_RTPENGINE.ko`. The module can be inserted - into the running kernel manually through `insmod xt_RTPENGINE.ko` (which will result in an error if + Successful compilation of the module will produce the file `nft_rtpengine.ko`. The module can be inserted + into the running kernel manually through `insmod nft_rtpengine.ko` (which will result in an error if depending modules aren't loaded, for example the `x_tables` module), but it's recommended to copy the module into `/lib/modules/$VERSION/updates/`, followed by running `depmod -a`. This copying is performed - on `make install`. After this, the module can be loaded by issuing `modprobe xt_RTPENGINE`. + on `make install`. After this, the module can be loaded by issuing `modprobe nft_rtpengine`. * `recording-daemon` diff --git a/docs/usage.md b/docs/usage.md index 353e3839c..dd28cf46d 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -27,14 +27,14 @@ eliminated, CPU usage greatly reduced and the number of concurrent calls possibl In-kernel packet forwarding is implemented as an *nftables* module (or more precisely, an *x\_tables* module). As such, it requires two parts for proper operation. One part is the actual kernel module called -`xt_RTPENGINE`. The second part is a rule in the local *nftables* chains that +`nft_rtpengine`. The second part is a rule in the local *nftables* chains that gets hit by UDP packets so that they can be processed by the kernel module. ### Overview ### In short, the prerequisites for in-kernel packet forwarding are: -1. The `xt_RTPENGINE` kernel module must be loaded. The module supports +1. The `nft_rtpengine` kernel module must be loaded. The module supports auto-loading when correctly installed. 2. A rule added to an *nftables* chain that gets called by an *input* hook in the *filter* table, which sends packets @@ -76,14 +76,14 @@ Each forwarding table can be thought of a separate proxy instance. Each running running instance of the daemon at any given time. In the most common setup, there will be only a single instance of the daemon running and there will be only a single forwarding table in use, with ID zero. -The kernel module can be loaded with the command `modprobe xt_RTPENGINE`. It +The kernel module can be loaded with the command `modprobe nft_rtpengine`. It isn't normally necessary to do this explicitly or manually as the module is automatically loaded when the appropriate *nftables* rule is created (see -below). The module supports a few options (see `modinfo -p xt_RTPENGINE`) which +below). The module supports a few options (see `modinfo -p nft_rtpengine`) which can either be set at the `modprobe` command line, and/or through an entry in `/etc/modprobe.d/` (by default `/etc/modprobe.d/rtpengine.conf`) for options to be set when auto-loading the module. Options can be inspected during runtime -via `/sys/module/xt_RTPENGINE/parameters/`. +via `/sys/module/nft_rtpengine/parameters/`. With the module loaded, a new directory will appear in `/proc/`, namely `/proc/rtpengine/`. After loading, the directory will contain @@ -116,7 +116,7 @@ Manual creation of forwarding tables is normally not required as the daemon will deletion of tables may be required after shutdown of the daemon or before a restart to ensure that the daemon can create the table it wants to use. -The kernel module can be unloaded through `rmmod xt_RTPENGINE`, however this only works if no forwarding +The kernel module can be unloaded through `rmmod nft_rtpengine`, however this only works if no forwarding table currently exists and no *nftables* rule currently exists. ### The *nftables* Rule ### @@ -167,11 +167,11 @@ A cheat sheet with various related commands is below: # Load module: this only needs to be done once after system # (re-) boot, but can be omitted if auto-load is working correctly - modprobe xt_RTPENGINE + modprobe nft_rtpengine # Load module with some options set # (usually handled via /etc/modprobe.d/rtpengine.conf) - modprobe xt_RTPENGINE proc_uid=1234 proc_gid=5678 + modprobe nft_rtpengine proc_uid=1234 proc_gid=5678 # Create nftables rules: This normally happens automatically during # startup. Kernel table ID and nftables chain names are taken from diff --git a/el/rtpengine.init b/el/rtpengine.init index 82867fabe..4033f7a9d 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -62,16 +62,16 @@ start() { build_opts if [[ $MODULE == 1 ]];then echo "Loading module for in-kernel packet forwarding" - rmmod xt_RTPENGINE 2> /dev/null + rmmod nft_rtpengine 2> /dev/null if [[ -n "$SET_USER" ]];then if [[ -n "$SET_GROUP" ]];then proc_gid="$(grep "^$SET_GROUP:" /etc/group | cut -f3 -d:)" else proc_gid="$(id "$SET_USER" -g)" fi - modprobe xt_RTPENGINE proc_uid="$(id "$SET_USER" -u)" proc_gid="$proc_gid" + modprobe nft_rtpengine proc_uid="$(id "$SET_USER" -u)" proc_gid="$proc_gid" else - modprobe xt_RTPENGINE + modprobe nft_rtpengine fi if firewall-cmd --state 2>/dev/null ; then # Using firewalld @@ -141,7 +141,7 @@ stop() { $fw -X rtpengine done fi - rmmod xt_RTPENGINE + rmmod nft_rtpengine rm -f "$cachefile" fi diff --git a/el/rtpengine.spec b/el/rtpengine.spec index 4033a6fa3..fe6a2f63f 100644 --- a/el/rtpengine.spec +++ b/el/rtpengine.spec @@ -200,10 +200,10 @@ install -D -p -m644 kernel-module/Makefile \ %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/Makefile install -D -p -m755 kernel-module/gen-rtpengine-kmod-flags \ %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/gen-rtpengine-kmod-flags -install -D -p -m644 kernel-module/xt_RTPENGINE.c \ - %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/xt_RTPENGINE.c -install -D -p -m644 kernel-module/xt_RTPENGINE.h \ - %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/xt_RTPENGINE.h +install -D -p -m644 kernel-module/nft_rtpengine.c \ + %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/nft_rtpengine.c +install -D -p -m644 kernel-module/nft_rtpengine.h \ + %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/nft_rtpengine.h install -D -p -m644 kernel-module/common_stats.h \ %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/common_stats.h install -D -p -m644 kernel-module/*.inc \ diff --git a/include/call.h b/include/call.h index ee4edc85f..49a19061c 100644 --- a/include/call.h +++ b/include/call.h @@ -21,7 +21,7 @@ #include "t38.h" #include "types.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #define UNDEFINED ((unsigned int) -1) diff --git a/include/kernel.h b/include/kernel.h index 435566d55..763c0516f 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -8,7 +8,7 @@ #include "containers.h" #include "auxlib.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #define UNINIT_IDX ((unsigned int) -1) diff --git a/include/media_socket.h b/include/media_socket.h index 862424a95..c3d7ced8e 100644 --- a/include/media_socket.h +++ b/include/media_socket.h @@ -14,7 +14,7 @@ #include "containers.h" #include "codec.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #include "common_stats.h" struct media_packet; diff --git a/kernel-module/Makefile b/kernel-module/Makefile index 78b53cdd2..be0f349e1 100644 --- a/kernel-module/Makefile +++ b/kernel-module/Makefile @@ -8,7 +8,7 @@ include $(M)/rtpengine-kmod.mk ccflags-y += -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\"" -obj-m += xt_RTPENGINE.o +obj-m += nft_rtpengine.o .PHONY: modules clean install @@ -20,7 +20,7 @@ clean: rm -f rtpengine-kmod.mk install: - install -D xt_RTPENGINE.ko $(DESTDIR)/lib/modules/$(shell uname -r)/updates/xt_RTPENGINE.ko + install -D nft_rtpengine.ko $(DESTDIR)/lib/modules/$(shell uname -r)/updates/nft_rtpengine.ko depmod -a $(M)/rtpengine-kmod.mk: diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/nft_rtpengine.c similarity index 99% rename from kernel-module/xt_RTPENGINE.c rename to kernel-module/nft_rtpengine.c index 3c47d048a..7c77b6688 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/nft_rtpengine.c @@ -43,7 +43,7 @@ #warning "Kernel without CONFIG_BTREE - kernel media player unavailable" #endif -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sipwise GmbH "); @@ -53,6 +53,7 @@ MODULE_IMPORT_NS("CRYPTO_INTERNAL"); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0) MODULE_IMPORT_NS(CRYPTO_INTERNAL); #endif +MODULE_ALIAS("xt_RTPENGINE"); MODULE_ALIAS("ipt_RTPENGINE"); MODULE_ALIAS("ip6t_RTPENGINE"); MODULE_ALIAS("nft-expr-rtpengine"); @@ -962,7 +963,7 @@ static struct rtpengine_table *new_table_link(uint32_t id) { t = new_table(); if (!t) { - printk(KERN_WARNING "xt_RTPENGINE out of memory\n"); + printk(KERN_WARNING "nft_rtpengine out of memory\n"); return NULL; } @@ -970,7 +971,7 @@ static struct rtpengine_table *new_table_link(uint32_t id) { if (rtpe_table[id]) { write_unlock_irqrestore(&table_lock, flags); table_put(t); - printk(KERN_WARNING "xt_RTPENGINE duplicate ID %u\n", id); + printk(KERN_WARNING "nft_rtpengine duplicate ID %u\n", id); return NULL; } @@ -980,7 +981,7 @@ static struct rtpengine_table *new_table_link(uint32_t id) { write_unlock_irqrestore(&table_lock, flags); if (table_create_proc(t, id)) - printk(KERN_WARNING "xt_RTPENGINE failed to create /proc entry for ID %u\n", id); + printk(KERN_WARNING "nft_rtpengine failed to create /proc entry for ID %u\n", id); return t; @@ -4813,7 +4814,7 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub // verify request if (cmd < 1 || cmd >= __REMG_LAST) { - printk(KERN_WARNING "xt_RTPENGINE unimplemented op %u\n", cmd); + printk(KERN_WARNING "nft_rtpengine unimplemented op %u\n", cmd); return -EINVAL; } @@ -4928,7 +4929,7 @@ static inline ssize_t proc_control_read_write(struct file *file, char __user *ub #endif default: - printk(KERN_WARNING "xt_RTPENGINE unimplemented op %u\n", cmd); + printk(KERN_WARNING "nft_rtpengine unimplemented op %u\n", cmd); err = -EINVAL; break; } @@ -6767,11 +6768,11 @@ static int check(const struct xt_tgchk_param *par) { const struct xt_rtpengine_info *pinfo = par->targinfo; if (!my_proc_root) { - printk(KERN_WARNING "xt_RTPENGINE check() without proc_root\n"); + printk(KERN_WARNING "nft_rtpengine check() without proc_root\n"); return -EINVAL; } if (pinfo->id >= MAX_ID) { - printk(KERN_WARNING "xt_RTPENGINE ID too high (%u >= %u)\n", pinfo->id, MAX_ID); + printk(KERN_WARNING "nft_rtpengine ID too high (%u >= %u)\n", pinfo->id, MAX_ID); return -EINVAL; } @@ -6954,7 +6955,7 @@ static int __init init(void) { if (stream_packets_list_limit <= 0) goto fail; - printk(KERN_NOTICE "Registering xt_RTPENGINE module - version %s\n", RTPENGINE_VERSION); + printk(KERN_NOTICE "Registering nft_rtpengine module - version %s\n", RTPENGINE_VERSION); DBG("using uid %u, gid %d\n", proc_uid, proc_gid); proc_kuid = KUIDT_INIT(proc_uid); proc_kgid = KGIDT_INIT(proc_gid); @@ -7015,13 +7016,13 @@ fail: clear_proc(&proc_list); clear_proc(&my_proc_root); - printk(KERN_ERR "Failed to load xt_RTPENGINE module: %s\n", err); + printk(KERN_ERR "Failed to load nft_rtpengine module: %s\n", err); return ret; } static void __exit fini(void) { - printk(KERN_NOTICE "Unregistering xt_RTPENGINE module\n"); + printk(KERN_NOTICE "Unregistering nft_rtpengine module\n"); nft_unregister_expr(&rtpengine_inet_expr); nft_unregister_expr(&rtpengine_ipv4_expr); diff --git a/kernel-module/xt_RTPENGINE.h b/kernel-module/nft_rtpengine.h similarity index 100% rename from kernel-module/xt_RTPENGINE.h rename to kernel-module/nft_rtpengine.h diff --git a/kernel-module/nft_rtpengine.modules.load.d b/kernel-module/nft_rtpengine.modules.load.d new file mode 100644 index 000000000..3a2a6ee8f --- /dev/null +++ b/kernel-module/nft_rtpengine.modules.load.d @@ -0,0 +1,2 @@ +# Load nft_rtpengine kernel module at boot. +nft_rtpengine diff --git a/kernel-module/xt_RTPENGINE.modules.load.d b/kernel-module/xt_RTPENGINE.modules.load.d deleted file mode 100644 index 06e5ce1f1..000000000 --- a/kernel-module/xt_RTPENGINE.modules.load.d +++ /dev/null @@ -1,2 +0,0 @@ -# Load xt_RTPENGINE kernel module at boot. -xt_RTPENGINE diff --git a/lib/socket.c b/lib/socket.c index a63975f08..8b9094570 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -9,7 +9,7 @@ #include #include "str.h" #include "auxlib.h" -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #include "log.h" static bool __ip4_addr_parse(sockaddr_t *dst, const char *src); diff --git a/pkg/deb/old-dkms/dkms.conf.in b/pkg/deb/old-dkms/dkms.conf.in index 005b4445f..7da1b8db5 100644 --- a/pkg/deb/old-dkms/dkms.conf.in +++ b/pkg/deb/old-dkms/dkms.conf.in @@ -3,5 +3,5 @@ PACKAGE_VERSION="__VERSION__" MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"__VERSION__\"" CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" AUTOINSTALL=yes -BUILT_MODULE_NAME[0]="xt_RTPENGINE" +BUILT_MODULE_NAME[0]="nft_rtpengine" DEST_MODULE_LOCATION[0]=/extra diff --git a/pkg/deb/old-dkms/rtpengine-kernel-dkms.prerm b/pkg/deb/old-dkms/rtpengine-kernel-dkms.prerm index 1b7153526..164c61b8e 100755 --- a/pkg/deb/old-dkms/rtpengine-kernel-dkms.prerm +++ b/pkg/deb/old-dkms/rtpengine-kernel-dkms.prerm @@ -4,7 +4,7 @@ set -e package=rtpengine-kernel-dkms name=rtpengine -modname=xt_RTPENGINE +modname=nft_rtpengine version=$(dpkg-query -W -f="\${Version}" "$package" \ |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n") diff --git a/t/test-kernel-module.c b/t/test-kernel-module.c index 9d54c4e32..20266b13f 100644 --- a/t/test-kernel-module.c +++ b/t/test-kernel-module.c @@ -1,6 +1,6 @@ #include #include "kernel.h" -#include "../kernel-module/xt_RTPENGINE.h" +#include "../kernel-module/nft_rtpengine.h" int main(void) { int ret; diff --git a/tests/kernel-module-test.c b/tests/kernel-module-test.c index f4c4381e7..720a5f844 100644 --- a/tests/kernel-module-test.c +++ b/tests/kernel-module-test.c @@ -11,7 +11,7 @@ #include #include #include -#include "xt_RTPENGINE.h" +#include "nft_rtpengine.h" #define NUM_SOCKETS 41 #define PORT_BASE 36000 diff --git a/utils/kplay-test.c b/utils/kplay-test.c index 31a7a64af..7d4339bdb 100644 --- a/utils/kplay-test.c +++ b/utils/kplay-test.c @@ -11,7 +11,7 @@ #include #define atomic64 uint64_t -#include "../kernel-module/xt_RTPENGINE.h" +#include "../kernel-module/nft_rtpengine.h" int main() { int fd = open("/proc/rtpengine/control", O_WRONLY); diff --git a/utils/kplay-test2.c b/utils/kplay-test2.c index 3d96c0aa2..13f11f128 100644 --- a/utils/kplay-test2.c +++ b/utils/kplay-test2.c @@ -12,7 +12,7 @@ #include #define atomic64 uint64_t -#include "../kernel-module/xt_RTPENGINE.h" +#include "../kernel-module/nft_rtpengine.h" #define PAGE_SIZE 4096