On Thu, Dec 13, 2018 at 11:10:37AM +0100, Alin Nastac wrote: > From: Alin Nastac <alin.nastac@xxxxxxxxx> > > Each media stream negotiation between 2 SIP peers will trigger creation > of 4 different expectations (2 RTP and 2 RTCP): > - INVITE will create expectations for the media packets sent by the > called peer > - reply to the INVITE will create expectations for media packets sent > by the caller > > The dport used by these expectations usually match the ones selected > by the SIP peers, but they might get translated due to conflicts with > another expectation. When such event occur, it is important to do > this translation in both directions, dport translation on the receiving > path and sport translation on the sending path. > > This commit fixes the sport translation when the peer requiring it is > also the one that starts the media stream. In this scenario, first media > stream packet is forwarded from LAN to WAN and will rely on > nf_nat_sip_expected() to do the necessary sport translation. However, the > expectation matched by this packet does not contain the necessary information > for doing SNAT, this data being stored in the paired expectation created by > the sender's SIP message (INVITE or reply to it). Applied, thanks.