Browse Source

MT#9585 rename kernel module and all related items from MEDIAPROXY to RTPENGINE

pull/53/head
Richard Fuchs 11 years ago
parent
commit
0113991ef5
26 changed files with 480 additions and 449 deletions
  1. +24
    -24
      README.md
  2. +37
    -37
      daemon/call.c
  3. +1
    -1
      daemon/call.h
  4. +13
    -13
      daemon/crypto.c
  5. +7
    -11
      daemon/kernel.c
  6. +2
    -2
      daemon/kernel.h
  7. +2
    -2
      debian/dkms.conf.in
  8. +54
    -20
      debian/ngcp-rtpengine-daemon.init
  9. +1
    -1
      debian/ngcp-rtpengine-daemon.postinst
  10. +1
    -1
      debian/ngcp-rtpengine-iptables.install
  11. +2
    -2
      debian/rules
  12. +1
    -1
      debian/rules.modules
  13. +7
    -7
      el/README.el.md
  14. +19
    -18
      el/rtpengine.init
  15. +9
    -9
      el/rtpengine.spec
  16. +14
    -14
      iptables-extension/Makefile
  17. +27
    -27
      iptables-extension/libxt_RTPENGINE.c
  18. +7
    -7
      kernel-module/Makefile
  19. +177
    -177
      kernel-module/xt_RTPENGINE.c
  20. +31
    -31
      kernel-module/xt_RTPENGINE.h
  21. +12
    -12
      tests/3-way-connect-simulator
  22. +1
    -1
      tests/blist.pl
  23. +11
    -11
      tests/kernel-module-test.pl
  24. +12
    -12
      tests/reinvite-simulator
  25. +1
    -1
      tests/simulator-udp.pl
  26. +7
    -7
      utils/patch-kernel

+ 24
- 24
README.md View File

