libpcp / pcp

PCP client library
BSD 2-Clause "Simplified" License
69 stars 30 forks source link

bug? lifetime behavior is different then documented, mapping is renewed but never expires #24

Closed borisVanhoof closed 2 months ago

borisVanhoof commented 1 year ago

Hi,

I have a question about pcp MAP lifetimes. According to https://www.rfc-editor.org/rfc/rfc6887#section-15 the lifetime is the duration that the port mapping is active. This also matches the documentation of the flow API. However I observe that the behavior of libpcp is to renew the mapping by sending a new MAP request at lifetime/2 seconds. There is no end to this mapping.

Should the documentation be updated or is this a bug in the implementation?

Kind regards, Boris

////////////////////////////////////////////////////////////////////////////////
//                          Flow API

/*
 * Creates new PCP message from parameters parsed to this function:
 *  src_addr    source IP/port
 *  dst_addr    destination IP/port - optional
 *  ext_addr    sugg. ext. IP/port  - optional
 *  protocol    protocol associated with flow
 *  lifetime    time in seconds how long should mapping last
 *  userdata    pointer to user data associated with a new flow
 *
 *  return value
 *  pcp_flow_t *used in other functions to reference this flow.
 */
pcp_flow_t *pcp_new_flow(pcp_ctx_t *ctx, struct sockaddr *src_addr,
        struct sockaddr *dst_addr, struct sockaddr *ext_addr, uint8_t protocol,
        uint32_t lifetime, void *userdata);
borisVanhoof commented 1 year ago

here is a wireshark capture of the request / responses libpcp.pcapng.zip

borisVanhoof commented 2 months ago

nvm could be correct behavior