sipwise / rtpengine

The Sipwise media proxy for Kamailio
GNU General Public License v3.0
767 stars 363 forks source link

Module xt_RTPENGINE not found in directory /lib/modules/5.8.0-50-generic #1250

Open zizomizo84gh opened 3 years ago

zizomizo84gh commented 3 years ago

Hi Everyone,

I am trying to build the rtpengine but I am getting the following errors after starting the engine:

Apr 30 11:05:19 T450 systemd[1]: Starting NGCP RTP/media Proxy Daemon... Apr 30 11:05:19 T450 ngcp-rtpengine-iptables-setup[1595]: modprobe: FATAL: Module xt_RTPENGINE not found in directory /lib/modules/5.8.0-50-generic Apr 30 11:05:19 T450 ngcp-rtpengine-iptables-setup[1624]: iptables v1.8.4 (legacy): unknown option "--id" Apr 30 11:05:19 T450 ngcp-rtpengine-iptables-setup[1624]: Try iptables -h' or 'iptables --help' for more information. Apr 30 11:05:19 T450 ngcp-rtpengine-iptables-setup[1634]: ip6tables v1.8.4 (legacy): unknown option "--id" Apr 30 11:05:19 T450 ngcp-rtpengine-iptables-setup[1634]: Tryip6tables -h' or 'ip6tables --help' for more information. Apr 30 11:05:19 T450 rtpengine[1636]: INFO: [crypto] Generating new DTLS certificate Apr 30 11:05:20 T450 systemd[1]: Started NGCP RTP/media Proxy Daemon. Apr 30 11:05:20 T450 rtpengine[1636]: ERR: [core] FAILED TO CREATE KERNEL TABLE 0 (No such file or directory), KERNEL FORWARDING DISABLED Apr 30 11:05:20 T450 rtpengine[1636]: INFO: [core] Startup complete, version 9.5.0.0+0~mr9.5.0.0 git-master-311069b5

Afterwards:

I tried to make the kernel module xt_RTPENGINE alone so I get the xt_RTPENGINE.ko but unfortunately did not manage because of the following erros.

make -C /lib/modules/5.8.0-50-generic/build M=/usr/local/src/rtpengine/kernel-module O=/lib/modules/5.8.0-50-generic/build modules make[1]: Entering directory '/usr/src/linux-headers-5.8.0-50-generic' CC [M] /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.o /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c: In function ‘send_proxy_packet4’: /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:3443:42: error: passing argument 2 of ‘ip_route_me_harder’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3443 if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC)) ^~~
struct sk_buff *
In file included from ./include/uapi/linux/netfilter_ipv4/ip_tables.h:22, from ./include/linux/netfilter_ipv4/ip_tables.h:23, from /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:28: ./include/linux/netfilter_ipv4.h:19:54: note: expected ‘struct sock ’ but argument is of type ‘struct sk_buff ’ 19 int ip_route_me_harder(struct net net, struct sock sk, struct sk_buff *skb, unsigned addr_type); ~~~~~^~ /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:3443:6: error: too few arguments to function ‘ip_route_me_harder’ 3443 if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC)) ^~~~~~ In file included from ./include/uapi/linux/netfilter_ipv4/ip_tables.h:22, from ./include/linux/netfilter_ipv4/ip_tables.h:23, from /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:28: ./include/linux/netfilter_ipv4.h:19:5: note: declared here 19 int ip_route_me_harder(struct net net, struct sock sk, struct sk_buff *skb, unsigned addr_type); ^~~~~~ /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c: In function ‘send_proxy_packet6’: /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:3543:43: error: passing argument 2 of ‘ip6_route_me_harder’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3543 if (ip6_route_me_harder(par->state->net, skb)) ^~~
struct sk_buff *

In file included from /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:30: ./include/linux/netfilter_ipv6.h:146:55: note: expected ‘struct sock ’ but argument is of type ‘struct sk_buff ’ 146 | int ip6_route_me_harder(struct net net, struct sock sk, struct sk_buff skb); | ~~~~~^~ /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:3543:6: error: too few arguments to function ‘ip6_route_me_harder’ 3543 | if (ip6_route_me_harder(par->state->net, skb)) | ^~~~~~~ In file included from /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.c:30: ./include/linux/netfilter_ipv6.h:146:5: note: declared here 146 | int ip6_route_me_harder(struct net net, struct sock sk, struct sk_buff skb); | ^~~~~~~ cc1: some warnings being treated as errors 1,1 Top make[2]: [scripts/Makefile.build:286: /usr/local/src/rtpengine/kernel-module/xt_RTPENGINE.o] Error 1 make[1]: [Makefile:1783: /usr/local/src/rtpengine/kernel-module] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-50-generic' make: *** [Makefile:34: modules] Error 2

May someone advise or help to interpret this outcome.

Best regards Abdul

rfuchs commented 3 years ago

Ubuntu? See #1212

