summaryrefslogtreecommitdiff
path: root/package/rtsp
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-04-27 20:58:44 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2010-04-27 20:58:44 +0200
commite42433d7127f9a50b5dae57fff331ecfdc9883c4 (patch)
tree81cc6860ef65e4077ce59a190d3bbf7166400959 /package/rtsp
parent4b2636bd2aea3aa4f5844083a1de0e9283f31a7a (diff)
iptv via natting now works at last sometime.
alice iptv seems to use destination=ip:port instead of client_port=port, like RFC suggesting it. But destination= is also used by STUN method. As a quick hack I commented out STUN method to avoid crashes. Now at least I can see some tv streams. still not 100% good.
Diffstat (limited to 'package/rtsp')
-rw-r--r--package/rtsp/Makefile6
-rw-r--r--package/rtsp/src/nf_conntrack_rtsp.c30
-rw-r--r--package/rtsp/src/nf_nat_rtsp.c48
3 files changed, 76 insertions, 8 deletions
diff --git a/package/rtsp/Makefile b/package/rtsp/Makefile
index c28467b9b..994852f04 100644
--- a/package/rtsp/Makefile
+++ b/package/rtsp/Makefile
@@ -22,10 +22,10 @@ BUILD_STYLE:= manual
INSTALL_STYLE:= manual
pre-build:
- V=1 ARCH=${ARCH} KERNELDIR=${LINUX_DIR} \
+ ARCH=${ARCH} KERNELDIR=${LINUX_DIR} \
PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \
- LD=$(TARGET_CROSS)gcc LDFLAGS="" \
- $(MAKE) -C ${WRKBUILD} debug
+ LD=$(TARGET_CROSS)gcc LDFLAGS="" CFLAGS="-Wall" \
+ $(MAKE) -C ${WRKBUILD} debug V=1
do-install:
${INSTALL_DIR} ${IDIR_KMOD_RTSP}/etc/modules.d/
diff --git a/package/rtsp/src/nf_conntrack_rtsp.c b/package/rtsp/src/nf_conntrack_rtsp.c
index c1002aca9..7b5d2be67 100644
--- a/package/rtsp/src/nf_conntrack_rtsp.c
+++ b/package/rtsp/src/nf_conntrack_rtsp.c
@@ -177,14 +177,15 @@ rtsp_parse_transport(char* ptran, uint tranlen,
pr_info("sanity check failed\n");
return 0;
}
-
- pr_debug("tran='%.*s'\n", (int)tranlen, ptran);
+
+ pr_debug("t='%.*s'\n", (int)tranlen-2, ptran);
off += 10;
SKIP_WSPACE(ptran, tranlen, off);
/* Transport: tran;field;field=val,tran;field;field=val,... */
while (off < tranlen) {
const char* pparamend;
+ const char* pdestport;
uint nextparamoff;
pparamend = memchr(ptran+off, ',', tranlen-off);
@@ -236,6 +237,31 @@ rtsp_parse_transport(char* ptran, uint tranlen,
rc = 1;
}
}
+ else if ((strncmp(ptran+off, "destination=",12) == 0) &&
+ ((pdestport = memchr(ptran+off, ':', nextparamoff-off)) != NULL))
+ {
+ u_int16_t port;
+ uint numlen;
+
+ off += 12;
+ pdestport++;
+
+ off = pdestport - ptran;
+ numlen = nf_strtou16(ptran + off, &port);
+ off += numlen + 1;
+
+ if (prtspexp->loport != 0 && prtspexp->loport != port)
+ {
+ pr_debug("multiple ports found, port %hu ignored\n", port);
+ }
+ else
+ {
+ prtspexp->pbtype = pb_single;
+ prtspexp->loport = port;
+ prtspexp->hiport = port;
+ rc = 1;
+ }
+ }
/*
* Note we don't look for the destination parameter here.
diff --git a/package/rtsp/src/nf_nat_rtsp.c b/package/rtsp/src/nf_nat_rtsp.c
index 6ec6aa4f8..adb44d0ae 100644
--- a/package/rtsp/src/nf_nat_rtsp.c
+++ b/package/rtsp/src/nf_nat_rtsp.c
@@ -129,7 +129,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
tranlen < 10 || !iseol(ptran[tranlen-1]) ||
nf_strncasecmp(ptran, "Transport:", 10) != 0)
{
- pr_info("sanity check failed\n");
+ pr_debug("sanity check failed\n");
return 0;
}
off += 10;
@@ -245,6 +245,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
pfieldend = memchr(ptran+off, ';', nextparamoff-off);
nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
+ /*
if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0)
{
if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0)
@@ -257,7 +258,6 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
off, diff, NULL, 0))
{
- /* mangle failed, all we can do is bail */
nf_ct_unexpect_related(exp);
return 0;
}
@@ -268,6 +268,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
nextfieldoff -= diff;
}
}
+ */
off = nextfieldoff;
}
@@ -279,6 +280,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
while (off < nextparamoff)
{
const char* pfieldend;
+ const char* pdestport;
uint nextfieldoff;
pfieldend = memchr(ptran+off, ';', nextparamoff-off);
@@ -338,6 +340,46 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
nextfieldoff -= diff;
}
}
+ else if ((strncmp(ptran+off, "destination=", 12) == 0) && ((pdestport = memchr(ptran+off+12, ':', nextparamoff-(off + 12))) != NULL))
+ {
+ u_int16_t port;
+ uint numlen;
+ uint origoff;
+ uint origlen;
+ char rbuf[32];
+ uint rbuflen = sprintf(rbuf, "%s:%s",szextaddr,rbuf1);
+
+ pdestport++;
+
+ off += 12;
+ origoff = (ptran + off) - ptcp;
+ origlen = pdestport - (ptran + off);
+ off += origlen;
+ numlen = nf_strtou16(ptran+off, &port);
+ off += numlen;
+ origlen += numlen;
+
+ if (port != prtspexp->loport)
+ {
+ pr_debug("multiple ports found, port %hu ignored\n", port);
+ }
+ else
+ {
+ diff = origlen-rbuflen;
+ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
+ origoff, origlen, rbuf, rbuflen))
+ {
+ /* mangle failed, all we can do is bail */
+ nf_ct_unexpect_related(exp);
+ return 0;
+ }
+ get_skb_tcpdata(skb, &ptcp, &tcplen);
+ ptran = ptcp+tranoff;
+ tranlen -= diff;
+ nextparamoff -= diff;
+ nextfieldoff -= diff;
+ }
+ }
off = nextfieldoff;
}
@@ -378,7 +420,7 @@ help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
}
if (off > hdrsoff+hdrslen)
{
- pr_info("!! overrun !!");
+ pr_debug("!! overrun !!");
break;
}
pr_debug("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);