@ -129,7 +129,7 @@ There's 3 parts to rtpengine, which can be found in the respective subdirectorie
Required for in-kernel packet forwarding.
With the `iptables` development headers installed, issuing `make` will compile the plugin for
`iptables` and `ip6tables`. The file will be called `libxt_MEDIAPROXY.so` and should be copied
`iptables` and `ip6tables`. The file will be called `libxt_RTPENGINE.so` and should be copied
into the directory `/lib/xtables/`.
* `kernel-module`
@ -142,11 +142,11 @@ There's 3 parts to rtpengine, which can be found in the respective subdirectorie
must be present in `/lib/modules/3.9-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_MEDIAPROXY.ko`. The module can be inserted
into the running kernel manually through `insmod xt_MEDIAPROXY.ko` (which will result in an error if
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
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`. After this, the module can
be loaded by issuing `modprobe xt_MEDIAPROXY`.
be loaded by issuing `modprobe xt_RTPENGINE`.
Usage
=====
@ -366,7 +366,7 @@ eliminated, CPU usage greatly reduced and the number of concurrent calls possibl
In-kernel packet forwarding is implemented as an *iptables* module
(or more precisely, an *x\_tables* module). As such, it comes in two parts, both of
which are required for proper operation. One part is the actual kernel module called `xt_MEDIAPROXY`. The
which are required for proper operation. One part is the actual kernel module called `xt_RTPENGINE`. The
second part is a plugin to the `iptables` and `ip6tables` command-line utilities to make it possible to
actually add the required rule to the tables.
@ -374,9 +374,9 @@ actually add the required rule to the tables.
In short, the prerequisites for in-kernel packet forwarding are:
1. The `xt_MEDIAPROXY` kernel module must be loaded.
1. The `xt_RTPENGINE` kernel module must be loaded.
2. An `iptables` and/or `ip6tables` rule must be present in the `INPUT` chain to send packets
to the `MEDIAPROXY` target. This rule should be limited to UDP packets, but otherwise there
to the `RTPENGINE` target. This rule should be limited to UDP packets, but otherwise there
are no restrictions.
3. The `rtpengine` daemon must be running.
4. All of the above must be set up with the same forwarding table ID (see below).
@ -388,7 +388,7 @@ The sequence of events for a newly established media stream is then:
based on the info received
from the SIP proxy. Only userspace forwarding is set up, nothing is pushed to the kernel module yet.
3. An RTP packet is received on the local port.
4. It traverses the *iptables* chains and gets passed to the *xt\_MEDIAPROXY* module.
4. It traverses the *iptables* chains and gets passed to the *xt\_RTPENGINE* module.
5. The module doesn't recognize it as belonging to an established stream and thus ignores it.
6. The packet continues normal processing and eventually ends up in the daemon's receive queue.
7. The daemon reads it, processes it and forwards it. It also updates some internal data.
@ -414,8 +414,8 @@ 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_MEDIAPROXY`. With the module loaded, a new
directory will appear in `/proc/`, namely `/proc/mediaproxy/`. After loading, the directory will contain
The kernel module can be loaded with the command `modprobe xt_RTPENGINE`. With the module loaded, a new
directory will appear in `/proc/`, namely `/proc/rtpengine/`. After loading, the directory will contain
only two pseudo-files, `control` and `list`. The `control` file is write-only and is used to create and
delete forwarding tables, while the `list` file is read-only and will produce a list of currently
active forwarding tables. With no tables active, it will produce an empty output.
@ -423,16 +423,16 @@ active forwarding tables. With no tables active, it will produce an empty output
The `control` pseudo-file supports two commands, `add` and `del`, each followed by the forwarding table
ID number. To manually create a forwarding table with ID 42, the following command can be used:
echo 'add 42' > /proc/mediaproxy/control
echo 'add 42' > /proc/rtpengine/control
After this, the `list` pseudo-file will produce the single line `42` as output. This will also create a
directory called `42` in `/proc/mediaproxy/`, which contains additional pseudo-files to control this
directory called `42` in `/proc/rtpengine/`, which contains additional pseudo-files to control this
particular forwarding table.
To delete this forwarding table, the command `del 42` can be issued like above. This will only work
if no *rtpengine* daemon is currently running and controlling this table.
Each subdirectory `/proc/mediaproxy/$ID/` corresponding to each fowarding table contains the pseudo-files
Each subdirectory `/proc/rtpengine/$ID/` corresponding to each fowarding table contains the pseudo-files
`blist`, `control`, `list` and `status`. The `control` file is write-only while the others are read-only.
The `control` file will be kept open by the *rtpengine* daemon while it's running to issue updates
to the forwarding rules during runtime. The daemon also reads the `blist` file on a regular basis, which
@ -445,7 +445,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_MEDIAPROXY`, however this only works if no forwarding
The kernel module can be unloaded through `rmmod xt_RTPENGINE`, however this only works if no forwarding
table currently exists and no *iptables* rule currently exists.
### The *iptables* module ###
@ -454,7 +454,7 @@ In order for the kernel module to be able to actually forward packets, an *iptab
to send packets into the module. Each such rule is associated with one forwarding table. In the simplest case,
for forwarding table 42, this can be done through:
iptables -I INPUT -p udp -j MEDIAPROXY --id 42
iptables -I INPUT -p udp -j RTPENGINE --id 42
If IPv6 traffic is expected, the same should be done using `ip6tables`.
@ -470,13 +470,13 @@ Summary
A typical start-up sequence including in-kernel forwarding might look like this:
# this only needs to be one once after system (re-) boot
modprobe xt_MEDIAPROXY
iptables -I INPUT -p udp -j MEDIAPROXY --id 0
ip6tables -I INPUT -p udp -j MEDIAPROXY --id 0
modprobe xt_RTPENGINE
iptables -I INPUT -p udp -j RTPENGINE --id 0
ip6tables -I INPUT -p udp -j RTPENGINE --id 0
# ensure that the table we want to use doesn't exist - usually needed after a daemon
# restart, otherwise will error
echo 'del 0' > /proc/mediaproxy/control
echo 'del 0' > /proc/rtpengine/control
# start daemon
/usr/sbin/rtpengine --table=0 --ip=10.64.73.31 --ip6=2001:db8::4f3:3d \
@ -494,12 +494,12 @@ multiple different kernel forwarding tables.
For example, if one local network interface has address 10.64.73.31 and another has address 192.168.65.73,
then the start-up sequence might look like this:
modprobe xt_MEDIAPROXY
iptables -I INPUT -p udp -d 10.64.73.31 -j MEDIAPROXY --id 0
iptables -I INPUT -p udp -d 192.168.65.73 -j MEDIAPROXY --id 1
modprobe xt_RTPENGINE
iptables -I INPUT -p udp -d 10.64.73.31 -j RTPENGINE --id 0
iptables -I INPUT -p udp -d 192.168.65.73 -j RTPENGINE --id 1
echo 'del 0' > /proc/mediaproxy/control
echo 'del 1' > /proc/mediaproxy/control
echo 'del 0' > /proc/rtpengine/control
echo 'del 1' > /proc/rtpengine/control
/usr/sbin/rtpengine --table=0 --ip=10.64.73.31 \
--listen-ng=127.0.0.1:2223 --tos=184 --pidfile=/var/run/rtpengine-10.pid --no-fallback


+ 37
- 37
daemon/call.c View File

@ -22,7 +22,7 @@
#include "control_tcp.h"
#include "streambuf.h"
#include "redis.h"
#include "xt_MEDIAPROXY.h"
#include "xt_RTPENGINE.h"
#include "bencode.h"
#include "sdp.h"
#include "str.h"
@ -69,7 +69,7 @@ struct xmlrpc_helper {
struct streamhandler_io {
rewrite_func rtp;
rewrite_func rtcp;
int (*kernel)(struct mediaproxy_srtp *, struct packet_stream *);
int (*kernel)(struct rtpengine_srtp *, struct packet_stream *);
};
struct streamhandler {
const struct streamhandler_io *in;
@ -127,9 +127,9 @@ const int num_transport_protocols = G_N_ELEMENTS(transport_protocols);
static void determine_handler(struct packet_stream *in, const struct packet_stream *out);
static int __k_null(struct mediaproxy_srtp *s, struct packet_stream *);
static int __k_srtp_encrypt(struct mediaproxy_srtp *s, struct packet_stream *);
static int __k_srtp_decrypt(struct mediaproxy_srtp *s, struct packet_stream *);
static int __k_null(struct rtpengine_srtp *s, struct packet_stream *);
static int __k_srtp_encrypt(struct rtpengine_srtp *s, struct packet_stream *);
static int __k_srtp_decrypt(struct rtpengine_srtp *s, struct packet_stream *);
static int call_avp2savp_rtp(str *s, struct packet_stream *);
static int call_savp2avp_rtp(str *s, struct packet_stream *);
@ -291,9 +291,9 @@ static const struct streamhandler **__sh_matrix_dtls[] = {
/* ********** */
static const struct mediaproxy_srtp __mps_null = {
.cipher = MPC_NULL,
.hmac = MPH_NULL,
static const struct rtpengine_srtp __res_null = {
.cipher = REC_NULL,
.hmac = REH_NULL,
};
@ -333,7 +333,7 @@ static void stream_fd_closed(int fd, void *p, uintptr_t u) {
INLINE void __mp_address_translate(struct mp_address *o, const struct endpoint *ep) {
INLINE void __re_address_translate(struct re_address *o, const struct endpoint *ep) {
o->family = family_from_address(&ep->ip46);
if (o->family == AF_INET)
o->u.ipv4 = in6_to_4(&ep->ip46);
@ -344,7 +344,7 @@ INLINE void __mp_address_translate(struct mp_address *o, const struct endpoint *
/* called with in_lock held */
void kernelize(struct packet_stream *stream) {
struct mediaproxy_target_info mpt;
struct rtpengine_target_info reti;
struct call *call = stream->call;
struct callmaster *cm = call->callmaster;
struct packet_stream *sink = NULL;
@ -378,50 +378,50 @@ void kernelize(struct packet_stream *stream) {
|| !stream->handler->out->kernel)
goto no_kernel_warn;
ZERO(mpt);
ZERO(reti);
if (PS_ISSET(stream, STRICT_SOURCE) || PS_ISSET(stream, MEDIA_HANDOVER)) {
mutex_lock(&stream->out_lock);
__mp_address_translate(&mpt.expected_src, &stream->endpoint);
__re_address_translate(&reti.expected_src, &stream->endpoint);
mutex_unlock(&stream->out_lock);
if (PS_ISSET(stream, STRICT_SOURCE))
mpt.src_mismatch = MSM_DROP;
reti.src_mismatch = MSM_DROP;
else if (PS_ISSET(stream, MEDIA_HANDOVER))
mpt.src_mismatch = MSM_PROPAGATE;
reti.src_mismatch = MSM_PROPAGATE;
}
mutex_lock(&sink->out_lock);
mpt.target_port = stream->sfd->fd.localport;
mpt.tos = call->tos;
mpt.rtcp_mux = MEDIA_ISSET(stream->media, RTCP_MUX);
mpt.dtls = MEDIA_ISSET(stream->media, DTLS);
mpt.stun = PS_ISSET(stream, STUN);
reti.target_port = stream->sfd->fd.localport;
reti.tos = call->tos;
reti.rtcp_mux = MEDIA_ISSET(stream->media, RTCP_MUX);
reti.dtls = MEDIA_ISSET(stream->media, DTLS);
reti.stun = PS_ISSET(stream, STUN);
__mp_address_translate(&mpt.dst_addr, &sink->endpoint);
__re_address_translate(&reti.dst_addr, &sink->endpoint);
mpt.src_addr.family = mpt.dst_addr.family;
mpt.src_addr.port = sink->sfd->fd.localport;
reti.src_addr.family = reti.dst_addr.family;
reti.src_addr.port = sink->sfd->fd.localport;
ifa = g_atomic_pointer_get(&sink->media->local_address);
if (mpt.src_addr.family == AF_INET)
mpt.src_addr.u.ipv4 = in6_to_4(&ifa->addr);
if (reti.src_addr.family == AF_INET)
reti.src_addr.u.ipv4 = in6_to_4(&ifa->addr);
else
memcpy(mpt.src_addr.u.ipv6, &ifa->addr, sizeof(mpt.src_addr.u.ipv6));
memcpy(reti.src_addr.u.ipv6, &ifa->addr, sizeof(reti.src_addr.u.ipv6));
stream->handler->in->kernel(&mpt.decrypt, stream);
stream->handler->out->kernel(&mpt.encrypt, sink);
stream->handler->in->kernel(&reti.decrypt, stream);
stream->handler->out->kernel(&reti.encrypt, sink);
mutex_unlock(&sink->out_lock);
if (!mpt.encrypt.cipher || !mpt.encrypt.hmac)
if (!reti.encrypt.cipher || !reti.encrypt.hmac)
goto no_kernel_warn;
if (!mpt.decrypt.cipher || !mpt.decrypt.hmac)
if (!reti.decrypt.cipher || !reti.decrypt.hmac)
goto no_kernel_warn;
ZERO(stream->kernel_stats);
kernel_add_stream(cm->conf.kernelfd, &mpt, 0);
kernel_add_stream(cm->conf.kernelfd, &reti, 0);
PS_SET(stream, KERNELIZED);
return;
@ -467,15 +467,15 @@ static int call_savpf2avp_rtcp(str *s, struct packet_stream *stream) {
}
static int __k_null(struct mediaproxy_srtp *s, struct packet_stream *stream) {
*s = __mps_null;
static int __k_null(struct rtpengine_srtp *s, struct packet_stream *stream) {
*s = __res_null;
return 0;
}
static int __k_srtp_crypt(struct mediaproxy_srtp *s, struct crypto_context *c) {
static int __k_srtp_crypt(struct rtpengine_srtp *s, struct crypto_context *c) {
if (!c->params.crypto_suite)
return -1;
*s = (struct mediaproxy_srtp) {
*s = (struct rtpengine_srtp) {
.cipher = c->params.crypto_suite->kernel_cipher,
.hmac = c->params.crypto_suite->kernel_hmac,
.mki_len = c->params.mki_len,
@ -488,10 +488,10 @@ static int __k_srtp_crypt(struct mediaproxy_srtp *s, struct crypto_context *c) {
memcpy(s->master_salt, c->params.master_salt, c->params.crypto_suite->master_salt_len);
return 0;
}
static int __k_srtp_encrypt(struct mediaproxy_srtp *s, struct packet_stream *stream) {
static int __k_srtp_encrypt(struct rtpengine_srtp *s, struct packet_stream *stream) {
return __k_srtp_crypt(s, &stream->crypto);
}
static int __k_srtp_decrypt(struct mediaproxy_srtp *s, struct packet_stream *stream) {
static int __k_srtp_decrypt(struct rtpengine_srtp *s, struct packet_stream *stream) {
return __k_srtp_crypt(s, &stream->sfd->crypto);
}
@ -1243,7 +1243,7 @@ static void callmaster_timer(void *ptr) {
struct callmaster *m = ptr;
struct iterator_helper hlp;
GList *i;
struct mediaproxy_list_entry *ke;
struct rtpengine_list_entry *ke;
struct packet_stream *ps, *sink;
u_int64_t d;
struct stats tmpstats;


+ 1
- 1
daemon/call.h View File

@ -148,7 +148,7 @@ struct control_stream;
struct call;
struct redis;
struct crypto_suite;
struct mediaproxy_srtp;
struct rtpengine_srtp;
struct streamhandler;
struct sdp_ng_flags;
struct local_interface;


+ 13
- 13
daemon/crypto.c View File

@ -5,7 +5,7 @@
#include <openssl/hmac.h>
#include <glib.h>
#include "xt_MEDIAPROXY.h"
#include "xt_RTPENGINE.h"
#include "str.h"
#include "aux.h"
@ -43,8 +43,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 14,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_AES_CM,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_AES_CM,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 10,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,
@ -67,8 +67,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 14,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_AES_CM,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_AES_CM,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 4,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,
@ -91,8 +91,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 14,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_AES_F8,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_AES_F8,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 10,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,
@ -115,8 +115,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 14,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_AES_F8,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_AES_F8,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 4,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,
@ -139,8 +139,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 0,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_NULL,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_NULL,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 10,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,
@ -162,8 +162,8 @@ const struct crypto_suite crypto_suites[] = {
.session_salt_len = 0,
.srtp_lifetime = 1ULL << 48,
.srtcp_lifetime = 1ULL << 31,
.kernel_cipher = MPC_NULL,
.kernel_hmac = MPH_HMAC_SHA1,
.kernel_cipher = REC_NULL,
.kernel_hmac = REH_HMAC_SHA1,
.srtp_auth_tag = 4,
.srtcp_auth_tag = 10,
.srtp_auth_key_len = 20,


+ 7
- 11
daemon/kernel.c View File

@ -9,7 +9,7 @@
#include <glib.h>
#include <errno.h>
#include "xt_MEDIAPROXY.h"
#include "xt_RTPENGINE.h"
#include "aux.h"
#include "log.h"
@ -17,11 +17,7 @@
#if 1
#define PREFIX "/proc/mediaproxy"
#else
#define PREFIX "/tmp/mediaproxy"
#endif
#define PREFIX "/proc/rtpengine"
@ -52,7 +48,7 @@ fail:
int kernel_open_table(unsigned int id) {
char str[64];
int fd;
struct mediaproxy_message msg;
struct rtpengine_message msg;
int i;
sprintf(str, PREFIX "/%u/control", id);
@ -74,8 +70,8 @@ fail:
}
int kernel_add_stream(int fd, struct mediaproxy_target_info *mti, int update) {
struct mediaproxy_message msg;
int kernel_add_stream(int fd, struct rtpengine_target_info *mti, int update) {
struct rtpengine_message msg;
int ret;
msg.cmd = update ? MMG_UPDATE : MMG_ADD;
@ -91,7 +87,7 @@ int kernel_add_stream(int fd, struct mediaproxy_target_info *mti, int update) {
int kernel_del_stream(int fd, u_int16_t p) {
struct mediaproxy_message msg;
struct rtpengine_message msg;
int ret;
ZERO(msg);
@ -110,7 +106,7 @@ int kernel_del_stream(int fd, u_int16_t p) {
GList *kernel_list(unsigned int id) {
char str[64];
int fd;
struct mediaproxy_list_entry *buf;
struct rtpengine_list_entry *buf;
GList *li = NULL;
int ret;


+ 2
- 2
daemon/kernel.h View File

@ -10,14 +10,14 @@
struct mediaproxy_target_info;
struct rtpengine_target_info;
int kernel_create_table(unsigned int);
int kernel_open_table(unsigned int);
int kernel_add_stream(int, struct mediaproxy_target_info *, int);
int kernel_add_stream(int, struct rtpengine_target_info *, int);
int kernel_del_stream(int, u_int16_t);
GList *kernel_list(unsigned int);


+ 2
- 2
debian/dkms.conf.in View File

@ -1,7 +1,7 @@
PACKAGE_NAME="ngcp-rtpengine"
PACKAGE_VERSION="__VERSION__"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build MEDIAPROXY_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_MEDIAPROXY"
BUILT_MODULE_NAME[0]="xt_RTPENGINE"
DEST_MODULE_LOCATION[0]=/extra

+ 54
- 20
debian/ngcp-rtpengine-daemon.init View File

@ -98,20 +98,31 @@ case "$1" in
echo -n "Starting $DESC: $NAME"
if [ "$TABLE" -ge 0 ] && [ "$VIRT" != "yes" ]; then
set +e
modprobe xt_MEDIAPROXY
modprobe xt_RTPENGINE
if [ -e /proc/mediaproxy/control ]; then
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
fi
iptables -N mediaproxy 2> /dev/null
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" > /proc/rtpengine/control 2>/dev/null
fi
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -I INPUT -j mediaproxy
iptables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
iptables -I mediaproxy -p udp -j MEDIAPROXY --id "$TABLE"
ip6tables -N mediaproxy 2> /dev/null
iptables -F mediaproxy 2> /dev/null
iptables -X mediaproxy 2> /dev/null
ip6tables -D INPUT -j mediaproxy 2> /dev/null
ip6tables -I INPUT -j mediaproxy
ip6tables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
ip6tables -I mediaproxy -p udp -j MEDIAPROXY --id "$TABLE"
ip6tables -F mediaproxy 2> /dev/null
ip6tables -X mediaproxy 2> /dev/null
rmmod xt_MEDIAPROXY 2>/dev/null
iptables -N rtpengine 2> /dev/null
iptables -D INPUT -j rtpengine 2> /dev/null
iptables -I INPUT -j rtpengine
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2> /dev/null
ip6tables -D INPUT -j rtpengine 2> /dev/null
ip6tables -I INPUT -j rtpengine
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
set -e
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE \
@ -130,11 +141,22 @@ case "$1" in
if [ -e /proc/mediaproxy/control ]; then
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
fi
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" > /proc/rtpengine/control 2>/dev/null
fi
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -F mediaproxy 2> /dev/null
iptables -X mediaproxy 2> /dev/null
ip6tables -D INPUT -j mediaproxy 2> /dev/null
ip6tables -F mediaproxy 2> /dev/null
ip6tables -X mediaproxy 2> /dev/null
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D INPUT -j mediaproxy 2> /dev/null
ip6tables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
rmmod xt_MEDIAPROXY 2>/dev/null
rmmod xt_RTPENGINE 2>/dev/null
set -e
fi
rm -f $PIDFILE
@ -168,18 +190,30 @@ case "$1" in
if [ -e /proc/mediaproxy/control ]; then
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
fi
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" > /proc/rtpengine/control 2>/dev/null
fi
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
iptables -F mediaproxy 2> /dev/null
iptables -X mediaproxy 2> /dev/null
ip6tables -D INPUT -j mediaproxy 2> /dev/null
ip6tables -D mediaproxy -p udp -j MEDIAPROXY --id "$TABLE" 2>/dev/null
ip6tables -F mediaproxy 2> /dev/null
ip6tables -X mediaproxy 2> /dev/null
rmmod xt_MEDIAPROXY 2>/dev/null
modprobe xt_MEDIAPROXY
iptables -N mediaproxy 2> /dev/null
iptables -I INPUT -j mediaproxy
iptables -I mediaproxy -p udp -j MEDIAPROXY --id "$TABLE"
ip6tables -N mediaproxy 2> /dev/null
ip6tables -I INPUT -j mediaproxy
ip6tables -I mediaproxy -p udp -j MEDIAPROXY --id "$TABLE"
iptables -D INPUT -j rtpengine 2> /dev/null
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D INPUT -j rtpengine 2> /dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
rmmod xt_RTPENGINE 2>/dev/null
modprobe xt_RTPENGINE
iptables -N rtpengine 2> /dev/null
iptables -I INPUT -j rtpengine
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2> /dev/null
ip6tables -I INPUT -j rtpengine
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
set -e
fi
start-stop-daemon --start --quiet --pidfile \


+ 1
- 1
debian/ngcp-rtpengine-daemon.postinst View File

@ -3,7 +3,7 @@
set -e
default=/etc/default/ngcp-rtpengine-daemon
modname=xt_MEDIAPROXY
modname=xt_RTPENGINE
if [ -x /usr/sbin/ngcp-virt-identify ]; then
if /usr/sbin/ngcp-virt-identify --type container; then


+ 1
- 1
debian/ngcp-rtpengine-iptables.install View File

@ -1 +1 @@
iptables-extension/libxt_MEDIAPROXY.so /lib/xtables/
iptables-extension/libxt_RTPENGINE.so /lib/xtables/

+ 2
- 2
debian/rules View File

@ -45,8 +45,8 @@ clean:
dh_testroot
cd daemon && $(MAKE) clean && cd ..
rm -f build-stamp
rm -f iptables-extension/libxt_MEDIAPROXY.so
rm -f daemon/rtpengine daemon/build_time.h daemon/.depend kernel-module/.xt_MEDIAPROXY.o.d
rm -f iptables-extension/libxt_RTPENGINE.so
rm -f daemon/rtpengine daemon/build_time.h daemon/.depend kernel-module/.xt_RTPENGINE.o.d
rm -rf kernel-module/.tmp_versions
rm -f debian/README.html.gz debian/README.md.gz
dh_clean


+ 1
- 1
debian/rules.modules View File

@ -62,7 +62,7 @@ binary-modules: prep-deb-files
$(MAKE) modules KSRC=$(KSRC) KVER=$(KVERS)
# Install the module
install -D -m 0644 xt_MEDIAPROXY.ko debian/$(PACKAGE)-$(KVERS)/lib/modules/$(KVERS)/extra/xt_MEDIAPROXY.ko
install -D -m 0644 xt_RTPENGINE.ko debian/$(PACKAGE)-$(KVERS)/lib/modules/$(KVERS)/extra/xt_RTPENGINE.ko
dh_installdocs
dh_installchangelogs


+ 7
- 7
el/README.el.md View File

@ -62,7 +62,7 @@ respective subdirectories.
* `daemon`
The userspace daemon and workhorse, minimum requirement for anything
to work. Running `MEDIAPROXY_VERSION="\"<version number>\"" make` will
to work. Running `RTPENGINE_VERSION="\"<version number>\"" make` will
compile the binary, which will be called `rtpengine`. The
following software packages are required to compile the daemon:
@ -79,9 +79,9 @@ respective subdirectories.
* `iptables-extension`
Required for in-kernel packet forwarding. Running
`MEDIAPROXY_VERSION="\"<version number>\"" make` will compile the plugin
`RTPENGINE_VERSION="\"<version number>\"" make` will compile the plugin
for `iptables` and `ip6tables`. The file will be called
`libxt_MEDIAPROXY.so` and should be copied into the directory
`libxt_RTPENGINE.so` and should be copied into the directory
`/lib/xtables/` in 32-bit environments and `/lib64/xtables/` in 64-bit
environments. The following software packages are required to compile
the plugin:
@ -95,17 +95,17 @@ respective subdirectories.
Required for in-kernel packet forwarding. Compilation of the kernel
module requires the kernel development packages for the kernel version
you are using (see output of `uname -r`) to be installed. Running
`MEDIAPROXY_VERSION="\"<version number>\"" make` will compile the kernel
`RTPENGINE_VERSION="\"<version number>\"" make` will compile the kernel
module.
Successful compilation of the module will produce the file
`xt_MEDIAPROXY.ko`. The module can be inserted into the running kernel
manually through `insmod xt_MEDIAPROXY.ko` (which will result in an
`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 depending modules aren't loaded, for example the `x_tables`
module), but it's recommended to copy the module into
`/lib/modules/<version number>/updates/`, followed by running
`depmod -a`. After this, the module can be loaded by issuing
`modprobe xt_MEDIAPROXY`.
`modprobe xt_RTPENGINE`.
The following software packages are required to compile the plugin:


