Closed AudriusButkevicius closed 8 years ago
See the figure in discover.go (or in RFC). Test1 received response, and identical==false
. Then Test2 responsed. This goes to the Full Cone branch. Response in Test2 always comes from the same address as Test1. ChangedAddr will be used for the second time Test1.
It is a little bit tricky in my code. Since Test2 has to be done no matter IP same
(identical==true
) or not, I perform Test2 first then check identical
etc.
As far as I understood from the diagram ChangeAddr only applies when you want to verify if the same local listening port, when sending to a different address, causes you to get a different external port.
This is different than some random IP on the internet being able to send you a packet over a connection which it never received a packet from you.
How else are you verifying if your connection is Full Cone, if you only ever receive packets from the same ip, port pair?
I see. It is a bug in the server side, and also in my side. I am debugging it with another STUN server.
Fixed a bug in xorMappedAddr
Still cannot figure out if the behavior is correct. It looks the packet sent is correct, but it's wired the server doesn't change ip or port.
And there is a similar problem in test3: change port is set while change ip is not set, but the recv addr shows both are changed.
I tried servers stun.ekiga.net:3478 and stun1.l.google.com:19302
So I think the server is not behaving correctly, I think I tired a different server and it worked correctly. Yet I don't know how the client ia supposed to behave.
Can I know which server works correctly? I may use it to test
stun.ekiga.net:3478
with pystun I get:
root@audrius:~# pystun -i 178.62.69.157
Send stun.ekiga.net:3478
Received ('217.10.68.152', 3478)
Send stun.ekiga.net:3478
Received ('217.116.122.138', 3479)
NAT Type: Open Internet
yet it doesn't work at home, but as I said, it's a new router, so I am not yet sure where the problem is.
It seems that in test2 the server still sends packet back without changing IP and port. The data the client sends to the server looks correct.
So I think it's the servers fault, but I feel that the library should detect this and potentially return an error.
In some case, it is not server's fault. I fixed this bug in #15
Hi,
I am testing this again, and I am hitting a strange issue, where my NAT is reported correctly as a full cone nat, but I believe it hasn't done proper testing.
I've made a small diff just for debugging:
And the verbose output is as follows:
Now correct me if I am wrong, but the response in Test2 came from the same address as Test1, hence there is no evidence that it is actually a full cone nat?
I feel that it's the stun server misbehaving, yet perhaps sanity checks should be performed client side too?
Also, I changed my router since I ran the last tests when it actually worked, so perhaps it's my router re-writing the addresses and causing this impression?
As I seem to get the same result with multiple stun servers...