About libwebrtc's stunserver xor mapped address

78 views
Skip to first unread message

Min Wang

unread,
Jun 23, 2019, 5:36:56 AM6/23/19
to discuss-webrtc
HI

I am wondering the following code ( libwebrtc' stunserver)  is correct or I misunderstood something:

in p2p/base/stun_server.cc


 94   if (!request->IsLegacy()) {
 95     mapped_addr = StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
 96   } else {
 97     mapped_addr = StunAttribute::CreateXorAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
 98   }

...

Is it correct?  My understanding from those two RFCs is: 

if it stun request is legacy ( means from RFC 3489 compatible client), it should reply STUN_ATTR_MAPPED_ADDRESS

Otherwise, should reply XOR mapped address.

The code just swapped the condition.



Thanks


min

Philipp Hancke

unread,
Jun 23, 2019, 5:46:14 AM6/23/19
to discuss...@googlegroups.com
that seems like a bug indeed. In addition the method name GetStunBindReqponse seems like a typo, it should be GetStunBindResponse. If you can contribute a patch (see https://webrtc.org/contributing/) that would probably be appreciated.
Note that the stunserver subproject is mostly to have something for unit tests which explains why this bug has not been noticed for a couple of years :-)

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/7b8ccca8-6f50-4190-a024-00cee677522e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harald Alvestrand

unread,
Jun 23, 2019, 6:27:18 AM6/23/19
to discuss...@googlegroups.com
Yes, please file a bug, and a patch would be welcome.

If no tests break when you reverse the condition, that is a strong indication that a test needs to be added too.

For more options, visit https://groups.google.com/d/optout.


-- 
Surveillance is pervasive. Go Dark.

Min Wang

unread,
Jun 23, 2019, 11:45:38 PM6/23/19
to discuss...@googlegroups.com
HI 

@Philipp and harald, thanks a lot!
 
Sure.  I will file a bug and  will try to submit a patch and check testing suite.


thanks

min

You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/zn4kmjflvt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/5e9ea025-fbc4-5e05-9247-dc522c9091f4%40alvestrand.no.
Reply all
Reply to author
Forward
0 new messages