+ 19
- 18
el/rtpengine.init View File

@ -27,7 +27,7 @@ else
exit -1
fi
mediaproxy_ng=/usr/sbin/rtpengine
rtpengine=/usr/sbin/rtpengine
prog=rtpengine
pidfile=${PIDFILE-/var/run/rtpengine.pid}
lockfile=${LOCKFILE-/var/lock/subsys/rtpengine}
@ -153,13 +153,14 @@ start() {
if [[ $MODULE == 1 ]]
then
echo "Loading module for in-kernel packet forwarding"
modprobe xt_MEDIAPROXY
iptables -N mediaproxy
iptables -t filter -A INPUT -j mediaproxy
iptables -I mediaproxy -p udp -j MEDIAPROXY --id $TABLE
if [[ IP6 == 1 ]]
rmmod xt_MEDIAPROXY 2> /dev/null
modprobe xt_RTPENGINE
iptables -N rtpengine
iptables -t filter -A INPUT -j rtpengine
iptables -I rtpengine -p udp -j RTPENGINE --id $TABLE
if [[ $IP6 == 1 ]]
then
ip6tables -I mediaproxy -p udp -j MEDIAPROXY --id $TABLE
ip6tables -I rtpengine -p udp -j RTPENGINE --id $TABLE
fi
cat <<EOF > "$cachefile"
@ -168,7 +169,7 @@ CUR_IP6=$IP6
EOF
fi
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $mediaproxy_ng $OPTS
daemon --pidfile=${pidfile} $rtpengine $OPTS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
@ -177,22 +178,22 @@ EOF
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} $mediaproxy_ng
killproc -p ${pidfile} $rtpengine
RETVAL=$?
echo
if [ -f "$cachefile" ]
then
. "$cachefile"
echo "Unloading module for in-kernel packet forwarding"
echo "del $TABLE" > /proc/mediaproxy/control
iptables -D mediaproxy -p udp -j MEDIAPROXY --id $CUR_TABLE
if [[ CUR_IP6 == 1 ]]
echo "del $TABLE" > /proc/rtpengine/control
iptables -D rtpengine -p udp -j RTPENGINE --id $CUR_TABLE
if [[ $CUR_IP6 == 1 ]]
then
ip6tables -D mediaproxy -p udp -j MEDIAPROXY --id $CUR_TABLE
ip6tables -D rtpengine -p udp -j RTPENGINE --id $CUR_TABLE
fi
iptables -t filter -D INPUT -j mediaproxy
iptables -X mediaproxy
# rmmod xt_MEDIAPROXY
iptables -t filter -D INPUT -j rtpengine
iptables -X rtpengine
# rmmod xt_RTPENGINE
rm -f $cachefile
fi
@ -208,7 +209,7 @@ case "$1" in
stop
;;
status)
status -p ${pidfile} $mediaproxy_ng
status -p ${pidfile} $rtpengine
RETVAL=$?
;;
restart)
@ -216,7 +217,7 @@ case "$1" in
start
;;
condrestart|try-restart)
if status -p ${pidfile} $mediaproxy_ng >&/dev/null; then
if status -p ${pidfile} $rtpengine >&/dev/null; then
stop
start
fi


