Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3727 closed Bug (fixed)

Fix NAT-PMP race between renewal and expiry

Reported by: bodgit Owned by: bodgit
Priority: Normal Milestone: 2.12
Component: libtransmission Version: 2.11
Severity: Normal Keywords:


When Transmission requests a mapping with the default lifetime (1 hour) the NAT-PMP IETF draft specifies that the gateway MAY reduce the lifetime but SHOULDN'T increase it beyond what the client requested. Currently Transmission assumes that the lifetime of 1 hour in the request is always honoured.

In addition, the draft specifies that the client SHOULD begin to renew the mapping halfway through the lifetime, so assuming the 1 hour lifetime is honoured, Transmission should attempt to renew the mapping after 30 minutes. Currently Transmission sets the renewal 1 hour in the future so there is a small chance of the NAT-PMP gateway expiring the mapping before Transmission has chance to renew it (excluding the behaviour in the first bug above). This means that Transmission may get a different external port upon renewal.

Attached patch fixes both bugs by setting the renewal time to be half of the lifetime returned by the gateway.

Attachments (1)

transmission-natpmp-renewal.patch (681 bytes) - added by bodgit 11 years ago.
Patch to fix NAT-PMP renewal

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by bodgit

Patch to fix NAT-PMP renewal

comment:1 Changed 11 years ago by charles

  • Milestone changed from None Set to 2.12
  • Owner changed from charles to bodgit

Fixed in trunk by r11391. Thanks bodgit!

comment:2 Changed 11 years ago by charles

  • Resolution set to fixed
  • Status changed from new to closed

comment:3 Changed 11 years ago by Robby

Is this a patch that should be forwarded upstream to the maintainers of natpmp?

Note: See TracTickets for help on using tickets.