xtables-addons: nf_nat_rtsp does not rewrite destination= in server replies (XXX: unmangle stub)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, linux
- Domain
- networking
Research direction
Start in net/xtables-addons/patches/100-add-rtsp-conntrack.patch at nf_nat_rtsp() in extensions/rtsp/nf_nat_rtsp.c: compare the outbound destaction=auto rewrite with the IP_CT_DIR_REPLY branch marked XXX: unmangle. Work out how the client's original address is recoverable from the conntrack tuple in the reply direction, then rewrite each destination= back to it while keeping the message length. Done means the server reply's Transport: header reaches the STB with the LAN IP, confirmed by the WAN/LAN capture described.
Written by the indexing model from the issue text.
Description
Package Name
kmod-ipt-nathelper-rtsp (xtables-addons), file net/xtables-addons/patches/100-add-rtsp-conntrack.patch
Maintainer
@jow-
OpenWrt Version
24.10.6
OpenWrt Target/Subtarget
x64
Steps to Reproduce
Description
For an RTSP SETUP request, nf_nat_rtsp rewrites every destination= in the Transport: header to the router’s external IP (destaction=auto). In the reply direction the function does nothing:
c
case IP_CT_DIR_REPLY:
pr_debug("unmangle ! %u\n", ctinfo);
/* XXX: unmangle */
rc = NF_ACCEPT;
break;
(nf_nat_rtsp() in extensions/rtsp/nf_nat_rtsp.c, created by the patch above. The stub is present on openwrt-24.10, openwrt-25.12 and master.)
The server echoes the router’s IP in the reply’s Transport: header, and that echo reaches the client unchanged. If the external IP is longer than the client’s LAN IP, the reply also differs in length from what the client sent.
My IPTV STB accepts any IP in the echoed destination= as long as the length matches the original, but fails when it doesn’t. With the current helper, the reply has the router’s IP and the wrong length, so stream does not start.
Reproduce
STB on a private LAN IP behind OpenWrt NAT, RTSP helper assigned to the RTSP port.
The STB sends SETUP with N destination= fields. The helper rewrites all N to the router’s external IP.
Capture the server’s reply on the WAN side and on the LAN side.
Expected
The reply direction should restore each destination= to the client’s original IP, mirroring the outbound rewrite.
Actual Behaviour
The reply direction does not restore each destination= to the client’s original IP.
Confirmation Checklist
- The package is maintained in this repository.
- I understand that issues related to the base OpenWrt repository or LuCI repository will be closed.
- I am reporting an issue for OpenWrt, not an unsupported fork.
- Dominant language
- Makefile
- Stars
- 4.7k
- Forks
- 4k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 251
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openwrt/packages
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
openwrt/packages#31307 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
openwrt/packages#31306 · 1 comment ·
Maintainers usually reply within 1 day
All issues in openwrt/packages
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
webtorrent/webtorrent#3131 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100