xtables-addons: nf_nat_rtsp does not rewrite destination= in server replies (XXX: unmangle stub)

Open
#31,311 1 comment 0 reactions 0 assignees View on GitHub

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

bug
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
Dominant language
Makefile
Stars
4.7k
Forks
4k
Avg merge
2d 2h
Merged PRs (30d)
251

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openwrt/packages

All issues in openwrt/packages

Similar issues

More Networking issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.