Skip to content

Commit d109e9a

Browse files
committed
netfilter: nf_ct_h323: fix bug in rtcp natting
The nat_rtp_rtcp hook takes two separate parameters port and rtp_port. port is expected to be the real h245 address (found inside the packet). rtp_port is the even number closest to port (RTP ports are even and RTCP ports are odd). However currently, both port and rtp_port are having same value (both are rounded to nearest even numbers). This works well in case of openlogicalchannel with media (RTP/even) port. But in case of openlogicalchannel for media control (RTCP/odd) port, h245 address in the packet is wrongly modified to have an even port. I am attaching a pcap demonstrating the problem, for any further analysis. This behavior was introduced around v2.6.19 while rewriting the helper. Signed-off-by: Jagdish Motwani <jagdish.motwani@elitecore.com> Signed-off-by: Sanket Shah <sanket.shah@elitecore.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent d1992b1 commit d109e9a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎net/netfilter/nf_conntrack_h323_main.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,8 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
270270
return 0;
271271

272272
/* RTP port is even */
273-
port &= htons(~1);
274-
rtp_port = port;
275-
rtcp_port = htons(ntohs(port) + 1);
273+
rtp_port = port & ~htons(1);
274+
rtcp_port = port | htons(1);
276275

277276
/* Create expect for RTP */
278277
if ((rtp_exp = nf_ct_expect_alloc(ct)) == NULL)

0 commit comments

Comments
 (0)