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

pull/53/head
Richard Fuchs 11 years ago
parent dcfd7032b2
commit 0113991ef5

@ -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

@ -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;

@ -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;

@ -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,

@ -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;

@ -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);

@ -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

@ -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 \

@ -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 @@
iptables-extension/libxt_MEDIAPROXY.so /lib/xtables/
iptables-extension/libxt_RTPENGINE.so /lib/xtables/

4
debian/rules vendored

@ -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

@ -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

@ -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:

@ -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

@ -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

@ -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

@ -23,15 +23,15 @@
#include <linux/netfilter/x_tables.h>
#endif
#include "../kernel-module/xt_MEDIAPROXY.h"
#include "../kernel-module/xt_RTPENGINE.h"
static void help(void) {
printf(
"MEDIAPROXY (version %s) target options:\n"
"RTPENGINE (version %s) target options:\n"
" --id <id>\n"
" Unique ID for this instance\n",
MEDIAPROXY_VERSION
RTPENGINE_VERSION
);
}
@ -58,7 +58,7 @@ static int parse(int c,
struct xt_entry_target **target) {
#endif
struct xt_mediaproxy_info *info = (void *) (*target)->data;
struct xt_rtpengine_info *info = (void *) (*target)->data;
if (c == '1') {
info->id = atoi(optarg);
@ -88,9 +88,9 @@ static void print(const struct ip6t_ip6 *ip, const struct xt_entry_target *targe
#else
static void print(const void *ip, const struct xt_entry_target *target, int numeric) {
#endif
struct xt_mediaproxy_info *info = (void *) target->data;
struct xt_rtpengine_info *info = (void *) target->data;
printf(" MEDIAPROXY id:%u", info->id);
printf(" RTPENGINE id:%u", info->id);
}
#if defined(__ipt)
@ -100,7 +100,7 @@ static void save(const struct ip6t_ip6 *ip, const struct xt_entry_target *target
#else
static void save(const void *ip, const struct xt_entry_target *target) {
#endif
struct xt_mediaproxy_info *info = (void *) target->data;
struct xt_rtpengine_info *info = (void *) target->data;
printf(" --id %u", info->id);
}
@ -112,11 +112,11 @@ static struct option opts[] = {
#if defined(__ipt)
static struct iptables_target mediaproxy4 = {
.name = "MEDIAPROXY",
static struct iptables_target rtpengine4 = {
.name = "RTPENGINE",
.version = "1.3.6",
.size = IPT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.userspacesize = IPT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.size = IPT_ALIGN(sizeof(struct xt_rtpengine_info)),
.userspacesize = IPT_ALIGN(sizeof(struct xt_rtpengine_info)),
.help = help,
.parse = parse,
.final_check = final_check,
@ -125,11 +125,11 @@ static struct iptables_target mediaproxy4 = {
.extra_opts = opts,
};
#elif defined(__ip6t)
static struct ip6tables_target mediaproxy6 = {
.name = "MEDIAPROXY",
static struct ip6tables_target rtpengine6 = {
.name = "RTPENGINE",
.version = "1.3.6",
.size = IP6T_ALIGN(sizeof(struct xt_mediaproxy_info)),
.userspacesize = IP6T_ALIGN(sizeof(struct xt_mediaproxy_info)),
.size = IP6T_ALIGN(sizeof(struct xt_rtpengine_info)),
.userspacesize = IP6T_ALIGN(sizeof(struct xt_rtpengine_info)),
.help = help,
.parse = parse,
.final_check = final_check,
@ -138,12 +138,12 @@ static struct ip6tables_target mediaproxy6 = {
.extra_opts = opts,
};
#else
static struct xtables_target mediaproxy4 = {
.name = "MEDIAPROXY",
static struct xtables_target rtpengine4 = {
.name = "RTPENGINE",
.family = NFPROTO_IPV4,
.version = XTABLES_VERSION,
.size = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.size = XT_ALIGN(sizeof(struct xt_rtpengine_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_rtpengine_info)),
.help = help,
.parse = parse,
.final_check = final_check,
@ -152,12 +152,12 @@ static struct xtables_target mediaproxy4 = {
.extra_opts = opts,
};
static struct xtables_target mediaproxy6 = {
.name = "MEDIAPROXY",
static struct xtables_target rtpengine6 = {
.name = "RTPENGINE",
.family = NFPROTO_IPV6,
.version = XTABLES_VERSION,
.size = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_mediaproxy_info)),
.size = XT_ALIGN(sizeof(struct xt_rtpengine_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_rtpengine_info)),
.help = help,
.parse = parse,
.final_check = final_check,
@ -169,11 +169,11 @@ static struct xtables_target mediaproxy6 = {
void _init(void) {
#if defined(__ipt)
register_target(&mediaproxy4);
register_target(&rtpengine4);
#elif defined(__ip6t)
register_target6(&mediaproxy6);
register_target6(&rtpengine6);
#else
xtables_register_target(&mediaproxy4);
xtables_register_target(&mediaproxy6);
xtables_register_target(&rtpengine4);
xtables_register_target(&rtpengine6);
#endif
}

@ -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)"

@ -21,10 +21,10 @@
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter/x_tables.h>
#ifndef __MP_EXTERNAL
#include <linux/netfilter/xt_MEDIAPROXY.h>
#ifndef __RE_EXTERNAL
#include <linux/netfilter/xt_RTPENGINE.h>
#else
#include "xt_MEDIAPROXY.h"
#include "xt_RTPENGINE.h"
#endif
MODULE_LICENSE("GPL");
@ -33,7 +33,7 @@ MODULE_LICENSE("GPL");
#define MAX_ID 64 /* - 1 */
#define MAX_SKB_TAIL_ROOM (sizeof(((struct mediaproxy_srtp *) 0)->mki) + 20)
#define MAX_SKB_TAIL_ROOM (sizeof(((struct rtpengine_srtp *) 0)->mki) + 20)
#define MIPF "%i:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x:%u"
#define MIPP(x) (x).family, \
@ -70,10 +70,10 @@ MODULE_LICENSE("GPL");
struct mp_hmac;
struct mp_cipher;
struct re_hmac;
struct re_cipher;
struct rtp_parsed;
struct mp_crypto_context;
struct re_crypto_context;
@ -81,7 +81,7 @@ struct mp_crypto_context;
static struct proc_dir_entry *my_proc_root;
static struct proc_dir_entry *proc_list;
static struct proc_dir_entry *proc_control;
static struct mediaproxy_table *table[MAX_ID];
static struct rtpengine_table *table[MAX_ID];
static rwlock_t table_lock;
@ -115,13 +115,13 @@ static void proc_main_list_stop(struct seq_file *, void *);
static void *proc_main_list_next(struct seq_file *, void *, loff_t *);
static int proc_main_list_show(struct seq_file *, void *);
static void table_push(struct mediaproxy_table *);
static struct mediaproxy_target *get_target(struct mediaproxy_table *, u_int16_t);
static void table_push(struct rtpengine_table *);
static struct rtpengine_target *get_target(struct rtpengine_table *, u_int16_t);
static int aes_f8_session_key_init(struct mp_crypto_context *, struct mediaproxy_srtp *);
static int srtp_encrypt_aes_cm(struct mp_crypto_context *, struct mediaproxy_srtp *,
static int aes_f8_session_key_init(struct re_crypto_context *, struct rtpengine_srtp *);
static int srtp_encrypt_aes_cm(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t);
static int srtp_encrypt_aes_f8(struct mp_crypto_context *, struct mediaproxy_srtp *,
static int srtp_encrypt_aes_f8(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t);
@ -129,7 +129,7 @@ static int srtp_encrypt_aes_f8(struct mp_crypto_context *, struct mediaproxy_srt
struct mp_crypto_context {
struct re_crypto_context {
spinlock_t lock; /* protects roc and last_index */
unsigned char session_key[16];
unsigned char session_salt[14];
@ -137,33 +137,33 @@ struct mp_crypto_context {
u_int32_t roc;
struct crypto_cipher *tfm[2];
struct crypto_shash *shash;
const struct mp_cipher *cipher;
const struct mp_hmac *hmac;
const struct re_cipher *cipher;
const struct re_hmac *hmac;
};
struct mediaproxy_target {
struct rtpengine_target {
atomic_t refcnt;
u_int32_t table;
struct mediaproxy_target_info target;
struct rtpengine_target_info target;
spinlock_t stats_lock;
struct mediaproxy_stats stats;
struct rtpengine_stats stats;
struct mp_crypto_context decrypt;
struct mp_crypto_context encrypt;
struct re_crypto_context decrypt;
struct re_crypto_context encrypt;
};
struct mp_bitfield {
struct re_bitfield {
unsigned long b[256 / (sizeof(unsigned long) * 8)];
unsigned int used;
};
struct mp_bucket {
struct mp_bitfield targets;
struct mediaproxy_target *target[256];
struct re_bucket {
struct re_bitfield targets;
struct rtpengine_target *target[256];
};
struct mediaproxy_table {
struct rtpengine_table {
atomic_t refcnt;
rwlock_t target_lock;
pid_t pid;
@ -175,25 +175,25 @@ struct mediaproxy_table {
struct proc_dir_entry *list;
struct proc_dir_entry *blist;
struct mp_bitfield buckets;
struct mp_bucket *bucket[256];
struct re_bitfield buckets;
struct re_bucket *bucket[256];
unsigned int targets;
};
struct mp_cipher {
enum mediaproxy_cipher id;
struct re_cipher {
enum rtpengine_cipher id;
const char *name;
const char *tfm_name;
int (*decrypt)(struct mp_crypto_context *, struct mediaproxy_srtp *,
int (*decrypt)(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t);
int (*encrypt)(struct mp_crypto_context *, struct mediaproxy_srtp *,
int (*encrypt)(struct re_crypto_context *, struct rtpengine_srtp *,
struct rtp_parsed *, u_int64_t);
int (*session_key_init)(struct mp_crypto_context *, struct mediaproxy_srtp *);
int (*session_key_init)(struct re_crypto_context *, struct rtpengine_srtp *);
};
struct mp_hmac {
enum mediaproxy_hmac id;
struct re_hmac {
enum rtpengine_hmac id;
const char *name;
const char *tfm_name;
};
@ -278,24 +278,24 @@ static const struct seq_operations proc_main_list_seq_ops = {
.show = proc_main_list_show,
};
static const struct mp_cipher mp_ciphers[] = {
[MPC_INVALID] = {
.id = MPC_INVALID,
static const struct re_cipher re_ciphers[] = {
[REC_INVALID] = {
.id = REC_INVALID,
.name = NULL,
},
[MPC_NULL] = {
.id = MPC_NULL,
[REC_NULL] = {
.id = REC_NULL,
.name = "NULL",
},
[MPC_AES_CM] = {
.id = MPC_AES_CM,
[REC_AES_CM] = {
.id = REC_AES_CM,
.name = "AES-CM",
.tfm_name = "aes",
.decrypt = srtp_encrypt_aes_cm,
.encrypt = srtp_encrypt_aes_cm,
},
[MPC_AES_F8] = {
.id = MPC_AES_F8,
[REC_AES_F8] = {
.id = REC_AES_F8,
.name = "AES-F8",
.tfm_name = "aes",
.decrypt = srtp_encrypt_aes_f8,
@ -304,23 +304,23 @@ static const struct mp_cipher mp_ciphers[] = {
},
};
static const struct mp_hmac mp_hmacs[] = {
[MPH_INVALID] = {
.id = MPH_INVALID,
static const struct re_hmac re_hmacs[] = {
[REH_INVALID] = {
.id = REH_INVALID,
.name = NULL,
},
[MPH_NULL] = {
.id = MPH_NULL,
[REH_NULL] = {
.id = REH_NULL,
.name = "NULL",
},
[MPH_HMAC_SHA1] = {
.id = MPH_HMAC_SHA1,
[REH_HMAC_SHA1] = {
.id = REH_HMAC_SHA1,
.name = "HMAC-SHA1",
.tfm_name = "hmac(sha1)",
},
};
static const char *mp_msm_strings[] = {
static const char *re_msm_strings[] = {
[MSM_IGNORE] = "",
[MSM_DROP] = "drop",
[MSM_PROPAGATE] = "propagate",
@ -330,8 +330,8 @@ static const char *mp_msm_strings[] = {
static struct mediaproxy_table *new_table(void) {
struct mediaproxy_table *t;
static struct rtpengine_table *new_table(void) {
struct rtpengine_table *t;
DBG("Creating new table\n");
@ -356,7 +356,7 @@ static struct mediaproxy_table *new_table(void) {
static void table_hold(struct mediaproxy_table *t) {
static void table_hold(struct rtpengine_table *t) {
atomic_inc(&t->refcnt);
}
@ -364,7 +364,7 @@ static void table_hold(struct mediaproxy_table *t) {
static int table_create_proc(struct mediaproxy_table *t, u_int32_t id) {
static int table_create_proc(struct rtpengine_table *t, u_int32_t id) {
char num[10];
sprintf(num, "%u", id);
@ -403,8 +403,8 @@ static int table_create_proc(struct mediaproxy_table *t, u_int32_t id) {
static struct mediaproxy_table *new_table_link(u_int32_t id) {
struct mediaproxy_table *t;
static struct rtpengine_table *new_table_link(u_int32_t id) {
struct rtpengine_table *t;
unsigned long flags;
if (id >= MAX_ID)
@ -412,7 +412,7 @@ static struct mediaproxy_table *new_table_link(u_int32_t id) {
t = new_table();
if (!t) {
printk(KERN_WARNING "xt_MEDIAPROXY out of memory\n");
printk(KERN_WARNING "xt_RTPENGINE out of memory\n");
return NULL;
}
@ -420,7 +420,7 @@ static struct mediaproxy_table *new_table_link(u_int32_t id) {
if (table[id]) {
write_unlock_irqrestore(&table_lock, flags);
table_push(t);
printk(KERN_WARNING "xt_MEDIAPROXY duplicate ID %u\n", id);
printk(KERN_WARNING "xt_RTPENGINE duplicate ID %u\n", id);
return NULL;
}
@ -430,7 +430,7 @@ static struct mediaproxy_table *new_table_link(u_int32_t id) {
write_unlock_irqrestore(&table_lock, flags);
if (table_create_proc(t, id))
printk(KERN_WARNING "xt_MEDIAPROXY failed to create /proc entry for ID %u\n", id);
printk(KERN_WARNING "xt_RTPENGINE failed to create /proc entry for ID %u\n", id);
return t;
@ -440,7 +440,7 @@ static struct mediaproxy_table *new_table_link(u_int32_t id) {
static void free_crypto_context(struct mp_crypto_context *c) {
static void free_crypto_context(struct re_crypto_context *c) {
int i;
for (i = 0; i < ARRAY_SIZE(c->tfm); i++) {
@ -451,7 +451,7 @@ static void free_crypto_context(struct mp_crypto_context *c) {
crypto_free_shash(c->shash);
}
static void target_push(struct mediaproxy_target *t) {
static void target_push(struct rtpengine_target *t) {
if (!t)
return;
@ -471,7 +471,7 @@ static void target_push(struct mediaproxy_target *t) {
static void target_hold(struct mediaproxy_target *t) {
static void target_hold(struct rtpengine_target *t) {
atomic_inc(&t->refcnt);
}
@ -496,9 +496,9 @@ static void clear_proc(struct proc_dir_entry **e) {
static void table_push(struct mediaproxy_table *t) {
static void table_push(struct rtpengine_table *t) {
int i, j;
struct mp_bucket *b;
struct re_bucket *b;
if (!t)
return;
@ -539,7 +539,7 @@ static void table_push(struct mediaproxy_table *t) {
static int unlink_table(struct mediaproxy_table *t) {
static int unlink_table(struct rtpengine_table *t) {
unsigned long flags;
if (t->id >= MAX_ID)
@ -574,8 +574,8 @@ static int unlink_table(struct mediaproxy_table *t) {
static struct mediaproxy_table *get_table(u_int32_t id) {
struct mediaproxy_table *t;
static struct rtpengine_table *get_table(u_int32_t id) {
struct rtpengine_table *t;
unsigned long flags;
if (id >= MAX_ID)
@ -596,7 +596,7 @@ static struct mediaproxy_table *get_table(u_int32_t id) {
static ssize_t proc_status(struct file *f, char __user *b, size_t l, loff_t *o) {
struct inode *inode;
char buf[256];
struct mediaproxy_table *t;
struct rtpengine_table *t;
int len = 0;
unsigned long flags;
u_int32_t id;
@ -651,7 +651,7 @@ static void proc_main_list_stop(struct seq_file *f, void *v) {
}
static void *proc_main_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is invalid */
struct mediaproxy_table *t = NULL;
struct rtpengine_table *t = NULL;
u_int32_t id;
if (*o < 0)
@ -671,7 +671,7 @@ static void *proc_main_list_next(struct seq_file *f, void *v, loff_t *o) { /* v
}
static int proc_main_list_show(struct seq_file *f, void *v) {
struct mediaproxy_table *g = v;
struct rtpengine_table *g = v;
seq_printf(f, "%u\n", g->id);
table_push(g);
@ -695,7 +695,7 @@ static inline unsigned int bitfield_slot(unsigned char i) {
static inline unsigned int bitfield_bit(unsigned char i) {
return i % (sizeof(unsigned long) * 8);
}
static inline void bitfield_set(struct mp_bitfield *bf, unsigned char i) {
static inline void bitfield_set(struct re_bitfield *bf, unsigned char i) {
unsigned int b, m;
unsigned long k;
@ -707,7 +707,7 @@ static inline void bitfield_set(struct mp_bitfield *bf, unsigned char i) {
bf->b[b] |= k;
bf->used++;
}
static inline void bitfield_clear(struct mp_bitfield *bf, unsigned char i) {
static inline void bitfield_clear(struct re_bitfield *bf, unsigned char i) {
unsigned int b, m;
unsigned long k;
@ -719,12 +719,12 @@ static inline void bitfield_clear(struct mp_bitfield *bf, unsigned char i) {
bf->b[b] &= ~k;
bf->used--;
}
static inline struct mediaproxy_target *find_next_target(struct mediaproxy_table *t, int *port) {
static inline struct rtpengine_target *find_next_target(struct rtpengine_table *t, int *port) {
unsigned long flags;
struct mp_bucket *b;
struct re_bucket *b;
unsigned char hi, lo;
unsigned int hi_b, lo_b;
struct mediaproxy_target *g;
struct rtpengine_target *g;
if (*port < 0 || *port > 0xffff)
return NULL;
@ -784,7 +784,7 @@ next:
static int proc_blist_open(struct inode *i, struct file *f) {
u_int32_t id;
struct mediaproxy_table *t;
struct rtpengine_table *t;
id = (u_int32_t) (unsigned long) PDE_DATA(i);
t = get_table(id);
@ -798,7 +798,7 @@ static int proc_blist_open(struct inode *i, struct file *f) {
static int proc_blist_close(struct inode *i, struct file *f) {
u_int32_t id;
struct mediaproxy_table *t;
struct rtpengine_table *t;
id = (u_int32_t) (unsigned long) PDE_DATA(i);
t = get_table(id);
@ -813,10 +813,10 @@ static int proc_blist_close(struct inode *i, struct file *f) {
static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t *o) {
struct inode *inode;
u_int32_t id;
struct mediaproxy_table *t;
struct mediaproxy_list_entry op;
struct rtpengine_table *t;
struct rtpengine_list_entry op;
int err;
struct mediaproxy_target *g;
struct rtpengine_target *g;
unsigned long flags;
int port;
@ -875,7 +875,7 @@ static int proc_list_open(struct inode *i, struct file *f) {
int err;
struct seq_file *p;
u_int32_t id;
struct mediaproxy_table *t;
struct rtpengine_table *t;
id = (u_int32_t) (unsigned long) PDE_DATA(i);
t = get_table(id);
@ -905,8 +905,8 @@ static void proc_list_stop(struct seq_file *f, void *v) {
static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is invalid */
u_int32_t id = (u_int32_t) (unsigned long) f->private;
struct mediaproxy_table *t;
struct mediaproxy_target *g;
struct rtpengine_table *t;
struct rtpengine_target *g;
int port;
port = (int) *o;
@ -923,7 +923,7 @@ static void *proc_list_next(struct seq_file *f, void *v, loff_t *o) { /* v is in
return g;
}
static void proc_list_addr_print(struct seq_file *f, const char *s, const struct mp_address *a) {
static void proc_list_addr_print(struct seq_file *f, const char *s, const struct re_address *a) {
if (!a->family)
return;
@ -945,12 +945,12 @@ static void proc_list_addr_print(struct seq_file *f, const char *s, const struct
}
}
static void proc_list_crypto_print(struct seq_file *f, struct mp_crypto_context *c,
struct mediaproxy_srtp *s, const char *label)
static void proc_list_crypto_print(struct seq_file *f, struct re_crypto_context *c,
struct rtpengine_srtp *s, const char *label)
{
int hdr = 0;
if (c->cipher && c->cipher->id != MPC_NULL) {
if (c->cipher && c->cipher->id != REC_NULL) {
if (!hdr++)
seq_printf(f, " SRTP %s parameters:\n", label);
seq_printf(f, " cipher: %s\n", c->cipher->name ? : "<invalid>");
@ -960,7 +960,7 @@ static void proc_list_crypto_print(struct seq_file *f, struct mp_crypto_context
s->mki[0], s->mki[1], s->mki[2], s->mki[3],
s->mki[4], s->mki[5], s->mki[6], s->mki[7]);
}
if (c->hmac && c->hmac->id != MPH_NULL) {
if (c->hmac && c->hmac->id != REH_NULL) {
if (!hdr++)
seq_printf(f, " SRTP %s parameters:\n", label);
seq_printf(f, " HMAC: %s\n", c->hmac->name ? : "<invalid>");
@ -969,7 +969,7 @@ static void proc_list_crypto_print(struct seq_file *f, struct mp_crypto_context
}
static int proc_list_show(struct seq_file *f, void *v) {
struct mediaproxy_target *g = v;
struct rtpengine_target *g = v;
unsigned long flags;
seq_printf(f, "port %5u:\n", g->target.target_port);
@ -977,8 +977,8 @@ static int proc_list_show(struct seq_file *f, void *v) {
proc_list_addr_print(f, "dst", &g->target.dst_addr);
proc_list_addr_print(f, "mirror", &g->target.mirror_addr);
proc_list_addr_print(f, "expect", &g->target.expected_src);
if (g->target.src_mismatch > 0 && g->target.src_mismatch <= ARRAY_SIZE(mp_msm_strings))
seq_printf(f, " src mismatch action: %s\n", mp_msm_strings[g->target.src_mismatch]);
if (g->target.src_mismatch > 0 && g->target.src_mismatch <= ARRAY_SIZE(re_msm_strings))
seq_printf(f, " src mismatch action: %s\n", re_msm_strings[g->target.src_mismatch]);
spin_lock_irqsave(&g->stats_lock, flags);
seq_printf(f, " stats: %20llu bytes, %20llu packets, %20llu errors\n",
g->stats.bytes, g->stats.packets, g->stats.errors);
@ -999,10 +999,10 @@ static int proc_list_show(struct seq_file *f, void *v) {
static int table_del_target(struct mediaproxy_table *t, u_int16_t port) {
static int table_del_target(struct rtpengine_table *t, u_int16_t port) {
unsigned char hi, lo;
struct mp_bucket *b;
struct mediaproxy_target *g = NULL;
struct re_bucket *b;
struct rtpengine_target *g = NULL;
unsigned long flags;
if (!port)
@ -1045,15 +1045,15 @@ out:
static int is_valid_address(struct mp_address *mpa) {
switch (mpa->family) {
static int is_valid_address(struct re_address *rea) {
switch (rea->family) {
case AF_INET:
if (!mpa->u.ipv4)
if (!rea->u.ipv4)
return 0;
break;
case AF_INET6:
if (!mpa->u.u32[0] && !mpa->u.u32[1] && !mpa->u.u32[2] && !mpa->u.u32[3])
if (!rea->u.u32[0] && !rea->u.u32[1] && !rea->u.u32[2] && !rea->u.u32[3])
return 0;
break;
@ -1061,7 +1061,7 @@ static int is_valid_address(struct mp_address *mpa) {
return 0;
}
if (!mpa->port)
if (!rea->port)
return 0;
return 1;
@ -1070,14 +1070,14 @@ static int is_valid_address(struct mp_address *mpa) {
static int validate_srtp(struct mediaproxy_srtp *s) {
if (s->cipher <= MPC_INVALID)
static int validate_srtp(struct rtpengine_srtp *s) {
if (s->cipher <= REC_INVALID)
return -1;
if (s->cipher >= __MPC_LAST)
if (s->cipher >= __REC_LAST)
return -1;
if (s->hmac <= MPH_INVALID)
if (s->hmac <= REH_INVALID)
return -1;
if (s->hmac >= __MPH_LAST)
if (s->hmac >= __REH_LAST)
return -1;
if (s->auth_tag_len > 20)
return -1;
@ -1234,7 +1234,7 @@ static int prf_n(unsigned char *out, int len, const unsigned char *key, const un
return 0;
}
static int gen_session_key(unsigned char *out, int len, struct mediaproxy_srtp *s, unsigned char label) {
static int gen_session_key(unsigned char *out, int len, struct rtpengine_srtp *s, unsigned char label) {
unsigned char key_id[7];
unsigned char x[14];
int i, ret;
@ -1256,7 +1256,7 @@ static int gen_session_key(unsigned char *out, int len, struct mediaproxy_srtp *
static int aes_f8_session_key_init(struct mp_crypto_context *c, struct mediaproxy_srtp *s) {
static int aes_f8_session_key_init(struct re_crypto_context *c, struct rtpengine_srtp *s) {
unsigned char m[16];
int i, ret;
@ -1281,11 +1281,11 @@ error:
return ret;
}
static int gen_session_keys(struct mp_crypto_context *c, struct mediaproxy_srtp *s) {
static int gen_session_keys(struct re_crypto_context *c, struct rtpengine_srtp *s) {
int ret;
const char *err;
if (s->cipher == MPC_NULL && s->hmac == MPH_NULL)
if (s->cipher == REC_NULL && s->hmac == REH_NULL)
return 0;
err = "failed to generate session key";
ret = gen_session_key(c->session_key, 16, s, 0x00);
@ -1363,16 +1363,16 @@ error:
static void crypto_context_init(struct mp_crypto_context *c, struct mediaproxy_srtp *s) {
c->cipher = &mp_ciphers[s->cipher];
c->hmac = &mp_hmacs[s->hmac];
static void crypto_context_init(struct re_crypto_context *c, struct rtpengine_srtp *s) {
c->cipher = &re_ciphers[s->cipher];
c->hmac = &re_hmacs[s->hmac];
}
static int table_new_target(struct mediaproxy_table *t, struct mediaproxy_target_info *i, int update) {
static int table_new_target(struct rtpengine_table *t, struct rtpengine_target_info *i, int update) {
unsigned char hi, lo;
struct mediaproxy_target *g;
struct mp_bucket *b, *ba = NULL;
struct mediaproxy_target *og = NULL;
struct rtpengine_target *g;
struct re_bucket *b, *ba = NULL;
struct rtpengine_target *og = NULL;
int err;
unsigned long flags;
@ -1489,9 +1489,9 @@ fail1:
static struct mediaproxy_target *get_target(struct mediaproxy_table *t, u_int16_t port) {
static struct rtpengine_target *get_target(struct rtpengine_table *t, u_int16_t port) {
unsigned char hi, lo;
struct mediaproxy_target *r;
struct rtpengine_target *r;
unsigned long flags;
if (!t)
@ -1530,7 +1530,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf
char b[30];
unsigned long id;
char *endp;
struct mediaproxy_table *t;
struct rtpengine_table *t;
int err;
if (buflen < 6 || buflen > 20)
@ -1578,7 +1578,7 @@ static ssize_t proc_main_control_write(struct file *file, const char __user *buf
static int proc_control_open(struct inode *inode, struct file *file) {
u_int32_t id;
struct mediaproxy_table *t;
struct rtpengine_table *t;
unsigned long flags;
id = (u_int32_t) (unsigned long) PDE_DATA(inode);
@ -1601,7 +1601,7 @@ static int proc_control_open(struct inode *inode, struct file *file) {
static int proc_control_close(struct inode *inode, struct file *file) {
u_int32_t id;
struct mediaproxy_table *t;
struct rtpengine_table *t;
unsigned long flags;
id = (u_int32_t) (unsigned long) PDE_DATA(inode);
@ -1621,8 +1621,8 @@ static int proc_control_close(struct inode *inode, struct file *file) {
static ssize_t proc_control_write(struct file *file, const char __user *buf, size_t buflen, loff_t *off) {
struct inode *inode;
u_int32_t id;
struct mediaproxy_table *t;
struct mediaproxy_message msg;
struct rtpengine_table *t;
struct rtpengine_message msg;
int err;
if (buflen != sizeof(msg))
@ -1662,7 +1662,7 @@ static ssize_t proc_control_write(struct file *file, const char __user *buf, siz
break;
default:
printk(KERN_WARNING "xt_MEDIAPROXY unimplemented op %u\n", msg.cmd);
printk(KERN_WARNING "xt_RTPENGINE unimplemented op %u\n", msg.cmd);
err = -EINVAL;
goto err;
}
@ -1680,7 +1680,7 @@ err:
static int send_proxy_packet4(struct sk_buff *skb, struct mp_address *src, struct mp_address *dst, unsigned char tos) {
static int send_proxy_packet4(struct sk_buff *skb, struct re_address *src, struct re_address *dst, unsigned char tos) {
struct iphdr *ih;
struct udphdr *uh;
unsigned int datalen;
@ -1736,7 +1736,7 @@ drop:
static int send_proxy_packet6(struct sk_buff *skb, struct mp_address *src, struct mp_address *dst, unsigned char tos) {
static int send_proxy_packet6(struct sk_buff *skb, struct re_address *src, struct re_address *dst, unsigned char tos) {
struct ipv6hdr *ih;
struct udphdr *uh;
unsigned int datalen;
@ -1791,7 +1791,7 @@ drop:
static int send_proxy_packet(struct sk_buff *skb, struct mp_address *src, struct mp_address *dst, unsigned char tos) {
static int send_proxy_packet(struct sk_buff *skb, struct re_address *src, struct re_address *dst, unsigned char tos) {
if (src->family != dst->family)
goto drop;
@ -1859,8 +1859,8 @@ error:
}
/* XXX shared code */
static u_int64_t packet_index(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_header *rtp)
static u_int64_t packet_index(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_header *rtp)
{
u_int16_t seq;
u_int64_t index;
@ -1900,8 +1900,8 @@ static u_int64_t packet_index(struct mp_crypto_context *c,
}
static int srtp_hash(unsigned char *hmac,
struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
u_int32_t roc;
@ -1944,7 +1944,7 @@ error:
}
/* XXX shared code */
static void rtp_append_mki(struct rtp_parsed *r, struct mediaproxy_srtp *c) {
static void rtp_append_mki(struct rtp_parsed *r, struct rtpengine_srtp *c) {
unsigned char *p;
if (!c->mki_len)
@ -1955,15 +1955,15 @@ static void rtp_append_mki(struct rtp_parsed *r, struct mediaproxy_srtp *c) {
r->payload_len += c->mki_len;
}
static int srtp_authenticate(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static int srtp_authenticate(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
unsigned char hmac[20];
if (!r->header)
return 0;
if (s->hmac == MPH_NULL)
if (s->hmac == REH_NULL)
return 0;
if (!c->hmac)
return 0;
@ -1981,14 +1981,14 @@ static int srtp_authenticate(struct mp_crypto_context *c,
return 0;
}
static int srtp_auth_validate(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static int srtp_auth_validate(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
unsigned char *auth_tag;
unsigned char hmac[20];
if (s->hmac == MPH_NULL)
if (s->hmac == REH_NULL)
return 0;
if (!c->hmac)
return 0;
@ -2025,8 +2025,8 @@ static int srtp_auth_validate(struct mp_crypto_context *c,
/* XXX shared code */
static int srtp_encrypt_aes_cm(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static int srtp_encrypt_aes_cm(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
unsigned char iv[16];
@ -2049,8 +2049,8 @@ static int srtp_encrypt_aes_cm(struct mp_crypto_context *c,
return 0;
}
static int srtp_encrypt_aes_f8(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static int srtp_encrypt_aes_f8(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
unsigned char iv[16];
@ -2067,8 +2067,8 @@ static int srtp_encrypt_aes_f8(struct mp_crypto_context *c,
}
static inline int srtp_encrypt(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static inline int srtp_encrypt(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
if (!r->header)
@ -2078,8 +2078,8 @@ static inline int srtp_encrypt(struct mp_crypto_context *c,
return c->cipher->encrypt(c, s, r, pkt_idx);
}
static inline int srtp_decrypt(struct mp_crypto_context *c,
struct mediaproxy_srtp *s, struct rtp_parsed *r,
static inline int srtp_decrypt(struct re_crypto_context *c,
struct rtpengine_srtp *s, struct rtp_parsed *r,
u_int64_t pkt_idx)
{
if (!c->cipher->decrypt)
@ -2105,9 +2105,9 @@ static inline int is_dtls(struct sk_buff *skb) {
return 1;
}
static unsigned int mediaproxy46(struct sk_buff *skb, struct mediaproxy_table *t, struct mp_address *src) {
static unsigned int rtpengine46(struct sk_buff *skb, struct rtpengine_table *t, struct re_address *src) {
struct udphdr *uh;
struct mediaproxy_target *g;
struct rtpengine_target *g;
struct sk_buff *skb2;
int err;
unsigned int datalen;
@ -2245,15 +2245,15 @@ skip2:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
static unsigned int mediaproxy4(struct sk_buff *oskb, const struct xt_target_param *par) {
static unsigned int rtpengine4(struct sk_buff *oskb, const struct xt_target_param *par) {
#else
static unsigned int mediaproxy4(struct sk_buff *oskb, const struct xt_action_param *par) {
static unsigned int rtpengine4(struct sk_buff *oskb, const struct xt_action_param *par) {
#endif
const struct xt_mediaproxy_info *pinfo = par->targinfo;
const struct xt_rtpengine_info *pinfo = par->targinfo;
struct sk_buff *skb;
struct iphdr *ih;
struct mediaproxy_table *t;
struct mp_address src;
struct rtpengine_table *t;
struct re_address src;
t = get_table(pinfo->id);
if (!t)
@ -2273,7 +2273,7 @@ static unsigned int mediaproxy4(struct sk_buff *oskb, const struct xt_action_par
src.family = AF_INET;
src.u.ipv4 = ih->saddr;
return mediaproxy46(skb, t, &src);
return rtpengine46(skb, t, &src);
skip2:
kfree_skb(skb);
@ -2287,15 +2287,15 @@ skip:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
static unsigned int mediaproxy6(struct sk_buff *oskb, const struct xt_target_param *par) {
static unsigned int rtpengine6(struct sk_buff *oskb, const struct xt_target_param *par) {
#else
static unsigned int mediaproxy6(struct sk_buff *oskb, const struct xt_action_param *par) {
static unsigned int rtpengine6(struct sk_buff *oskb, const struct xt_action_param *par) {
#endif
const struct xt_mediaproxy_info *pinfo = par->targinfo;
const struct xt_rtpengine_info *pinfo = par->targinfo;
struct sk_buff *skb;
struct ipv6hdr *ih;
struct mediaproxy_table *t;
struct mp_address src;
struct rtpengine_table *t;
struct re_address src;
t = get_table(pinfo->id);
if (!t)
@ -2315,7 +2315,7 @@ static unsigned int mediaproxy6(struct sk_buff *oskb, const struct xt_action_par
src.family = AF_INET6;
memcpy(&src.u.ipv6, &ih->saddr, sizeof(src.u.ipv6));
return mediaproxy46(skb, t, &src);
return rtpengine46(skb, t, &src);
skip2:
kfree_skb(skb);
@ -2338,14 +2338,14 @@ static bool check(const struct xt_tgchk_param *par) {
#define CHECK_SCC 0
static int check(const struct xt_tgchk_param *par) {
#endif
const struct xt_mediaproxy_info *pinfo = par->targinfo;
const struct xt_rtpengine_info *pinfo = par->targinfo;
if (!my_proc_root) {
printk(KERN_WARNING "xt_MEDIAPROXY check() without proc_root\n");
printk(KERN_WARNING "xt_RTPENGINE check() without proc_root\n");
return CHECK_ERR;
}
if (pinfo->id >= MAX_ID) {
printk(KERN_WARNING "xt_MEDIAPROXY ID too high (%u >= %u)\n", pinfo->id, MAX_ID);
printk(KERN_WARNING "xt_RTPENGINE ID too high (%u >= %u)\n", pinfo->id, MAX_ID);
return CHECK_ERR;
}
@ -2355,22 +2355,22 @@ static int check(const struct xt_tgchk_param *par) {
static struct xt_target xt_mediaproxy_regs[] = {
static struct xt_target xt_rtpengine_regs[] = {
{
.name = "MEDIAPROXY",
.name = "RTPENGINE",
.family = NFPROTO_IPV4,
.target = mediaproxy4,
.targetsize = sizeof(struct xt_mediaproxy_info),
.target = rtpengine4,
.targetsize = sizeof(struct xt_rtpengine_info),
.table = "filter",
.hooks = (1 << NF_INET_LOCAL_IN),
.checkentry = check,
.me = THIS_MODULE,
},
{
.name = "MEDIAPROXY",
.name = "RTPENGINE",
.family = NFPROTO_IPV6,
.target = mediaproxy6,
.targetsize = sizeof(struct xt_mediaproxy_info),
.target = rtpengine6,
.targetsize = sizeof(struct xt_rtpengine_info),
.table = "filter",
.hooks = (1 << NF_INET_LOCAL_IN),
.checkentry = check,
@ -2382,13 +2382,13 @@ static int __init init(void) {
int ret;
const char *err;
printk(KERN_NOTICE "Registering xt_MEDIAPROXY module - version %s\n", MEDIAPROXY_VERSION);
printk(KERN_NOTICE "Registering xt_RTPENGINE module - version %s\n", RTPENGINE_VERSION);
rwlock_init(&table_lock);
ret = -ENOMEM;
err = "could not register /proc/ entries";
my_proc_root = proc_mkdir("mediaproxy", NULL);
my_proc_root = proc_mkdir("rtpengine", NULL);
if (!my_proc_root)
goto fail;
/* my_proc_root->owner = THIS_MODULE; */
@ -2403,7 +2403,7 @@ static int __init init(void) {
goto fail;
err = "could not register xtables target";
ret = xt_register_targets(xt_mediaproxy_regs, ARRAY_SIZE(xt_mediaproxy_regs));
ret = xt_register_targets(xt_rtpengine_regs, ARRAY_SIZE(xt_rtpengine_regs));
if (ret)
goto fail;
@ -2414,14 +2414,14 @@ fail:
clear_proc(&proc_list);
clear_proc(&my_proc_root);
printk(KERN_ERR "Failed to load xt_MEDIAPROXY module: %s\n", err);
printk(KERN_ERR "Failed to load xt_RTPENGINE module: %s\n", err);
return ret;
}
static void __exit fini(void) {
printk(KERN_NOTICE "Unregistering xt_MEDIAPROXY module\n");
xt_unregister_targets(xt_mediaproxy_regs, ARRAY_SIZE(xt_mediaproxy_regs));
printk(KERN_NOTICE "Unregistering xt_RTPENGINE module\n");
xt_unregister_targets(xt_rtpengine_regs, ARRAY_SIZE(xt_rtpengine_regs));
clear_proc(&proc_control);
clear_proc(&proc_list);

@ -1,17 +1,17 @@
#ifndef XT_RTPPROXY_H
#define XT_RTPPROXY_H
struct xt_mediaproxy_info {
struct xt_rtpengine_info {
u_int32_t id;
};
struct mediaproxy_stats {
struct rtpengine_stats {
u_int64_t packets;
u_int64_t bytes;
u_int64_t errors;
};
struct mp_address {
struct re_address {
int family;
union {
unsigned char ipv6[16];
@ -24,27 +24,27 @@ struct mp_address {
u_int16_t port;
};
enum mediaproxy_cipher {
MPC_INVALID = 0,
MPC_NULL,
MPC_AES_CM,
MPC_AES_F8,
enum rtpengine_cipher {
REC_INVALID = 0,
REC_NULL,
REC_AES_CM,
REC_AES_F8,
__MPC_LAST
__REC_LAST
};
enum mediaproxy_hmac {
MPH_INVALID = 0,
MPH_NULL,
MPH_HMAC_SHA1,
enum rtpengine_hmac {
REH_INVALID = 0,
REH_NULL,
REH_HMAC_SHA1,
__MPH_LAST
__REH_LAST
};
struct mediaproxy_srtp {
enum mediaproxy_cipher cipher;
enum mediaproxy_hmac hmac;
struct rtpengine_srtp {
enum rtpengine_cipher cipher;
enum rtpengine_hmac hmac;
unsigned char master_key[16];
unsigned char master_salt[14];
unsigned char mki[256]; /* XXX uses too much memory? */
@ -54,24 +54,24 @@ struct mediaproxy_srtp {
};
enum mediaproxy_src_mismatch {
enum rtpengine_src_mismatch {
MSM_IGNORE = 0, /* process packet as normal */
MSM_DROP, /* drop packet */
MSM_PROPAGATE, /* propagate to userspace daemon */
};
struct mediaproxy_target_info {
struct rtpengine_target_info {
u_int16_t target_port;
struct mp_address expected_src; /* for incoming packets */
enum mediaproxy_src_mismatch src_mismatch;
struct re_address expected_src; /* for incoming packets */
enum rtpengine_src_mismatch src_mismatch;
struct mp_address src_addr; /* for outgoing packets */
struct mp_address dst_addr;
struct re_address src_addr; /* for outgoing packets */
struct re_address dst_addr;
struct mp_address mirror_addr;
struct re_address mirror_addr;
struct mediaproxy_srtp decrypt;
struct mediaproxy_srtp encrypt;
struct rtpengine_srtp decrypt;
struct rtpengine_srtp encrypt;
unsigned char tos;
int rtcp_mux:1,
@ -80,7 +80,7 @@ struct mediaproxy_target_info {
rtp_only:1;
};
struct mediaproxy_message {
struct rtpengine_message {
enum {
MMG_NOOP = 1,
MMG_ADD,
@ -88,12 +88,12 @@ struct mediaproxy_message {
MMG_UPDATE,
} cmd;
struct mediaproxy_target_info target;
struct rtpengine_target_info target;
};
struct mediaproxy_list_entry {
struct mediaproxy_target_info target;
struct mediaproxy_stats stats;
struct rtpengine_list_entry {
struct rtpengine_target_info target;
struct rtpengine_stats stats;
};

@ -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);

@ -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);

@ -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);

@ -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) {

@ -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];
}

@ -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