[libnice agent] Compatibility issue with a stun server supports only RFC 5389(not support RFC 3489)
libnice always sends binding request message based on RFC 3489 when gethering candidates. In case of stun server that supports only RFC 5389, there is no binding response and compatibility issue occurs.
I wonder why libnice agent always send the packet based on RFC 3489 which is old version as default. Is it possible to change the version to RFC 5389 ?
There is a difference regarding magic cookie field between the versions
In RFC 5389,
The magic cookie field MUST contain the fixed value 0x2112A442 in network byte order.
In RFC 3489,
There is no the magic cookie value like RFC 5389 in STUN packet.
When I check tcpdump on below site, the site also sends binding packet based on RFC 5389. https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
- Below is the related code that libnice agent set RFC 3489 version always to gather candidates. https://github.com/libnice/libnice/blob/master/agent/agent.c
static void
priv_add_new_candidate_discovery_stun (NiceAgent *agent,
NiceSocket *nicesock, NiceAddress server,
NiceStream *stream, guint component_id)
{
...
// like below, RFC 3489 hardcoded
stun_agent_init (&cdisco->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489,
(agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
agent->compatibility == NICE_COMPATIBILITY_OC2007R2) ?
STUN_AGENT_USAGE_NO_ALIGNED_ATTRIBUTES : 0)