+ 9
- 9
el/rtpengine.spec View File

@ -52,9 +52,9 @@ Kernel module for rtpengine in-kernel packet forwarding
%build
cd daemon
MEDIAPROXY_VERSION="\"%{version}-%{release}\"" make
RTPENGINE_VERSION="\"%{version}-%{release}\"" make
cd ../iptables-extension
MEDIAPROXY_VERSION="\"%{version}-%{release}\"" make
RTPENGINE_VERSION="\"%{version}-%{release}\"" make
cd ..
@ -70,16 +70,16 @@ install -D -p -m644 el/rtpengine.sysconfig \
mkdir -p %{buildroot}/%{_sharedstatedir}/rtpengine
# Install the iptables plugin
install -D -p -m755 iptables-extension/libxt_MEDIAPROXY.so \
%{buildroot}/%{_lib}/xtables/libxt_MEDIAPROXY.so
install -D -p -m755 iptables-extension/libxt_RTPENGINE.so \
%{buildroot}/%{_lib}/xtables/libxt_RTPENGINE.so
## DKMS module source install
install -D -p -m644 kernel-module/Makefile \
%{buildroot}/%{_usrsrc}/%{name}-%{version}-%{release}/Makefile
install -D -p -m644 kernel-module/xt_MEDIAPROXY.c \
%{buildroot}/%{_usrsrc}/%{name}-%{version}-%{release}/xt_MEDIAPROXY.c
install -D -p -m644 kernel-module/xt_MEDIAPROXY.h \
%{buildroot}/%{_usrsrc}/%{name}-%{version}-%{release}/xt_MEDIAPROXY.h
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
sed "s/__VERSION__/%{version}-%{release}/g" debian/dkms.conf.in > \
%{buildroot}/%{_usrsrc}/%{name}-%{version}-%{release}/dkms.conf
@ -136,7 +136,7 @@ true
%files kernel
/%{_lib}/xtables/libxt_MEDIAPROXY.so
/%{_lib}/xtables/libxt_RTPENGINE.so
%files dkms


