warp-vpn

point to point VPN implementation
git clone git://git.2f30.org/warp-vpn
Log | Files | Refs | README

commit 9304dd3be2fde7c9ebc83df00aefa405a6900af9
parent d9197eccf82c172461f7428d6be74cb040c7a4a6
Author: sin <sin@2f30.org>
Date:   Thu, 24 Mar 2016 11:08:20 +0000

client should also challenge server

thanks rain1

Diffstat:
Mstun.c | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/stun.c b/stun.c @@ -546,10 +546,19 @@ serversetup(int devfd) setsockopt(netfd, IPPROTO_TCP, TCP_NODELAY, (int []){1}, sizeof(int)); + /* challenge client */ ret = challenge(netfd); if (ret < 0) { + close(netfd); logwarn("challenge-response failed"); + continue; + } + + /* respond to client's challenge */ + ret = response(netfd); + if (ret < 0) { close(netfd); + logwarn("challenge-response failed"); continue; } @@ -594,10 +603,19 @@ clientsetup(int devfd) setsockopt(netfd, IPPROTO_TCP, TCP_NODELAY, (int []){1}, sizeof(int)); + /* respond to server's challenge */ ret = response(netfd); if (ret < 0) { close(netfd); - logwarn("failed to respond to challenge"); + logwarn("challenge-response failed"); + return -1; + } + + /* challenge server */ + ret = challenge(netfd); + if (ret < 0) { + close(netfd); + logwarn("challenge-response failed"); return -1; }