sergey-safarov commented 3 years ago

I have the same issue on CentOS 8.4.2105

[root@rtp-bcf-us-west-1-b0 ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"

[root@rtp-bcf-us-west-1-b0 ~]# cat /etc/redhat-release 
CentOS Linux release 8.4.2105

[root@rtp-bcf-us-west-1-b0 ~]# uname -a
Linux rtp-bcf-us-west-1-b0.nga911.com 4.18.0-305.3.1.el8.aarch64 #1 SMP Tue Jun 1 16:22:50 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
sergey-safarov commented 3 years ago

Full build log

[root@rtp-bcf-us-west-1-b0 ~]# dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j2 KERNELRELEASE=4.18.0-305.3.1.el8.aarch64 -C /lib/modules/4.18.0-305.3.1.el8.aarch64/build M=/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build RTPENGINE_VERSION=9.5.0.0+0~mr9.5.0.0-1.el8...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.18.0-305.3.1.el8.aarch64 (aarch64)
Consult /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/make.log for more information.
[root@rtp-bcf-us-west-1-b0 ~]# cat /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/make.log
DKMS make.log for ngcp-rtpengine-9.5.0.0+0~mr9.5.0.0-1.el8 for kernel 4.18.0-305.3.1.el8.aarch64 (aarch64)
Wed Jun 23 09:34:21 UTC 2021
make: Entering directory '/usr/src/kernels/4.18.0-305.3.1.el8.aarch64'
  CC [M]  /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.o
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c: In function ‘send_proxy_packet4’:
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:3449:42: error: passing argument 2 of ‘ip_route_me_harder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC))
                                          ^~~
In file included from ./include/uapi/linux/netfilter_ipv4/ip_tables.h:22,
                 from ./include/linux/netfilter_ipv4/ip_tables.h:24,
                 from /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:31:
./include/linux/netfilter_ipv4.h:19:54: note: expected ‘struct sock *’ but argument is of type ‘struct sk_buff *’
 int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type);
                                         ~~~~~~~~~~~~~^~
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:3449:6: error: too few arguments to function ‘ip_route_me_harder’
  if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC))
      ^~~~~~~~~~~~~~~~~~
In file included from ./include/uapi/linux/netfilter_ipv4/ip_tables.h:22,
                 from ./include/linux/netfilter_ipv4/ip_tables.h:24,
                 from /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:31:
./include/linux/netfilter_ipv4.h:19:5: note: declared here
 int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type);
     ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c: In function ‘send_proxy_packet6’:
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:3549:43: error: passing argument 2 of ‘ip6_route_me_harder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (ip6_route_me_harder(par->state->net, skb))
                                           ^~~
In file included from /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:33:
./include/linux/netfilter_ipv6.h:89:55: note: expected ‘struct sock *’ but argument is of type ‘struct sk_buff *’
 int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);
                                          ~~~~~~~~~~~~~^~
/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:3549:6: error: too few arguments to function ‘ip6_route_me_harder’
  if (ip6_route_me_harder(par->state->net, skb))
      ^~~~~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.c:33:
./include/linux/netfilter_ipv6.h:89:5: note: declared here
 int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);
     ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:322: /var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build/xt_RTPENGINE.o] Error 1
make: *** [Makefile:1563: _module_/var/lib/dkms/ngcp-rtpengine/9.5.0.0+0~mr9.5.0.0-1.el8/build] Error 2
make: Leaving directory '/usr/src/kernels/4.18.0-305.3.1.el8.aarch64'
[root@rtp-bcf-us-west-1-b0 ~]# 
sergey-safarov commented 3 years ago

To fix build on CentOS i have applied patch

diff --git a/xt_RTPENGINE.c b/xt_RTPENGINE.c
index 339e458..8922bf7 100644
--- a/xt_RTPENGINE.c
+++ b/xt_RTPENGINE.c
@@ -3445,6 +3445,8 @@ static int send_proxy_packet4(struct sk_buff *skb, struct re_address *src, struc
                (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,78) && LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)) || \
                (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,158) && LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
        if (ip_route_me_harder(par->state->net, par->state->sk, skb, RTN_UNSPEC))
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)
+       if (ip_route_me_harder(par->state->net, par->state->sk, skb, RTN_UNSPEC))
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
        if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC))
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
@@ -3545,6 +3547,8 @@ static int send_proxy_packet6(struct sk_buff *skb, struct re_address *src, struc
                (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,78) && LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)) || \
                (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,158) && LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
        if (ip6_route_me_harder(par->state->net, par->state->sk, skb))
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)
+       if (ip6_route_me_harder(par->state->net, par->state->sk, skb))
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
        if (ip6_route_me_harder(par->state->net, skb))
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0
sergey-safarov commented 3 years ago

Comment above hided because this already handled at https://github.com/sipwise/rtpengine/commit/523b3ed99fd11b2fd5bfe7eb159428f8c7d68270