+ 14
- 14
iptables-extension/Makefile View File

@ -1,12 +1,12 @@
CFLAGS = -O2 -Wall -shared -fPIC
ifneq ($(MEDIAPROXY_VERSION),)
CFLAGS += -DMEDIAPROXY_VERSION="\"$(MEDIAPROXY_VERSION)\""
ifneq ($(RTPENGINE_VERSION),)
CFLAGS += -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
else
DPKG_PRSCHNGLG= $(shell which dpkg-parsechangelog 2>/dev/null)
ifneq ($(DPKG_PRSCHNGLG),)
CFLAGS += -DMEDIAPROXY_VERSION="\"$(shell dpkg-parsechangelog -l../debian/changelog | awk '/^Version: / {print $$2}')\""
CFLAGS += -DRTPENGINE_VERSION="\"$(shell dpkg-parsechangelog -l../debian/changelog | awk '/^Version: / {print $$2}')\""
else
CFLAGS += -DMEDIAPROXY_VERSION="\"undefined\""
CFLAGS += -DRTPENGINE_VERSION="\"undefined\""
endif
endif
@ -23,27 +23,27 @@ all: module
ifeq ($(XTABLES),1)
WORK=1
module: libxt_MEDIAPROXY.so
module: libxt_RTPENGINE.so
libxt_MEDIAPROXY.so: libxt_MEDIAPROXY.c
gcc $(CFLAGS) -o libxt_MEDIAPROXY.so libxt_MEDIAPROXY.c
libxt_RTPENGINE.so: libxt_RTPENGINE.c
gcc $(CFLAGS) -o libxt_RTPENGINE.so libxt_RTPENGINE.c
else
ifeq ($(IPTABLES),1)
WORK=1
module: libipt_MEDIAPROXY.so
module: libipt_RTPENGINE.so
endif
ifeq ($(IP6TABLES),1)
WORK=1
module: libip6t_MEDIAPROXY.so
module: libip6t_RTPENGINE.so
endif
libipt_MEDIAPROXY.so: libxt_MEDIAPROXY.c
gcc $(CFLAGS) -D__ipt -o libipt_MEDIAPROXY.so libxt_MEDIAPROXY.c
libipt_RTPENGINE.so: libxt_RTPENGINE.c
gcc $(CFLAGS) -D__ipt -o libipt_RTPENGINE.so libxt_RTPENGINE.c
libip6t_MEDIAPROXY.so: libxt_MEDIAPROXY.c
gcc $(CFLAGS) -D__ip6t -o libip6t_MEDIAPROXY.so libxt_MEDIAPROXY.c
libip6t_RTPENGINE.so: libxt_RTPENGINE.c
gcc $(CFLAGS) -D__ip6t -o libip6t_RTPENGINE.so libxt_RTPENGINE.c
endif
@ -53,4 +53,4 @@ module:
endif
clean:
rm -f libxt_MEDIAPROXY.so libipt_MEDIAPROXY.so libip6t_MEDIAPROXY.so
rm -f libxt_RTPENGINE.so libipt_RTPENGINE.so libip6t_RTPENGINE.so

