summaryrefslogtreecommitdiff
path: root/package/rtsp/src/nf_nat_rtsp.c
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/src/nf_nat_rtsp.c
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/src/nf_nat_rtsp.c')
-rw-r--r--package/rtsp/src/nf_nat_rtsp.c48
1 files changed, 45 insertions, 3 deletions
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);