iptables-extension/libxt_MEDIAPROXY.c → iptables-extension/libxt_RTPENGINE.c View File


+ 7
- 7
kernel-module/Makefile View File

@ -2,19 +2,19 @@ PWD := $(shell pwd)
KSRC ?= /lib/modules/$(shell uname -r)/build
KBUILD := $(KSRC)
ifneq ($(MEDIAPROXY_VERSION),)
EXTRA_CFLAGS += -DMEDIAPROXY_VERSION="\"$(MEDIAPROXY_VERSION)\""
ifneq ($(RTPENGINE_VERSION),)
EXTRA_CFLAGS += -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
else
DPKG_PRSCHNGLG= $(shell which dpkg-parsechangelog 2>/dev/null)
ifneq ($(DPKG_PRSCHNGLG),)
EXTRA_CFLAGS += -DMEDIAPROXY_VERSION="\"$(shell dpkg-parsechangelog -l$(M)/../debian/changelog | awk '/^Version: / {print $$2}')\""
EXTRA_CFLAGS += -DRTPENGINE_VERSION="\"$(shell dpkg-parsechangelog -l$(M)/../debian/changelog | awk '/^Version: / {print $$2}')\""
else
EXTRA_CFLAGS += -DMEDIAPROXY_VERSION="\"undefined\""
EXTRA_CFLAGS += -DRTPENGINE_VERSION="\"undefined\""
endif
endif
EXTRA_CFLAGS += -D__MP_EXTERNAL
EXTRA_CFLAGS += -D__RE_EXTERNAL
obj-m += xt_MEDIAPROXY.o
obj-m += xt_RTPENGINE.o
.PHONY: modules clean patch
@ -25,4 +25,4 @@ clean:
make -C $(KBUILD) M=$(PWD) clean
patch:
../utils/patch-kernel magic "$(PWD)" "$(KERNEL)" "$(MEDIAPROXY_VERSION)"
../utils/patch-kernel magic "$(PWD)" "$(KERNEL)" "$(RTPENGINE_VERSION)"

kernel-module/xt_MEDIAPROXY.c → kernel-module/xt_RTPENGINE.c View File


kernel-module/xt_MEDIAPROXY.h → kernel-module/xt_RTPENGINE.h View File


+ 12
- 12
tests/3-way-connect-simulator View File

@ -120,14 +120,14 @@ print("A tells B: send RTP to $lp1\n");
brk();
my ($mpip1, $mpport1) = sim_rq($callid1, $local_ip, $lp1, $fromtag1);
print("mediaproxy: tell B to send to $mpport1 instead of $lp1\n");
print("rtpengine: tell B to send to $mpport1 instead of $lp1\n");
brk();
print("B tells A: send RTP to $lp2\n");
brk();
my ($mpip2, $mpport2) = sim_lk($callid1, $local_ip, $lp2, $fromtag1, $totag1);
print("mediaproxy: tell A to send to $mpport2 instead of $lp2\n");
print("rtpengine: tell A to send to $mpport2 instead of $lp2\n");
brk();
send_rcv4($client2, $mpip1, $mpport1, $client1, $mpip2, $mpport2);
@ -146,14 +146,14 @@ print("B tells A: send RTP to 0.0.0.0\n");
brk();
my ($mpip3, $mpport3) = sim_rq($callid1, '0.0.0.0', $lp2, $totag1, $fromtag1);
print("mediaproxy: tell A to send to $mpip3:$mpport3 instead of 0.0.0.0:$lp2\n");
print("rtpengine: tell A to send to $mpip3:$mpport3 instead of 0.0.0.0:$lp2\n");
brk();
print("A tells B: send RTP to 0.0.0.0\n");
brk();
my ($mpip4, $mpport4) = sim_lk($callid1, '0.0.0.0', $lp1, $totag1, $fromtag1);
print("mediaproxy: tell B to send to $mpip4:$mpport4 instead of 0.0.0.0:$lp1\n");
print("rtpengine: tell B to send to $mpip4:$mpport4 instead of 0.0.0.0:$lp1\n");
brk();
@ -168,14 +168,14 @@ print("B tells C: send RTP to $lp3\n");
brk();
my ($mpip5, $mpport5) = sim_rq($callid2, $local_ip, $lp3, $fromtag2);
print("mediaproxy: tell C to send to $mpport5 instead of $lp3\n");
print("rtpengine: tell C to send to $mpport5 instead of $lp3\n");
brk();
print("C tells B: send RTP to $lp4\n");
brk();
my ($mpip6, $mpport6) = sim_lk($callid2, $local_ip, $lp4, $fromtag2, $totag2);
print("mediaproxy: tell B to send to $mpport6 instead of $lp4\n");
print("rtpengine: tell B to send to $mpport6 instead of $lp4\n");
brk();
send_rcv4($client4, $mpip5, $mpport5, $client3, $mpip6, $mpport6);
@ -194,14 +194,14 @@ print("B tells A: send RTP to $lp2\n");
brk();
my ($mpip7, $mpport7) = sim_rq($callid1, $local_ip, $lp2, $totag1, $fromtag1);
print("mediaproxy: tell A to send to $mpport7 instead of $lp2\n");
print("rtpengine: tell A to send to $mpport7 instead of $lp2\n");
brk();
print("A tells B: send RTP to $lp1\n");
brk();
my ($mpip8, $mpport8) = sim_lk($callid1, $local_ip, $lp1, $totag1, $fromtag1);
print("mediaproxy: tell B to send to $mpport8 instead of $lp1\n");
print("rtpengine: tell B to send to $mpport8 instead of $lp1\n");
brk();
send_rcv4($client2, $mpip1, $mpport1, $client1, $mpip2, $mpport2);
@ -218,19 +218,19 @@ print("B tells C [call 2]: send RTP to $mpip8:$mpport8\n");
brk();
my ($mpip9, $mpport9) = sim_rq($callid2, $mpip8, $mpport8, $fromtag2, $totag2);
print("mediaproxy: tell C to send to $mpport9 instead of $mpip8:$mpport8\n");
print("rtpengine: tell C to send to $mpport9 instead of $mpip8:$mpport8\n");
brk();
print("C tells B: send RTP to $lp4\n");
my ($mpip10, $mpport10) = sim_lk($callid2, $local_ip, $lp4, $fromtag2, $totag2);
print("mediaproxy: tell B to send to $mpport10 instead of $lp4\n");
print("rtpengine: tell B to send to $mpport10 instead of $lp4\n");
brk();
print("B tells A [call 1]: send RTP to $mpip10:$mpport10\n");
my ($mpip11, $mpport11) = sim_rq($callid1, $mpip10, $mpport10, $totag1, $fromtag1);
print("mediaproxy: tell A to send to $mpport11 instead of $mpip10:$mpport10\n");
print("rtpengine: tell A to send to $mpport11 instead of $mpip10:$mpport10\n");
brk();
if (1) {
@ -240,7 +240,7 @@ if (1) {
print("A tells B: send RTP to $lp1\n");
my ($mpip12, $mpport12) = sim_lk($callid1, $local_ip, $lp1, $totag1, $fromtag1);
print("mediaproxy: tell B to send to $mpport12 instead of $lp1\n");
print("rtpengine: tell B to send to $mpport12 instead of $lp1\n");
brk();
send_rcv4($client4, $mpip9, $mpport9, $client1, $mpip11, $mpport11);

+ 1
- 1
tests/blist.pl View File

@ -10,7 +10,7 @@ my $t = $ARGV[0] || "0";
my $format = 'SS ia16SS ia16SS ia16SS CCCC LLLLLL';
my $len = length(pack($format, (0) x 100));
open(X, "<", "/proc/mediaproxy/$t/blist") or die;
open(X, "<", "/proc/rtpengine/$t/blist") or die;
my $buf;
while (sysread(X, $buf, $len)) {
my @b = unpack($format, $buf);


+ 11
- 11
tests/kernel-module-test.pl View File

@ -10,7 +10,7 @@ my %ciphers = ('null' => 1, 'aes-cm' => 2, 'aes-f8' => 3);
my %hmacs = ('null' => 1, 'hmac-sha1' => 2);
$| = 1;
open(F, "> /proc/mediaproxy/0/control") or die;
open(F, "> /proc/rtpengine/0/control") or die;
{
my $x = select(F);
$| = 1;
@ -39,7 +39,7 @@ sub mp_srtp {
@$h{qw(master_key master_salt mki last_index auth_tag_len mki_len)});
use warnings;
}
sub mediaproxy_message {
sub rtpengine_message {
my ($cmd, $target_port,
$src_addr_family, $src_addr_addr, $src_addr_port,
$dst_addr_family, $dst_addr_addr, $dst_addr_port,
@ -69,39 +69,39 @@ my $dec = {cipher => 'null', hmac => 'null'};
my $enc = {cipher => 'null', hmac => 'null'};
print("add 9876 -> 1234/6543\n");
syswrite(F, mediaproxy_message('add', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
syswrite(F, rtpengine_message('add', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
sleep($sleep);
print("add fail\n");
syswrite(F, mediaproxy_message('add', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
syswrite(F, rtpengine_message('add', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
sleep($sleep);
print("update 9876 -> 1234/6543 & 6789\n");
syswrite(F, mediaproxy_message('update', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
syswrite(F, rtpengine_message('update', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
sleep($sleep);
print("update 9876 -> 2345/7890 & 4321\n");
syswrite(F, mediaproxy_message('update', 9876, @src, 2345, @dst, 7890, @dst, 4321, 184, $dec, $enc));
syswrite(F, rtpengine_message('update', 9876, @src, 2345, @dst, 7890, @dst, 4321, 184, $dec, $enc));
sleep($sleep);
print("add fail\n");
syswrite(F, mediaproxy_message('add', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
syswrite(F, rtpengine_message('add', 9876, @src, 1234, @dst, 6543, @dst, 6789, 184, $dec, $enc));
sleep($sleep);
print("update 9876 -> 1234/6543\n");
syswrite(F, mediaproxy_message('update', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
syswrite(F, rtpengine_message('update', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
sleep($sleep);
print("delete\n");
syswrite(F, mediaproxy_message('delete', 9876, @nul, @nul, @nul, 0, $dec, $enc));
syswrite(F, rtpengine_message('delete', 9876, @nul, @nul, @nul, 0, $dec, $enc));
sleep($sleep);
print("delete fail\n");
syswrite(F, mediaproxy_message('delete', 9876, @nul, @nul, @nul, 0, $dec, $enc));
syswrite(F, rtpengine_message('delete', 9876, @nul, @nul, @nul, 0, $dec, $enc));
sleep($sleep);
print("update fail\n");
syswrite(F, mediaproxy_message('update', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
syswrite(F, rtpengine_message('update', 9876, @src, 1234, @dst, 6543, @nul, 184, $dec, $enc));
sleep($sleep);
close(F);

+ 12
- 12
tests/reinvite-simulator View File

@ -126,14 +126,14 @@ brk();
brk();
my ($mpip1, $mpport1) = sim_rq($callid, $local_ip, $lp1, $fromtag);
print("mediaproxy: tell B to send to $mpport1 instead of $lp1\n");
print("rtpengine: tell B to send to $mpport1 instead of $lp1\n");
brk();
print("B tells A: send RTP to $lp2\n");
brk();
my ($mpip2, $mpport2) = sim_lk($callid, $local_ip, $lp2, $fromtag, $totag);
print("mediaproxy: tell A to send to $mpport2 instead of $lp2\n");
print("rtpengine: tell A to send to $mpport2 instead of $lp2\n");
brk();
send_rcv4($client2, $mpip1, $mpport1, $client1, $mpip2, $mpport2);
@ -203,14 +203,14 @@ for my $case (0 .. 3) {
brk();
my ($mpip1, $mpport1) = sim_rq($callid, $local_ip, $$p1, $ft);
print("mediaproxy: tell $dst to send to $mpport1 instead of $$p1\n");
print("rtpengine: tell $dst to send to $mpport1 instead of $$p1\n");
brk();
print("$dst tells $src: send RTP to $$p2\n");
brk();
my ($mpip2, $mpport2) = sim_lk($callid, $local_ip, $$p2, $ft, $tt);
print("mediaproxy: tell $src to send to $mpport2 instead of $$p2\n");
print("rtpengine: tell $src to send to $mpport2 instead of $$p2\n");
brk();
send_rcv4($$c2, $mpip1, $mpport1, $$c1, $mpip2, $mpport2);
@ -238,7 +238,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip1, $mpport1) = sim_rq($callid, $local_ip, $$p1, $ft);
print("mediaproxy: tell $dst to send to $mpport1 instead of $$p1\n");
print("rtpengine: tell $dst to send to $mpport1 instead of $$p1\n");
brk();
for (1 .. 4) {
@ -249,7 +249,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip2, $mpport2) = sim_lk($callid, $local_ip, $$p2, $ft, $tt);
print("mediaproxy: tell $src to send to $mpport2 instead of $$p2\n");
print("rtpengine: tell $src to send to $mpport2 instead of $$p2\n");
brk();
send_rcv4($$c2, $mpip1, $mpport1, $$c1, $mpip2, $mpport2);
@ -269,7 +269,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip3, $mpport3) = sim_rq($callid, $local_ip, $$p1, $ft);
print("mediaproxy: tell $dst to send to $mpport3 instead of $$p1\n");
print("rtpengine: tell $dst to send to $mpport3 instead of $$p1\n");
brk();
send_rcv4($$c2, $mpip1, $mpport1, $$c1, $mpip2, $mpport2);
@ -280,7 +280,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip4, $mpport4) = sim_lk($callid, $local_ip, $$p2, $ft, $tt);
print("mediaproxy: tell $src to send to $mpport4 instead of $$p2\n");
print("rtpengine: tell $src to send to $mpport4 instead of $$p2\n");
brk();
send_rcv4($$c2, $mpip3, $mpport3, $$c1, $mpip2, $mpport2);
@ -302,7 +302,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip5, $mpport5) = sim_rq($callid, $local_ip, $$p1, $ft);
print("mediaproxy: tell $dst to send to $mpport5 instead of $$p1\n");
print("rtpengine: tell $dst to send to $mpport5 instead of $$p1\n");
brk();
for (1 .. 4) {
@ -317,7 +317,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip6, $mpport6) = sim_lk($callid, $local_ip, $$p2, $ft, $tt);
print("mediaproxy: tell $src to send to $mpport6 instead of $$p2\n");
print("rtpengine: tell $src to send to $mpport6 instead of $$p2\n");
brk();
for (1 .. 4) {
@ -341,7 +341,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip7, $mpport7) = sim_rq($callid, $local_ip, $$p1, $ft);
print("mediaproxy: tell $dst to send to $mpport7 instead of $$p1\n");
print("rtpengine: tell $dst to send to $mpport7 instead of $$p1\n");
brk();
for (1 .. 4) {
@ -352,7 +352,7 @@ for my $case (0 .. 3) {
brk();
my ($mpip8, $mpport8) = sim_lk($callid, $local_ip, $$p2, $ft, $tt);
print("mediaproxy: tell $src to send to $mpport8 instead of $$p2\n");
print("rtpengine: tell $src to send to $mpport8 instead of $$p2\n");
brk();
for (1 .. 4) {


+ 1
- 1
tests/simulator-udp.pl View File

@ -156,7 +156,7 @@ sub update_lookup {
my $tagstr = ($i == 1 ? "$$tags[0];1 " : '') . "$$tags[$i];1";
my $o = msg("$prefixes[$i] $callid $$ips[$i] $$ports[$i] $tagstr");
$o =~ /^(\d+) ([\d.a-f:]+) ([46])[\r\n]*$/is or die $o;
$1 == 0 and die "mediaproxy ran out of ports";
$1 == 0 and die "rtpengine ran out of ports";
$3 ne $$pr_o{reply} and die "incorrect address family reply code";
$$c[4][$i] = [$1,$2];
}


+ 7
- 7
utils/patch-kernel View File

@ -27,21 +27,21 @@ done
set -e
cp -v xt_MEDIAPROXY.h "$KERN"/include/linux/netfilter/
cp -v xt_MEDIAPROXY.c "$KERN"/net/netfilter/
cp -v xt_RTPENGINE.h "$KERN"/include/linux/netfilter/
cp -v xt_RTPENGINE.c "$KERN"/net/netfilter/
if ! grep -q CONFIG_NETFILTER_XT_TARGET_MEDIAPROXY "$KERN"/net/netfilter/Makefile; then
if ! grep -q CONFIG_NETFILTER_XT_TARGET_RTPENGINE "$KERN"/net/netfilter/Makefile; then
(
echo
echo "EXTRA_CFLAGS += -DMEDIAPROXY_VERSION=\"\\\"$4\\\"\""
echo 'obj-$(CONFIG_NETFILTER_XT_TARGET_MEDIAPROXY) += xt_MEDIAPROXY.o'
echo "EXTRA_CFLAGS += -DRTPENGINE_VERSION=\"\\\"$4\\\"\""
echo 'obj-$(CONFIG_NETFILTER_XT_TARGET_RTPENGINE) += xt_RTPENGINE.o'
) >> "$KERN"/net/netfilter/Makefile
fi
if ! grep -q Kconfig\\.rtpengine "$KERN"/net/netfilter/Kconfig; then
cat >> "$KERN"/net/netfilter/Kconfig.rtpengine << \__EOF
config NETFILTER_XT_TARGET_MEDIAPROXY
tristate "Sipwise NGCP MEDIAPROXY target support"
config NETFILTER_XT_TARGET_RTPENGINE
tristate "Sipwise NGCP RTPENGINE target support"
depends on IP_NF_FILTER
help
Sipwise NGCP rtpengine kernel support


Loading…
Cancel
Save